|
JGraph |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jgraph.layout.graph.JGraphSpringLayout
public class JGraphSpringLayout
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 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 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. |
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 |
---|
protected transient Map displacement
protected double replusiveForce
protected double springForce
protected double springLength
protected int iteration
protected int maxIterations
protected Object[] vertexArray
protected double[] dispX
protected double[] dispY
protected double[] cellLocationX
protected double[] cellLocationY
protected boolean[] isMoveable
protected int[][] neighbours
protected JGraphLayoutProgress progress
Constructor Detail |
---|
public JGraphSpringLayout()
public JGraphSpringLayout(int iterations)
iterations
- the number of layout iterations to executeMethod Detail |
---|
public JGraphLayoutProgress getProgress()
JGraphLayout.Stoppable
By convention, the layout must check the isStopped method in its
inner-most loops and return immediately if the method returns
true
.
getProgress
in interface JGraphLayout.Stoppable
public void run(JGraphFacade graph)
run
in interface JGraphLayout
graph
- the description of the graph to be acted uponprotected void repulse()
protected void attract()
protected void reposition(JGraphFacade graph)
graph
- the description of the graph to be laid outpublic void setMaxIterations(int iterations)
iterations
- the value to set maxIterations
topublic int getMaxIterations()
public double getSpringLength()
public void setSpringLength(double springLength)
springLength
- The springLength to set.public double getSpringForce()
public void setSpringForce(double springForce)
springForce
- The springForce to set.public double getReplusiveForce()
public void setReplusiveForce(double replusiveForce)
replusiveForce
- The replusiveForce to set.public String toString()
Spring
, the name of this algorithm.
toString
in class Object
|
JGraph |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |