All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class edu.cmu.owl.ui.twoD.Map

edu.cmu.owl.ui.twoD.Map

public class Map
The abstract representation of a map

Version:
5/11/97 Modifications: Aseem Sharma - We no longer have a list of all the elements we now have a heirarchy for all objects. The root is a ControlZonewoD. ControlZoneTwoD implements the recursive composition patern so it could contain any MapElement object. So we no longer have selectableElements list we now have to go through the whole heirarchy to get the list of selectable.

Constructor Index

 o Map()

Method Index

 o addElement(MapElement)
Add the given MapElement to this Map.
 o clone()
 o elementAt(Point)
Determine which selectable MapElement resides at the given point.
 o elements()
List all the highiest level MapElement's in this Map.
 o groupCalled()
This method is called when the users want to group the selected elements into a ControlZoneTwoD.
 o paint(Graphics, PointConverter, ImageObserver)
Paint each of the elements in this Map, using the given PointConverter to scale the dimensions of the Map to screen coordinates.
 o removeElement(MapElement)
Remove the given MapElement from this Map.
 o setSelected(Vector)
 o size()
The dimensions of this map.
 o ungroupCalled()
This method is called when he users wants to ungroup the selected group.

Constructors

 o Map
 public Map()

Methods

 o clone
 public Object clone()
 o size
 public Dimension size()
The dimensions of this map. Note that the units are in the same units as the MapElements, and may or may not correspond to screen pixels.

Returns:
size of the map
 o paint
 public void paint(Graphics g,
                   PointConverter p,
                   ImageObserver obs)
Paint each of the elements in this Map, using the given PointConverter to scale the dimensions of the Map to screen coordinates.

Parameters:
g - the graphics object we will draw on
p - the object that converts pixels to wall coordinates and vice-versa
 o addElement
 public void addElement(MapElement newElement)
Add the given MapElement to this Map. Since this is called by MapBuilder and MapBuilder does not know about the implementation details of Map,Map actually maps it to parsing the theElements tree and inserting the newElement as the immediate child of the root.

Parameters:
newElement - the MapElement object that needs to be added to the map
 o removeElement
 public void removeElement(MapElement element)
Remove the given MapElement from this Map.

Parameters:
element - is the MapElement
 o elements
 public Enumeration elements()
List all the highiest level MapElement's in this Map.

 o elementAt
 public MapElement elementAt(Point where)
Determine which selectable MapElement resides at the given point. If multiple MapElements overlap, the one with the smallest area is returned.

 o groupCalled
 public void groupCalled()
This method is called when the users want to group the selected elements into a ControlZoneTwoD. Right now, the algorithm says only the immediate children of the root can be grouped. For any other mapelement in the heirarchy, this call is just ignored.

 o ungroupCalled
 public void ungroupCalled()
This method is called when he users wants to ungroup the selected group.

 o setSelected
 public void setSelected(Vector temp)

All Packages  Class Hierarchy  This Package  Previous  Next  Index