Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uchicago.src.sim.gui
Class Object2DDisplay

    java.lang.Object
      uchicago.src.sim.gui.Display2D
          uchicago.src.sim.gui.Object2DDisplay

All Implemented Interfaces:
  Displayable, Probeable

Direct Known Subclasses:
  MultiObject2DDisplay, Network2DGridDisplay

    public class Object2DDisplay

extends Display2D
implements Probeable

Displays 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 grid, a Discrete2DSpace.

Version:
  $Revision: 1.8 $ $Date: 2004/11/03 19:50:59 $
Author:
  Nick Collier

Field Summary
`protected java.util.Collection` | `objsToDraw`
`protected boolean` | `view`

Fields inherited from class uchicago.src.sim.gui.Display2D
`grid, size`

Fields inherited from interface uchicago.src.sim.gui.Displayable
`TOGGLE_LINKS, TOGGLE_NODES, TOGGLE_UPDATE_LAYOUT, TOGGLE_VIEW, TOGGLE_WRAP`

Constructor Summary
`Object2DDisplay(Discrete2DSpace grid)` Creates an Object2DDisplay for displaying the specified Discrete2DSpace.

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` | `getDisplayableInfo()` Gets a list of the DisplayInfo object associated with this Object2DDisplay.
`java.util.ArrayList` | `getObjectsAt(int x, int y)` Gets the object at the specified screen coordinates for probing.
`void` | `setMoveableXY(Moveable moveable, int x, int y)` Sets the new coordinates for specified moveable.
`void` | `setObjectList(java.util.Collection objects)` Sets the list of objects to display.
`void` | `viewEventPerformed(ViewEvent evt)` Invoked when a viewEvent for this display is fired by the DisplaySurface.

Methods inherited from class uchicago.src.sim.gui.Display2D
`getGrid, getSize, reSize`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### objsToDraw

    protected java.util.Collection objsToDraw

### view

    protected boolean view

Constructor Detail

### Object2DDisplay

    public Object2DDisplay(Discrete2DSpace grid)

  Creates an Object2DDisplay for displaying the specified Discrete2DSpace.

  Parameters:
    `grid` - the space to display

Method Detail

### setObjectList

    public void setObjectList(java.util.Collection objects)

  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:
    `objects` - the collection of objects to draw

### 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`
  Parameters:
    `x` - the x coordinate
    `y` - the y coordinate
  Returns:
    the list of objects at x,y

### setMoveableXY

    public void setMoveableXY(Moveable moveable,
                              int x,
                              int y)

  Sets the new coordinates for specified moveable. This goes through probeable as some translation between screen pixel coordinates and the simulation coordinates may be necessary.

  Specified by:
    `setMoveableXY` in interface `Probeable`
  Parameters:
    `moveable` - the moveable whose coordinates are changed
    `x` - the x coordinate in pixels
    `y` - the y coordinate in pixels

### 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

### getDisplayableInfo

    public java.util.ArrayList getDisplayableInfo()

  Gets a list of the DisplayInfo object associated with this Object2DDisplay.

  Specified by:
    `getDisplayableInfo` in interface `Displayable`
  See Also:
    `DisplayInfo`

### viewEventPerformed

    public void viewEventPerformed(ViewEvent evt)

  Invoked when a viewEvent for this display is fired by the DisplaySurface.

  Specified by:
    `viewEventPerformed` in interface `Displayable`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD