org.wilmascope.forcelayout
Class NodeForceLayout

java.lang.Object
  extended by org.wilmascope.graph.NodeLayout
      extended by org.wilmascope.forcelayout.NodeForceLayout
All Implemented Interfaces:
Layable, NodeAbility
Direct Known Subclasses:
NodeColumnLayout

public class NodeForceLayout
extends NodeLayout

This class encapsulates the physical properties of a node in relation to the ForceLayout such as mass, and the forces acting upon it.


Constructor Summary
NodeForceLayout()
           
 
Method Summary
 void addForce(javax.vecmath.Vector3f force)
          Add a force vector which will act on this NodeForceLayout
 void applyForce(float attenuation)
          Adjust the node's position by calculating an acceleration due to the forces on the node, then applying that acceleration to the velocity of the node and then scale that velocity by the attenuation factor.
 javax.vecmath.Vector3f getNetForce()
          Get the aggregate (or net) force acting on this NodeForceLayout
 void resetProperties()
          Reset's properties common to all layouts, these include: FixedPosition Should be overridden with a call to this inherited method to load any properties from the node properties that are specific to the layout engine
 void subForce(javax.vecmath.Vector3f force)
          'Subtract' a force vector
 
Methods inherited from class org.wilmascope.graph.NodeLayout
delete, getNode, isFixedPosition, setFixedPosition, setNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeForceLayout

public NodeForceLayout()
Method Detail

resetProperties

public void resetProperties()
Description copied from class: NodeLayout
Reset's properties common to all layouts, these include: FixedPosition Should be overridden with a call to this inherited method to load any properties from the node properties that are specific to the layout engine

Overrides:
resetProperties in class NodeLayout

addForce

public void addForce(javax.vecmath.Vector3f force)
Add a force vector which will act on this NodeForceLayout


subForce

public void subForce(javax.vecmath.Vector3f force)
'Subtract' a force vector


getNetForce

public javax.vecmath.Vector3f getNetForce()
Get the aggregate (or net) force acting on this NodeForceLayout


applyForce

public void applyForce(float attenuation)
Adjust the node's position by calculating an acceleration due to the forces on the node, then applying that acceleration to the velocity of the node and then scale that velocity by the attenuation factor. Also applies a 'friction' force. This causes the graph to settle at a stable position. The friction force is directly proportional to the velocity and the radius of the node, thus large nodes (especially expanded clusters) will have greater "air resistance?" and will thus not vibrate as easily as small nodes.

Parameters:
attenuation - scale factor for the velocity