giny.util
Class Abstract3DLayout

java.lang.Object
  extended byginy.util.Abstract3DLayout
Direct Known Subclasses:
ISOM3DLayout

public abstract class Abstract3DLayout
extends java.lang.Object


Field Summary
protected  java.awt.Dimension currentSize
           
protected  GraphView graphView
           
protected  java.util.Set staticNodes
           
 
Constructor Summary
Abstract3DLayout(GraphView view)
           
 
Method Summary
abstract  void advancePositions()
          Implementors must override this method in order to create a Layout.
abstract  void doLayout()
           
 boolean dontMove(NodeView nv)
           
 void forceMove(NodeView picked, double x, double y, double z)
          Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location.
 java.awt.Dimension getCurrentSize()
          Returns the current size of the visualization space, accoring to the last call to resize().
 NodeView getNodeView(double x, double y, double z)
           
 java.lang.String getStatus()
          {@inheritDoc} By default, an AbstractLayout returns null for its status.
protected abstract  void initialize_local_node_view(NodeView nv)
          Initializes the local information on a single vertex.
protected abstract  void initialize_local()
          Initializes all local information, and is called immediately within the initialize() process.
 void initialize(java.awt.Dimension size)
          Initializer, calls intialize_local and initializeLocations to start construction process.
protected  void initializeLocation(NodeView v, java.awt.Dimension d)
          Sets random locations for a vertex within the dimensions of the space.
protected  void initializeLocations()
          This method calls initialize_local_vertex for each vertex, and also adds initial coordinate information for each vertex.
 void lockVertex(NodeView v)
          Adds the vertex to the DontMove list
 void resize(java.awt.Dimension size)
          When a visualizetion is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data.
 void restart()
          Restarts the visualization entirely, as if the the user had pressed the "scramble" button.
 void unlockVertex(NodeView v)
          Removes the vertex from the DontMove list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

staticNodes

protected java.util.Set staticNodes

graphView

protected GraphView graphView

currentSize

protected java.awt.Dimension currentSize
Constructor Detail

Abstract3DLayout

public Abstract3DLayout(GraphView view)
Method Detail

doLayout

public abstract void doLayout()

dontMove

public boolean dontMove(NodeView nv)

initialize

public void initialize(java.awt.Dimension size)
Initializer, calls intialize_local and initializeLocations to start construction process.


initialize_local

protected abstract void initialize_local()
Initializes all local information, and is called immediately within the initialize() process. The user is responsible for overriding this method to do any construction that may be necessary: for example, to initialize local per-edge or graph-wide data.


initialize_local_node_view

protected abstract void initialize_local_node_view(NodeView nv)
Initializes the local information on a single vertex. The user is responsible for overriding this method to do any vertex-level construction that may be necessary: for example, to attach vertex-level information to each vertex.


initializeLocations

protected void initializeLocations()
This method calls initialize_local_vertex for each vertex, and also adds initial coordinate information for each vertex. (The vertex's initial location is set by calling initializeLocation.


initializeLocation

protected void initializeLocation(NodeView v,
                                  java.awt.Dimension d)
Sets random locations for a vertex within the dimensions of the space. If you want to initialize in some different way, override this method.

Parameters:
v -
d -

getStatus

public java.lang.String getStatus()
{@inheritDoc} By default, an AbstractLayout returns null for its status.


advancePositions

public abstract void advancePositions()
Implementors must override this method in order to create a Layout. If the Layout is the sort that only calculates locations once, this method may be overridden with an empty method.

Note that "locked" vertices are not to be moved; however, it is the policy of the visualization to decide how to handle them, and what to do with the vertices around them. Prototypical code might include a clipping like

 		for (Iterator i = getVertices().iterator(); i.hasNext() ) {
 			Vertex v = (Vertex) i.next();
 			if (! dontmove.contains( v ) ) {
 				... // handle the node
 			} else { // ignore the node
 			}
 		}
 

See Also:
Layout#advancePositions()

getCurrentSize

public java.awt.Dimension getCurrentSize()
Returns the current size of the visualization space, accoring to the last call to resize().

Returns:
the current size of the screen

resize

public void resize(java.awt.Dimension size)
When a visualizetion is resized, it presumably wants to fix the locations of the vertices and possibly to reinitialize its data. The current method calls initializeLocations followed by initialize_local. TODO: A better implementation wouldn't destroy the current information, but would either scale the current visualization, or move the nodes toward the new center.


restart

public void restart()
Restarts the visualization entirely, as if the the user had pressed the "scramble" button. Calls initializeLocation for each vertex. TODO: Is this enough? Should it call the whole initialization process? Why does resize do more?


getNodeView

public NodeView getNodeView(double x,
                            double y,
                            double z)
Returns:
the closest NodeView to these coords.

forceMove

public void forceMove(NodeView picked,
                      double x,
                      double y,
                      double z)
Forcibly moves a vertex to the (x,y) location by setting its x and y locations to the inputted location. Does not add the vertex to the "dontmove" list, and (in the default implementation) does not make any adjustments to the rest of the graph.


lockVertex

public void lockVertex(NodeView v)
Adds the vertex to the DontMove list


unlockVertex

public void unlockVertex(NodeView v)
Removes the vertex from the DontMove list