uchicago.src.sim.gui
Class Value2DHexaDisplay

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

public class Value2DHexaDisplay
extends HexaDisplay2D

Displays 2d arrays of values (Integers or ints). As a Displayable this class iterates through a Discrete2DSpace, turns the integers into colors according to a ColorMap, and draws these colors in the appropriate cells.


Field Summary
 
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
Value2DHexaDisplay(Discrete2DSpace grid, ColorMap map)
          Creates a Value2DDisplay to display the specified Discrete2DSpace using the specified ColorMap.
 
Method Summary
 void drawDisplay(SimGraphics g)
          Draws the Discrete2DSpace converting the Numbers contained therein to Colors according to the ColorMap specified in the constructor
 java.util.ArrayList getObjectsAt(int x, int y)
          Gets an ArrayList of Objects at an x, y screen (pixel) coordinate.
 boolean isZeroTransparent()
          Returns whether a zero value in space drawn by this grid is transparent or drawn according to the color map.
 void setDisplayMapping(int m, int c)
          Linear transform of states (doubles, floats, integers etc.) to colors for drawing. color = state / m + c
 void setZeroTransparent(boolean val)
          Sets whether or not a zero value in space drawn by this grid is transparent or drawn according to the color map.
 
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
 

Constructor Detail

Value2DHexaDisplay

public Value2DHexaDisplay(Discrete2DSpace grid,
                          ColorMap map)
Creates a Value2DDisplay to display the specified Discrete2DSpace using the specified ColorMap.

Method Detail

setDisplayMapping

public void setDisplayMapping(int m,
                              int c)
Linear transform of states (doubles, floats, integers etc.) to colors for drawing. color = state / m + c


setZeroTransparent

public void setZeroTransparent(boolean val)
Sets whether or not a zero value in space drawn by this grid is transparent or drawn according to the color map. Default is to draw according to the color map.

Parameters:
val - if true, zero value will be drawn as transparent, otherwise the value in the color map is drawn.

isZeroTransparent

public boolean isZeroTransparent()
Returns whether a zero value in space drawn by this grid is transparent or drawn according to the color map.


drawDisplay

public void drawDisplay(SimGraphics g)
Draws the Discrete2DSpace converting the Numbers contained therein to Colors according to the ColorMap specified in the constructor

Specified by:
drawDisplay in interface Displayable
Specified by:
drawDisplay in class Display2D

getObjectsAt

public java.util.ArrayList getObjectsAt(int x,
                                        int y)
Gets an ArrayList of Objects at an x, y screen (pixel) coordinate. Implements the probeable interface.

Parameters:
x - the x screen coordinate.
y - the y screen coordinate.
Returns:
the object at the x, y coordinate.