|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nwoods.jgo.layout.JGoAutoLayout
com.nwoods.jgo.layout.JGoForceDirectedAutoLayout
JGoForceDirectedAutoLayout provides an auto-layout algorithm for graphs which utilizes a force-directed method. The graph is viewed as a system of bodies with forces acting between the bodies. The algorithm seeks a configuration of the bodies with locally minimal energy, i.e., a position such that the sum of the forces on each body is zero.
Constructor Summary | |
JGoForceDirectedAutoLayout()
Constucts a ForceDirectedAutoLayout with null network, document. |
|
JGoForceDirectedAutoLayout(JGoDocument doc)
Constructs a ForceDirectedAutoLayout with a document of doc, and a network containing all of the top-level objects contained in doc. |
|
JGoForceDirectedAutoLayout(JGoDocument doc,
int Nmax_iterations)
Constructs a ForceDirectedAutoLayout for the passed in document that will run for a maximum of Nmax_iterations when performLayout() is called. |
|
JGoForceDirectedAutoLayout(JGoDocument doc,
JGoNetwork network,
int Nmax_iterations)
Constructs a ForceDirectedAutoLayout for the passed in document, and network, that will run for a maximum of Nmax_iterations when performLayout() is called. |
|
JGoForceDirectedAutoLayout(JGoForceDirectedAutoLayout layout)
Make a copy of a JGoForceDirectedAutoLayout, copying most of the important properties except for the JGoNetwork. |
|
JGoForceDirectedAutoLayout(JGoSelection sel)
Constructs a ForceDirectedAutoLayout with a network containing all of the top-level objects contained in sel. |
Method Summary | |
static int |
getDefaultMaxIterations()
Returns the default maximum number of iterations to use in looking for a layout. |
protected double |
getElectricalCharge(JGoNetworkNode pNode)
Returns the charge of the point representing the JGoNetworkNode pNode. |
protected double |
getElectricalFieldX(org.eclipse.swt.graphics.Point xy)
Returns the electrical field in the X direction acting on a node at the logical point Point xy. |
protected double |
getElectricalFieldY(org.eclipse.swt.graphics.Point xy)
Returns the electrical field in the Y direction acting on a node at the logical point Point xy. |
protected double |
getGravitationalFieldX(org.eclipse.swt.graphics.Point xy)
The function getGravitationalFieldX returns the graviational field in the X direction acting on a node at the logical point Point xy. |
protected double |
getGravitationalFieldY(org.eclipse.swt.graphics.Point xy)
The function getGravitationalFieldY returns the graviational field in the Y direction acting on a node at the logical point Point xy. |
protected double |
getGravitationalMass(JGoNetworkNode pNode)
The function getGravitationalMass returns the mass of the point representing the JGoNetworkNode pNode. |
int |
getMaxIterations()
Gets the limit on the number of iterations that updatePositions will perform on the network. |
protected double |
getNodeDistance(JGoNetworkNode pNodeA,
JGoNetworkNode pNodeB)
Returns the distance between two nodes. |
java.util.Random |
getRandomNumberGenerator()
Gets the Random number generator used to give an initial push between objects that are located at the same position. |
protected double |
getSpringLength(JGoNetworkLink pLink)
Returns the length of the spring representing the JGoNetworkLink pLink. |
protected double |
getSpringStiffness(JGoNetworkLink pLink)
Returns the stiffness of the spring representing the JGoNetworkLink pLink. |
protected boolean |
isFixed(JGoNetworkNode pGoNode)
The protected function isFixed returns true if the node should not be moved by the layout algorithm. |
protected void |
layoutNodesAndLinks(boolean isfinal)
Updates the physical location of "real" nodes and links to reflect the layout. |
JGoForceDirectedAutoLayoutLinkData |
linkData(JGoNetworkLink pLink)
Takes in a JGoNetworkLink and returns the link's ForceDirectedAutoLayout data. |
JGoForceDirectedAutoLayoutNodeData |
nodeData(JGoNetworkNode pNode)
Takes in a JGoNetworkNode and returns the node's ForceDirectedAutoLayout data. |
void |
performLayout()
Performs force-directed auto-layout. |
static void |
setDefaultMaxIterations(int x)
Sets the default maximum number of iterations to use in looking for a layout to x. |
void |
setMaxIterations(int max)
Sets the limit on the number of iterations that updatePositions will perform on the network. |
void |
setRandomNumberGenerator(java.util.Random value)
Sets the Random number generator used to give an initial push between objects that are located at the same position. |
protected boolean |
updatePositions()
Peforms one iteration of the ForceDirectedAutoLayout algorithm and updates the positions of the nodes. |
Methods inherited from class com.nwoods.jgo.layout.JGoAutoLayout |
getDocument, getNetwork, progressUpdate, setDocument, setNetwork |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public JGoForceDirectedAutoLayout()
public JGoForceDirectedAutoLayout(JGoDocument doc)
doc
- the JGoDocument containing the JGoObjects to layoutpublic JGoForceDirectedAutoLayout(JGoSelection sel)
sel
- the JGoSelection containing the JGoObjects to layoutpublic JGoForceDirectedAutoLayout(JGoDocument doc, int Nmax_iterations)
doc
- the JGoDocument containing the JGoObjects to layoutNmax_iterations
- the maximum number of iterations to use in looking for a local equilibriumpublic JGoForceDirectedAutoLayout(JGoDocument doc, JGoNetwork network, int Nmax_iterations)
doc
- the JGoDocument containing the JGoObjects to layoutnetwork
- the JGoNetwork representation of the JGoObjects to layoutNmax_iterations
- the maximum number of iterations to use in looking for a local equilibriumpublic JGoForceDirectedAutoLayout(JGoForceDirectedAutoLayout layout)
Method Detail |
public void performLayout()
performLayout
in class JGoAutoLayout
protected double getNodeDistance(JGoNetworkNode pNodeA, JGoNetworkNode pNodeB)
protected double getSpringStiffness(JGoNetworkLink pLink)
protected double getSpringLength(JGoNetworkLink pLink)
protected double getElectricalCharge(JGoNetworkNode pNode)
protected double getElectricalFieldX(org.eclipse.swt.graphics.Point xy)
protected double getElectricalFieldY(org.eclipse.swt.graphics.Point xy)
protected double getGravitationalMass(JGoNetworkNode pNode)
protected double getGravitationalFieldX(org.eclipse.swt.graphics.Point xy)
protected double getGravitationalFieldY(org.eclipse.swt.graphics.Point xy)
protected boolean isFixed(JGoNetworkNode pGoNode)
protected boolean updatePositions()
protected void layoutNodesAndLinks(boolean isfinal)
isfinal
- true if this is the final call to layoutNodesAndLinkspublic int getMaxIterations()
public void setMaxIterations(int max)
public java.util.Random getRandomNumberGenerator()
Initially this value is null, which causes a new java.util.Random to be used.
public void setRandomNumberGenerator(java.util.Random value)
You can set this property so that you can control the seed, to make the results reproducible if the data structures are exactly the same each time.
public final JGoForceDirectedAutoLayoutNodeData nodeData(JGoNetworkNode pNode)
public final JGoForceDirectedAutoLayoutLinkData linkData(JGoNetworkLink pLink)
public static int getDefaultMaxIterations()
public static void setDefaultMaxIterations(int x)
x
- the new default for the maximum number of iterations.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |