JGraph
v5.13.0.4


com.jgraph.layout.graph
Class JGraphSpringLayout

java.lang.Object
  extended by com.jgraph.layout.graph.JGraphSpringLayout
All Implemented Interfaces:
JGraphLayout, JGraphLayout.Stoppable

Deprecated. use JGraphFastOrganicLayout instead

public class JGraphSpringLayout
extends java.lang.Object
implements JGraphLayout, JGraphLayout.Stoppable

A basic Spring Embedded Layout Algorithm. Edges on the graph represent spring. All the springs have a natural length, measured in the same units as the screen co-ordination system, which they attempt to achieve constantly. If the spring is shorter than its natural length it extends, pushing the nodes are either end of the edge apart. If the spring is longer than its natural length it contracts, pulling the nodes at either end of the edge together. The force exerted by the spring is proportional to different between its current length and its natural length. A force multiple is also applied indicating the "strength" of the spring. In addition, all nodes repel each other with a force inversely proportional to the distance between each other. The repelling force is mutliplied by a replusive force factor. The whole affect is to cause nodes to space out fairly evenly but for nodes linked by edges ( springs ) to cluster together


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.jgraph.layout.JGraphLayout
JGraphLayout.Stoppable
 
Field Summary
protected  double[] cellLocationX
          Deprecated. An array of locally stored X co-ordinate positions for the vertices
protected  double[] cellLocationY
          Deprecated. An array of locally stored Y co-ordinate positions for the vertices
protected  java.util.Map displacement
          Deprecated. Stores the temporary positions of each cell during the layout
protected  double[] dispX
          Deprecated. An array of locally stored X co-ordinate displacements for the vertices
protected  double[] dispY
          Deprecated. An array of locally stored Y co-ordinate displacements for the vertices
protected  boolean[] isMoveable
          Deprecated. Local copy of isMoveable
protected  int iteration
          Deprecated. current iteration number
protected  int maxIterations
          Deprecated. total number of iterations to step through when running
protected  int[][] neighbours
          Deprecated. Local copy of cell neighbours
protected  JGraphLayoutProgress progress
          Deprecated. An object to monitor and control progress.
protected  double replusiveForce
          Deprecated. The multiple by which the force replusive each pair of nodes scaled by Increase to make nodes force further apart
protected  double springForce
          Deprecated. The multiple of force applied to the attraction of springs
protected  double springLength
          Deprecated. The natural length of the spring (edge) whereby it imparts no force on either connected node
protected  java.lang.Object[] vertexArray
          Deprecated. An array of all vertices to be laid out
 
Fields inherited from interface com.jgraph.layout.JGraphLayout
VERSION
 
Constructor Summary
JGraphSpringLayout()
          Deprecated. Creates a new layout of 50 iterations
JGraphSpringLayout(int iterations)
          Deprecated. Creates a new spring layout to be executed over the specified number of iterations
 
Method Summary
protected  void attract()
          Deprecated. Calculates an attractive force between the cells connected by the specified edge
 int getMaxIterations()
          Deprecated.  
 JGraphLayoutProgress getProgress()
          Deprecated. Returns the progress object that represents the progress of the current layout run.
 double getReplusiveForce()
          Deprecated.  
 double getSpringForce()
          Deprecated.  
 double getSpringLength()
          Deprecated.  
protected  void reposition(JGraphFacade graph)
          Deprecated. repositions the specified cells using the positioning data obtained through repulse and attract phases
protected  void repulse()
          Deprecated. Calculates a repulsion force between the specified cells and stores the cumulative displacement applied to each cell
 void run(JGraphFacade graph)
          Deprecated. Executes the spring layout of the specified facade data
 void setMaxIterations(int iterations)
          Deprecated.  
 void setReplusiveForce(double replusiveForce)
          Deprecated.  
 void setSpringForce(double springForce)
          Deprecated.  
 void setSpringLength(double springLength)
          Deprecated.  
 java.lang.String toString()
          Deprecated. Returns Spring, the name of this algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

displacement

protected transient java.util.Map displacement
Deprecated. 
Stores the temporary positions of each cell during the layout


replusiveForce

protected double replusiveForce
Deprecated. 
The multiple by which the force replusive each pair of nodes scaled by Increase to make nodes force further apart


springForce

protected double springForce
Deprecated. 
The multiple of force applied to the attraction of springs


springLength

protected double springLength
Deprecated. 
The natural length of the spring (edge) whereby it imparts no force on either connected node


iteration

protected int iteration
Deprecated. 
current iteration number


maxIterations

protected int maxIterations
Deprecated. 
total number of iterations to step through when running


vertexArray

protected java.lang.Object[] vertexArray
Deprecated. 
An array of all vertices to be laid out


dispX

protected double[] dispX
Deprecated. 
An array of locally stored X co-ordinate displacements for the vertices


dispY

protected double[] dispY
Deprecated. 
An array of locally stored Y co-ordinate displacements for the vertices


cellLocationX

protected double[] cellLocationX
Deprecated. 
An array of locally stored X co-ordinate positions for the vertices


cellLocationY

protected double[] cellLocationY
Deprecated. 
An array of locally stored Y co-ordinate positions for the vertices


isMoveable

protected boolean[] isMoveable
Deprecated. 
Local copy of isMoveable


neighbours

protected int[][] neighbours
Deprecated. 
Local copy of cell neighbours


progress

protected JGraphLayoutProgress progress
Deprecated. 
An object to monitor and control progress.

Constructor Detail

JGraphSpringLayout

public JGraphSpringLayout()
Deprecated. 
Creates a new layout of 50 iterations


JGraphSpringLayout

public JGraphSpringLayout(int iterations)
Deprecated. 
Creates a new spring layout to be executed over the specified number of iterations

Parameters:
iterations - the number of layout iterations to execute
Method Detail

getProgress

public JGraphLayoutProgress getProgress()
Deprecated. 
Description copied from interface: JGraphLayout.Stoppable
Returns the progress object that represents the progress of the current layout run. Once created, this instance should not be replaced during a layout run. For new runs you should use the reset method on the progress. Consequently, the max progress is only valid after the run method has been invoked, which means you should use a listener if you spawn a new thread.

By convention, the layout must check the isStopped method in its inner-most loops and return immediately if the method returns true.

Specified by:
getProgress in interface JGraphLayout.Stoppable
Returns:
Returns the progress.

run

public void run(JGraphFacade graph)
Deprecated. 
Executes the spring layout of the specified facade data

Specified by:
run in interface JGraphLayout
Parameters:
graph - the description of the graph to be acted upon

repulse

protected void repulse()
Deprecated. 
Calculates a repulsion force between the specified cells and stores the cumulative displacement applied to each cell


attract

protected void attract()
Deprecated. 
Calculates an attractive force between the cells connected by the specified edge


reposition

protected void reposition(JGraphFacade graph)
Deprecated. 
repositions the specified cells using the positioning data obtained through repulse and attract phases

Parameters:
graph - the description of the graph to be laid out

setMaxIterations

public void setMaxIterations(int iterations)
Deprecated. 
Parameters:
iterations - the value to set maxIterations to

getMaxIterations

public int getMaxIterations()
Deprecated. 
Returns:
Returns the total number of iterations.

getSpringLength

public double getSpringLength()
Deprecated. 
Returns:
Returns the springLength.

setSpringLength

public void setSpringLength(double springLength)
Deprecated. 
Parameters:
springLength - The springLength to set.

getSpringForce

public double getSpringForce()
Deprecated. 
Returns:
Returns the springForce.

setSpringForce

public void setSpringForce(double springForce)
Deprecated. 
Parameters:
springForce - The springForce to set.

getReplusiveForce

public double getReplusiveForce()
Deprecated. 
Returns:
Returns the replusiveForce.

setReplusiveForce

public void setReplusiveForce(double replusiveForce)
Deprecated. 
Parameters:
replusiveForce - The replusiveForce to set.

toString

public java.lang.String toString()
Deprecated. 
Returns Spring, the name of this algorithm.

Overrides:
toString in class java.lang.Object

JGraph
v5.13.0.4


Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.