uchicago.src.sim.gui
Class Display2D

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

public abstract class Display2D
extends java.lang.Object
implements Displayable

Base class for all discrete 2D displays. Encapsulates a Discrete2DSpace and allows that space to be displayed on a DisplaySurface. The typical user should not use this class directly. The objects in the Discrete2DSpace are displayed in cells whose dimensions can be programmaticly and graphicaly defined. The size (that is, the size in pixels) of a Display2D is the size of the Discrete2DSpace * the cell size.

Version:
$Revision: 1.5 $ $Date: 2004/11/03 19:50:59 $
Author:
Nick Collier
See Also:
DisplaySurface, Discrete2DSpace

Field Summary
protected  Discrete2DSpace grid
           
protected  java.awt.Dimension size
           
 
Fields inherited from interface uchicago.src.sim.gui.Displayable
TOGGLE_LINKS, TOGGLE_NODES, TOGGLE_UPDATE_LAYOUT, TOGGLE_VIEW, TOGGLE_WRAP
 
Constructor Summary
Display2D(Discrete2DSpace grid)
          Constructs a Display2D with specified Discrete2DSpace to display
 
Method Summary
abstract  void drawDisplay(SimGraphics g)
          Draws whatever implements this interface on the SimGraphics object
 Discrete2DSpace getGrid()
          Gets the Discrete2DSpace that is being displayed
 java.awt.Dimension getSize()
          Gets the size of the display.
 void reSize(int width, int height)
          Resizes the display to the appropriate width and height adjusting the CELL SIZE as appropriate.
 
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.Displayable
getDisplayableInfo, viewEventPerformed
 

Field Detail

grid

protected Discrete2DSpace grid

size

protected java.awt.Dimension size
Constructor Detail

Display2D

public Display2D(Discrete2DSpace grid)
Constructs a Display2D with specified Discrete2DSpace to display

Parameters:
grid - the space to display
Method Detail

getGrid

public Discrete2DSpace getGrid()
Gets the Discrete2DSpace that is being displayed


getSize

public java.awt.Dimension getSize()
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

reSize

public void reSize(int width,
                   int height)
Resizes the display to the appropriate width and height adjusting the CELL SIZE as appropriate.


drawDisplay

public abstract void drawDisplay(SimGraphics g)
Description copied from interface: Displayable
Draws whatever implements this interface on the SimGraphics object

Specified by:
drawDisplay in interface Displayable