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 Network2DDisplay

    java.lang.Object
      uchicago.src.sim.gui.Network2DDisplay

All Implemented Interfaces:
  Displayable, Probeable, Zoomable

    public class Network2DDisplay

extends java.lang.Object
implements Displayable, Probeable, Zoomable

Displays nodes and links that inhabit a VectorSpace, that is, nodes (and their links) that do not inhabit a grid. This expects to be drawing a VectorSpace of DrawableNonGridNodes or a List of DrawableNonGridNodes. Note that for efficiency this only draws a Node's out edges (which must be some other Node's in edge and so they all get drawn). It is important then that any edge that is being drawn be added to some Nodes list of out edges. In addition, these edges must implement DrawableEdge in order to be drawn.

Version:
  $Revision: 1.17 $ $Date: 2004/11/03 19:50:59 $
Author:
  Nick Collier
See Also:
  `DrawableNonGridNode`, `DrawableEdge`

Field Summary
`protected java.util.ArrayList` | `edges`
`protected int` | `height`
`protected GraphLayout` | `layout`
`protected java.util.Hashtable` | `nodePoint`
`protected java.util.ArrayList` | `tmpList`
`protected boolean` | `viewLinks`
`protected boolean` | `viewNodes`
`protected int` | `width`
`protected java.util.HashMap` | `zoomSet`

Fields inherited from interface uchicago.src.sim.gui.Displayable
`TOGGLE_LINKS, TOGGLE_NODES, TOGGLE_UPDATE_LAYOUT, TOGGLE_VIEW, TOGGLE_WRAP`

Constructor Summary
`Network2DDisplay(GraphLayout layout)` Creates a Network2DDisplay using the specified GraphLayout.
`Network2DDisplay(java.util.List list, int width, int height)` Creates a Network2DDisplay of the specified width and height for displaying the DrawableNonGridNodes in the list.
`Network2DDisplay(VectorSpace space, int width, int height)` Creates a Network2DDisplay of the specified width and height for displaying the DrawableNonGridNodes and DrawableEdges in the specified space.

Method Summary
`void` | `drawDisplay(SimGraphics g)` Draws this display
`void` | `endZoom()`
`java.util.ArrayList` | `getDisplayableInfo()` Gets the DisplayableInfo
`boolean` | `getDrawEdgesFirst()` Gets whether or not this draws the edges first and then the nodes over them.
`java.util.ArrayList` | `getObjectsAt(int x, int y)` Gets a list of the objects that contain the specified screen coordinate.
`java.awt.Dimension` | `getSize()` Gets the size of this VectorDisplay.
`void` | `setDrawEdgesFirst(boolean drawEdgesFirst)` Sets whether or not this draws the edges first and then the nodes over them.
`void` | `setLinksVisible(boolean isVisible)` Shows or hides links depending on the value of parameter isVisible.
`void` | `setMoveableXY(Moveable moveable, int x, int y)` Sets the new coordinates for specified moveable.
`void` | `setNodesVisible(boolean isVisible)` Shows or hids nodes depending on the value of the parameter isVisible.
`void` | `startZoom(int x, int y, int zWidth, int zHeight)`
`void` | `viewEventPerformed(ViewEvent evt)` Invoked when a viewEvent for this display is fired by the DisplaySurface.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### layout

    protected GraphLayout layout

### edges

    protected java.util.ArrayList edges

### nodePoint

    protected java.util.Hashtable nodePoint

### viewNodes

    protected boolean viewNodes

### viewLinks

    protected boolean viewLinks

### tmpList

    protected java.util.ArrayList tmpList

### height

    protected int height

### width

    protected int width

### zoomSet

    protected java.util.HashMap zoomSet

Constructor Detail

### Network2DDisplay

    public Network2DDisplay(VectorSpace space,
                            int width,
                            int height)

  Creates a Network2DDisplay of the specified width and height for displaying the DrawableNonGridNodes and DrawableEdges in the specified space.

  Parameters:
    `space` - the space containing the DrawableNonGridNodes to display
    `width` - the width of the display in pixels
    `height` - the height of the display in pixels

### Network2DDisplay

    public Network2DDisplay(java.util.List list,
                            int width,
                            int height)

  Creates a Network2DDisplay of the specified width and height for displaying the DrawableNonGridNodes in the list.

  Parameters:
    `list` - the list containing the DrawableNonGridNodes to display
    `width` - the width of the display in pixels
    `height` - the height of the display in pixels

### Network2DDisplay

    public Network2DDisplay(GraphLayout layout)

  Creates a Network2DDisplay using the specified GraphLayout.

  Parameters:
    `layout` - the GraphLayout for this Network2DDisplay.

Method Detail

### getDrawEdgesFirst

    public boolean getDrawEdgesFirst()

  Gets whether or not this draws the edges first and then the nodes over them. Default value is false.

  Returns:
    if true this draws the edges first then the nodes over them

### setDrawEdgesFirst

    public void setDrawEdgesFirst(boolean drawEdgesFirst)

  Sets whether or not this draws the edges first and then the nodes over them. Default value is false.

  Parameters:
    `drawEdgesFirst` - whether or not this draws edges first then nodes

### getSize

    public java.awt.Dimension getSize()

  Gets the size of this VectorDisplay.

  Specified by:
    `getSize` in interface `Displayable`

### setLinksVisible

    public void setLinksVisible(boolean isVisible)

  Shows or hides links depending on the value of parameter isVisible.

  Parameters:
    `isVisible` - if true, shows the links, otherwise hide links

### setNodesVisible

    public void setNodesVisible(boolean isVisible)

  Shows or hids nodes depending on the value of the parameter isVisible.

  Parameters:
    `isVisible` - if true, shows the nodes, otherwise hide nodes

### drawDisplay

    public void drawDisplay(SimGraphics g)

  Draws this display

  Specified by:
    `drawDisplay` in interface `Displayable`

### getDisplayableInfo

    public java.util.ArrayList getDisplayableInfo()

  Gets the DisplayableInfo

  Specified by:
    `getDisplayableInfo` in interface `Displayable`
  See Also:
    `DisplayInfo`

### getObjectsAt

    public java.util.ArrayList getObjectsAt(int x,
                                            int y)

  Gets a list of the objects that contain the specified screen coordinate.

  Specified by:
    `getObjectsAt` in interface `Probeable`
  Parameters:
    `x` - the x coordinate
    `y` - the y 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

### startZoom

    public void startZoom(int x,
                          int y,
                          int zWidth,
                          int zHeight)

  Specified by:
    `startZoom` in interface `Zoomable`

### endZoom

    public void endZoom()

  Specified by:
    `endZoom` in interface `Zoomable`

### viewEventPerformed

    public void viewEventPerformed(ViewEvent evt)

  Invoked when a viewEvent for this display is fired by the DisplaySurface.

  Specified by:
    `viewEventPerformed` in interface `Displayable`

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