uchicago.src.sim.gui
Class Object2DHexaDisplay

java.lang.Object
  extended by uchicago.src.sim.gui.Display2D
      extended by uchicago.src.sim.gui.HexaDisplay2D
          extended by 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
           
 
Fields inherited from class uchicago.src.sim.gui.HexaDisplay2D
frameColor, isFramed, polyClip, polyDraw, view, xTrans, xTrans1q, yTrans, yTransHalf
 
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
Object2DHexaDisplay(Discrete2DSpace hexagrid)
          Creates an Object2DHexaDisplay 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 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 uchicago.src.sim.gui.Display2D
getGrid, reSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

objList

protected java.util.ArrayList objList
Constructor Detail

Object2DHexaDisplay

public Object2DHexaDisplay(Discrete2DSpace hexagrid)
Creates an Object2DHexaDisplay for displaying the specified Discrete2DSpace.

Parameters:
hexagrid - the space to display
Method Detail

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 coordinate
y - 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