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 Value2DDisplay

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

All Implemented Interfaces:
  Displayable, Probeable

    public class Value2DDisplay

extends Display2D
implements Probeable

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.

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

Field Summary

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
`Value2DDisplay(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` | `getDisplayableInfo()` Gets a list of the DisplayInfo objects associated with this Object2DDisplay.
`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` | `setMoveableXY(Moveable moveable, int x, int y)` Sets the new coordinates for specified moveable.
`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.
`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`

Constructor Detail

### Value2DDisplay

    public Value2DDisplay(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`

### getDisplayableInfo

    public java.util.ArrayList getDisplayableInfo()

  Gets a list of the DisplayInfo objects 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`

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

  Specified by:
    `getObjectsAt` in interface `Probeable`
  Parameters:
    `x` - the x screen coordinate.
    `y` - the y screen coordinate.
  Returns:
    the object at the x, y coordinate.

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

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