Class JGraphSpringLayout
java.lang.Object
com.jgraph.layout.graph.JGraphSpringLayout
- All Implemented Interfaces:
JGraphLayout, JGraphLayout.Stoppable
Deprecated.
use JGraphFastOrganicLayout instead
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 JGraphLayout
JGraphLayout.Stoppable -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected double[]Deprecated.An array of locally stored X co-ordinate positions for the verticesprotected double[]Deprecated.An array of locally stored Y co-ordinate positions for the verticesprotected MapDeprecated.Stores the temporary positions of each cell during the layoutprotected double[]Deprecated.An array of locally stored X co-ordinate displacements for the verticesprotected double[]Deprecated.An array of locally stored Y co-ordinate displacements for the verticesprotected boolean[]Deprecated.Local copy of isMoveableprotected intDeprecated.current iteration numberprotected intDeprecated.total number of iterations to step through when runningprotected int[][]Deprecated.Local copy of cell neighboursprotected JGraphLayoutProgressDeprecated.An object to monitor and control progress.protected doubleDeprecated.The multiple by which the force replusive each pair of nodes scaled by Increase to make nodes force further apartprotected doubleDeprecated.The multiple of force applied to the attraction of springsprotected doubleDeprecated.The natural length of the spring (edge) whereby it imparts no force on either connected nodeprotected Object[]Deprecated.An array of all vertices to be laid outFields inherited from interface JGraphLayout
VERSION -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new layout of 50 iterationsJGraphSpringLayout(int iterations) Deprecated.Creates a new spring layout to be executed over the specified number of iterations -
Method Summary
Modifier and TypeMethodDescriptionprotected voidattract()Deprecated.Calculates an attractive force between the cells connected by the specified edgeintDeprecated.Deprecated.Returns the progress object that represents the progress of the current layout run.doubleDeprecated.doubleDeprecated.doubleDeprecated.protected voidreposition(JGraphFacade graph) Deprecated.repositions the specified cells using the positioning data obtained through repulse and attract phasesprotected voidrepulse()Deprecated.Calculates a repulsion force between the specified cells and stores the cumulative displacement applied to each cellvoidrun(JGraphFacade graph) Deprecated.Executes the spring layout of the specified facade datavoidsetMaxIterations(int iterations) Deprecated.voidsetReplusiveForce(double replusiveForce) Deprecated.voidsetSpringForce(double springForce) Deprecated.voidsetSpringLength(double springLength) Deprecated.toString()Deprecated.ReturnsSpring, the name of this algorithm.
-
Field Details
-
displacement
Deprecated.Stores the temporary positions of each cell during the layout -
replusiveForce
protected double replusiveForceDeprecated.The multiple by which the force replusive each pair of nodes scaled by Increase to make nodes force further apart -
springForce
protected double springForceDeprecated.The multiple of force applied to the attraction of springs -
springLength
protected double springLengthDeprecated.The natural length of the spring (edge) whereby it imparts no force on either connected node -
iteration
protected int iterationDeprecated.current iteration number -
maxIterations
protected int maxIterationsDeprecated.total number of iterations to step through when running -
vertexArray
-
dispX
protected double[] dispXDeprecated.An array of locally stored X co-ordinate displacements for the vertices -
dispY
protected double[] dispYDeprecated.An array of locally stored Y co-ordinate displacements for the vertices -
cellLocationX
protected double[] cellLocationXDeprecated.An array of locally stored X co-ordinate positions for the vertices -
cellLocationY
protected double[] cellLocationYDeprecated.An array of locally stored Y co-ordinate positions for the vertices -
isMoveable
protected boolean[] isMoveableDeprecated.Local copy of isMoveable -
neighbours
protected int[][] neighboursDeprecated.Local copy of cell neighbours -
progress
-
-
Constructor Details
-
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 Details
-
getProgress
Deprecated.Description copied from interface:JGraphLayout.StoppableReturns 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:
getProgressin interfaceJGraphLayout.Stoppable- Returns:
- Returns the progress.
-
run
Deprecated.Executes the spring layout of the specified facade data- Specified by:
runin interfaceJGraphLayout- 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
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 setmaxIterationsto
-
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
-