org.wilmascope.forcelayout
Class Origin

java.lang.Object
  extended by org.wilmascope.patterns.Prototype
      extended by org.wilmascope.forcelayout.Force
          extended by org.wilmascope.forcelayout.Origin
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class Origin
extends Force

Force that attracts either one or all of the nodes to the centre of the graph space. Simply keeps the graph centred, stops it drifting off the screen.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.wilmascope.forcelayout.Force
strengthConstant
 
Constructor Summary
Origin(float strengthConstant)
           
 
Method Summary
 void calculate()
          Calculate the origin centering deltas for all the nodes, or if a CentreNode has been specified then just for that centre node.
 void setCentreNode(Node node)
          Node specified will be drawn to the origin.
 void setCluster(Cluster root)
           
 void setOriginNode(Node originNode)
          set the origin point
 
Methods inherited from class org.wilmascope.forcelayout.Force
getStrengthConstant, setStrengthConstant, toString
 
Methods inherited from class org.wilmascope.patterns.Prototype
clone, getTypeName, setTypeName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Origin

public Origin(float strengthConstant)
Method Detail

setCluster

public void setCluster(Cluster root)
Specified by:
setCluster in class Force

setOriginNode

public void setOriginNode(Node originNode)
set the origin point

Parameters:
originPoint - the centroid!

calculate

public void calculate()
Calculate the origin centering deltas for all the nodes, or if a CentreNode has been specified then just for that centre node.

Specified by:
calculate in class Force
Parameters:
nodes - Nodes to which this force applies

setCentreNode

public void setCentreNode(Node node)
Node specified will be drawn to the origin.

Parameters:
node - Node around which the graph will be centred.