uchicago.src.sim.gui
Class Object2DHexaDisplay
java.lang.Object
uchicago.src.sim.gui.Display2D
uchicago.src.sim.gui.HexaDisplay2D
uchicago.src.sim.gui.Object2DHexaDisplay
- All Implemented Interfaces:
- Displayable, Probeable
public class Object2DHexaDisplay
- extends HexaDisplay2D
Title: 2D Hexagonal Spaces
Description: 2D Hexagonal space library
Copyright: Copyright (c) 2001
Company: Harvard University
Displays a hexagonal layout of Discrete2DSpaces and the objects contained
within them. Implements probeable so that the objects within the
Discrete2DSpace can be probed. All the objects within the space are
expected to have implemented Drawable.
Objects are displayed on a hexagonal grid.
- Version:
- 1.0
- Author:
- Laszlo Gulyas
|
Field Summary |
protected java.util.ArrayList |
objList
|
|
Method Summary |
void |
drawDisplay(SimGraphics g)
Draws the contained space, either by iterating over the entire space
and calling draw(SimGraphics g) on the Drawables contained therein, or
by iterating through a list of Drawables and calling draw(SimGraphics g)
on them. |
java.util.ArrayList |
getObjectsAt(int x,
int y)
Gets the object at the specified screen coordinates for probing. |
void |
setObjectList(java.util.ArrayList objectList)
Sets the list of objects to display. |
| Methods inherited from class uchicago.src.sim.gui.HexaDisplay2D |
getCoordinates, getDisplayableInfo, getFrameColor, getSize, isFramed, selectPolygon, setFrameColor, setFramed, setHexagons, setMoveableXY, viewEventPerformed |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
objList
protected java.util.ArrayList objList
Object2DHexaDisplay
public Object2DHexaDisplay(Discrete2DSpace hexagrid)
- Creates an Object2DHexaDisplay for displaying the specified Discrete2DSpace.
- Parameters:
hexagrid - the space to display
setObjectList
public void setObjectList(java.util.ArrayList objectList)
- Sets the list of objects to display. If a space is sparsely populated then
rather than iterating over the entire space looking for objects to draw,
this Object2DDisplay can iterate only over the specified list and draw
those objects. This list is expected to contain objects implementing the
drawable interface.
- Parameters:
objectList - the list of objects to draw
getObjectsAt
public java.util.ArrayList getObjectsAt(int x,
int y)
- Gets the object at the specified screen coordinates for probing.
- Parameters:
x - the x coordinatey - the y coordinate
- Returns:
- the list of objects at x,y
drawDisplay
public void drawDisplay(SimGraphics g)
- Draws the contained space, either by iterating over the entire space
and calling draw(SimGraphics g) on the Drawables contained therein, or
by iterating through a list of Drawables and calling draw(SimGraphics g)
on them. This method should never by called directly by a user.
- Specified by:
drawDisplay in interface Displayable- Specified by:
drawDisplay in class Display2D
- Parameters:
g - the graphics context on which to draw