uchicago.src.repastdemos.life
Class InfiniteSpaceDisplay

java.lang.Object
  extended by uchicago.src.repastdemos.life.InfiniteSpaceDisplay
All Implemented Interfaces:
Displayable, Probeable

public class InfiniteSpaceDisplay
extends java.lang.Object
implements Displayable, Probeable

Display class for displaying InfiniteLifeSpaces. This acts as a window into the sparse matrix that is the InfiniteLifeSpace. The origin and width of the window can be set while the model is running and thus provide a scrolling window into the space.


Field Summary
protected  boolean view
           
 
Fields inherited from interface uchicago.src.sim.gui.Displayable
TOGGLE_LINKS, TOGGLE_NODES, TOGGLE_UPDATE_LAYOUT, TOGGLE_VIEW, TOGGLE_WRAP
 
Constructor Summary
InfiniteSpaceDisplay(SparseObjectMatrix matrix, int x, int y, int width, int height, int max)
           
 
Method Summary
 void drawDisplay(SimGraphics g)
          Draws the objects (Drawables) contained by the view window.
 java.util.ArrayList getDisplayableInfo()
          Returns an ArrayList of DisplayInfo objects used by a DisplaySurface to create the View menu for that displayable
 java.util.ArrayList getObjectsAt(int mx, int my)
          Gets a list of objects at the specified screen (pixel) coordinates.
 java.awt.Dimension getSize()
          Gets the size of the display.
 int getViewX()
          Gets the x origin of the view window.
 int getViewY()
          Gets the y origin of the view window.
 void reSize(int width, int height)
           
 void setMoveableXY(Moveable moveable, int x, int y)
          Sets the new coordinates for specified moveable.
 void setViewWindow(int x, int y, int width, int height)
          Sets the origin and width of the window into the "infinite" space.
 void viewEventPerformed(ViewEvent evt)
          Invoked when a display event occurs, through the view menu of a display surface for example.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

view

protected boolean view
Constructor Detail

InfiniteSpaceDisplay

public InfiniteSpaceDisplay(SparseObjectMatrix matrix,
                            int x,
                            int y,
                            int width,
                            int height,
                            int max)
Method Detail

setViewWindow

public void setViewWindow(int x,
                          int y,
                          int width,
                          int height)
Sets the origin and width of the window into the "infinite" space.


getViewX

public int getViewX()
Gets the x origin of the view window.


getViewY

public int getViewY()
Gets the y origin of the view window.


getObjectsAt

public java.util.ArrayList getObjectsAt(int mx,
                                        int my)
Gets a list of objects at the specified screen (pixel) coordinates.

Specified by:
getObjectsAt in interface Probeable
Parameters:
mx - the x screen coordinate.
my - 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

drawDisplay

public void drawDisplay(SimGraphics g)
Draws the objects (Drawables) contained by the view window.

Specified by:
drawDisplay in interface Displayable
Parameters:
g - the graphics context on which to draw

getDisplayableInfo

public java.util.ArrayList getDisplayableInfo()
Description copied from interface: Displayable
Returns an ArrayList of DisplayInfo objects used by a DisplaySurface to create the View menu for that displayable

Specified by:
getDisplayableInfo in interface Displayable
See Also:
DisplayInfo

viewEventPerformed

public void viewEventPerformed(ViewEvent evt)
Description copied from interface: Displayable
Invoked when a display event occurs, through the view menu of a display surface for example. Not used to do the actual drawing.

Specified by:
viewEventPerformed in interface Displayable

getSize

public java.awt.Dimension getSize()
Description copied from interface: Displayable
Gets the size of the display.

Specified by:
getSize in interface Displayable

reSize

public void reSize(int width,
                   int height)