uchicago.src.sim.gui
Class MultiObject2DDisplay
java.lang.Object
uchicago.src.sim.gui.Display2D
uchicago.src.sim.gui.Object2DDisplay
uchicago.src.sim.gui.MultiObject2DDisplay
- All Implemented Interfaces:
- Displayable, Probeable
public class MultiObject2DDisplay
- extends Object2DDisplay
Displays IMulti2DGrid-s and the objects contained within them. Implements
probeable so that the objects within the IMulti2DGrid can be probed. All
the objects within the space are expected to have implemented Drawable.
Objects are displayed on a grid, an IMulti2DGrid.
- Version:
- $Revision: 1.6 $ $Date: 2004/11/03 19:50:59 $
- Author:
- Nick Collier
- See Also:
IMulti2DGrid
|
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MultiObject2DDisplay
public MultiObject2DDisplay(IMulti2DGrid grid)
- Creates a MultiObject2DDisplay for displaying the specified
IMulti2DGrid.
- Parameters:
grid - the space to display
getObjectsAt
public java.util.ArrayList getObjectsAt(int x,
int y)
- Gets the object at the specified screen coordinates for probing.
- Specified by:
getObjectsAt in interface Probeable- Overrides:
getObjectsAt in class Object2DDisplay
- 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.
When drawing IMulti2DGrids and drawing each cell only the "top"
Drawable in each cell is drawn. For ordered grids this will be
the last object added to that cell. For unordered grids the "top"
object is undetermined.
- Specified by:
drawDisplay in interface Displayable- Overrides:
drawDisplay in class Object2DDisplay
- Parameters:
g - the graphics context on which to draw