ca.sqlpower.architect.layout
Class FruchtermanReingoldForceLayout

java.lang.Object
  extended by ca.sqlpower.architect.layout.AbstractLayout
      extended by ca.sqlpower.architect.layout.FruchtermanReingoldForceLayout
All Implemented Interfaces:
ArchitectLayout

public class FruchtermanReingoldForceLayout
extends AbstractLayout


Field Summary
 
Fields inherited from class ca.sqlpower.architect.layout.AbstractLayout
frame
 
Constructor Summary
FruchtermanReingoldForceLayout()
           
 
Method Summary
protected  double attractiveForce(java.awt.Point distance, double emptyRadius)
          Calculate the attractive force
 void cool()
          Cool the temperature
 void done()
          Interrupts the algorithm and node bounds in a consistent state.
 java.util.ArrayList<LayoutEdge> getEdges()
           
 double getEmptyRadius()
          The clear radius between two nodes
 int getH()
           
 double getK()
           
 int getLowerBoundary()
           
 java.util.ArrayList<LayoutNode> getNodes()
           
 int getRightBoundary()
           
 double getTemp()
           
 int getW()
           
 boolean isDone()
          Checks and sees if the program stops
 double magnitude(java.awt.Point p)
          get the magnitude of a point
 void nextFrame()
          Performs the next step of the spring layout
protected  double repulsiveForce(double distance, LayoutNode u, LayoutNode v, double emptyRadius)
          Calculate the Repulsive force
 void setup(java.util.Collection<? extends LayoutNode> nodes, java.util.Collection<? extends LayoutEdge> edges, java.awt.Rectangle frame)
          Sets up the layout algoritm.
 
Methods inherited from class ca.sqlpower.architect.layout.AbstractLayout
getNewArea, getProperty, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FruchtermanReingoldForceLayout

public FruchtermanReingoldForceLayout()
Method Detail

setup

public void setup(java.util.Collection<? extends LayoutNode> nodes,
                  java.util.Collection<? extends LayoutEdge> edges,
                  java.awt.Rectangle frame)
Description copied from interface: ArchitectLayout
Sets up the layout algoritm. You have to call this before attempting to use an ArchitectLayout instance to perform a layout. TODO change the Rectangle into a point. This should indicate where to start but the layout should determine dimensions

Specified by:
setup in interface ArchitectLayout
Overrides:
setup in class AbstractLayout
Parameters:
nodes - The list of entities to be placed on

magnitude

public double magnitude(java.awt.Point p)
get the magnitude of a point

Parameters:
p -
Returns:
the magnitude

isDone

public boolean isDone()
Checks and sees if the program stops

Returns:
true if the layout algorithm is finished with the layout, false otherwise

nextFrame

public void nextFrame()
Performs the next step of the spring layout


attractiveForce

protected double attractiveForce(java.awt.Point distance,
                                 double emptyRadius)
Calculate the attractive force

Parameters:
distance - The distance between two nodes
emptyRadius - The radius we want to keep clear
Returns:
the force between the two nodes

repulsiveForce

protected double repulsiveForce(double distance,
                                LayoutNode u,
                                LayoutNode v,
                                double emptyRadius)
Calculate the Repulsive force

Parameters:
distance - The distance between two nodes
emptyRadius - The radius we want to keep clear
Returns:
the force between the two nodes

getEmptyRadius

public double getEmptyRadius()
The clear radius between two nodes

Parameters:
pp - a playen
Returns:

done

public void done()
Description copied from interface: ArchitectLayout
Interrupts the algorithm and node bounds in a consistent state.


cool

public void cool()
Cool the temperature


getEdges

public java.util.ArrayList<LayoutEdge> getEdges()

getK

public double getK()

getNodes

public java.util.ArrayList<LayoutNode> getNodes()

getTemp

public double getTemp()

getH

public int getH()

getRightBoundary

public int getRightBoundary()

getLowerBoundary

public int getLowerBoundary()

getW

public int getW()


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca