uchicago.src.sim.gui
Class HexaDisplay2D

java.lang.Object
  extended by uchicago.src.sim.gui.Display2D
      extended by uchicago.src.sim.gui.HexaDisplay2D
All Implemented Interfaces:
Displayable, Probeable
Direct Known Subclasses:
Object2DHexaDisplay, Value2DHexaDisplay

public abstract class HexaDisplay2D
extends Display2D
implements Probeable

Base class for two dimensional displays of hexagonal spaces. This class takes care of calculating the hexagon sizes, but itself does not do any drawing.


Field Summary
protected  java.awt.Color frameColor
           
protected  boolean isFramed
           
protected static java.awt.Polygon polyClip
           
protected  java.awt.Polygon polyDraw
           
protected  boolean view
           
protected static int xTrans
           
protected static int xTrans1q
           
protected static int yTrans
           
protected static int 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
HexaDisplay2D(Discrete2DSpace hexagrid)
          Creates a HexaDisplay2D for the specifed Discrete2DSpace
 
Method Summary
protected  java.awt.Dimension getCoordinates(int x, int y)
           
 java.util.ArrayList getDisplayableInfo()
          Gets a list of the DisplayInfo objects associated with this HexDisplay.
 java.awt.Color getFrameColor()
           
 java.awt.Dimension getSize()
          Gets the size of the display.
 boolean isFramed()
           
protected  java.awt.Dimension selectPolygon(int x, int y, int x1, int y1, int x2, int y2)
           
 void setFrameColor(java.awt.Color c)
           
 void setFramed(boolean b)
           
protected  void setHexagons()
           
 void setMoveableXY(Moveable moveable, int x, int y)
          Sets the new coordinates for specified moveable.
 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
drawDisplay, getGrid, reSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.gui.Probeable
getObjectsAt
 

Field Detail

view

protected boolean view

isFramed

protected boolean isFramed

frameColor

protected java.awt.Color frameColor

xTrans

protected static int xTrans

xTrans1q

protected static int xTrans1q

yTrans

protected static int yTrans

yTransHalf

protected static int yTransHalf

polyClip

protected static java.awt.Polygon polyClip

polyDraw

protected java.awt.Polygon polyDraw
Constructor Detail

HexaDisplay2D

public HexaDisplay2D(Discrete2DSpace hexagrid)
Creates a HexaDisplay2D for the specifed Discrete2DSpace

Method Detail

setHexagons

protected void setHexagons()

getDisplayableInfo

public java.util.ArrayList getDisplayableInfo()
Gets a list of the DisplayInfo objects associated with this HexDisplay.

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

selectPolygon

protected java.awt.Dimension selectPolygon(int x,
                                           int y,
                                           int x1,
                                           int y1,
                                           int x2,
                                           int y2)

getCoordinates

protected java.awt.Dimension getCoordinates(int x,
                                            int 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

getFrameColor

public java.awt.Color getFrameColor()

setFrameColor

public void setFrameColor(java.awt.Color c)

isFramed

public boolean isFramed()

setFramed

public void setFramed(boolean b)

getSize

public java.awt.Dimension getSize()
Description copied from class: Display2D
Gets the size of the display. The size of the display is the size of the contained Discrete2DSpace * DisplayConstants.CELL_WIDTH/HEIGHT

Specified by:
getSize in interface Displayable
Overrides:
getSize in class Display2D