mxGraph
Public Member Functions | Protected Member Functions | Protected Attributes | Properties
com.mxgraph.mxFastOrganicLayout Class Reference

Fast organic layout algorithm. More...

Inheritance diagram for com.mxgraph.mxFastOrganicLayout:
com.mxgraph.mxIGraphLayout

List of all members.

Public Member Functions

 mxFastOrganicLayout (mxGraph graph)
 Constructs a new fast organic layout for the specified graph.
bool IsCellIgnored (Object cell)
 Returns true if the given cell should be ignored by the layout algorithm. This implementation returns false if the cell is a vertex and has at least one connected edge.
void move (Object cell, double x, double y)
 Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg. index) so that the outcome of the layou will position the vertex as close to the point (x, y) as possible.
void execute (Object parent)
 Executes the fast organic layout.

Protected Member Functions

void reduceTemperature ()
 Reduces the temperature of the layout from an initial setting in a linear fashion to zero.
void calcPositions ()
 Takes the displacements calculated for each cell and applies them to the local cache of cell positions. Limits the displacement to the current temperature.
void calcAttraction ()
 Calculates the attractive forces between all laid out nodes linked by edges.
void calcRepulsion ()
 Calculates the repulsive forces between all laid out nodes.

Protected Attributes

mxGraph graph
 Holds the enclosing graph.
double forceConstant = 50
 The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of. The value equates to the average radius there is of free space around each node. Default is 50.
double forceConstantSquared = 0
 Cache of forceConstant^2 for performance.
double minDistanceLimit = 2
 Minimal distance limit. Default is 2. Prevents of dividing by zero.
double minDistanceLimitSquared = 0
 Cached version of minDistanceLimit squared.
double initialTemp = 200
 Start value of temperature. Default is 200.
double temperature = 0
 Temperature to limit displacement at later stages of layout.
int maxIterations = 0
 Total number of iterations to run the layout though.
int iteration = 0
 Current iteration count.
Object[] vertexArray
 An array of all vertices to be laid out.
double[] dispX
 An array of locally stored X co-ordinate displacements for the vertices.
double[] dispY
 An array of locally stored Y co-ordinate displacements for the vertices.
double[][] cellLocation
 An array of locally stored co-ordinate positions for the vertices.
double[] radius
 The approximate radius of each cell, nodes only.
double[] radiusSquared
 The approximate radius squared of each cell, nodes only.
bool[] isMoveable
 Array of booleans representing the movable states of the vertices.
int[][] neighbours
 Local copy of cell neighbours.
bool allowedToRun = true
 Boolean flag that specifies if the layout is allowed to run. If this is set to false, then the layout exits in the following iteration.
Dictionary< object, int > indices = new Dictionary<object, int>()
 Maps from vertices to indices.
Random random = new Random()
 Random number generator.

Properties

bool IsAllowedToRun [get, set]
 Flag to stop a running layout run.
int MaxIterations [get, set]
 Maximum number of iterations.
double ForceConstant [get, set]
 Force constant to be used for the springs.
double MinDistanceLimit [get, set]
 Minimum distance between nodes.
double InitialTemp [get, set]
 Initial temperature.

Detailed Description

Fast organic layout algorithm.


Constructor & Destructor Documentation

Constructs a new fast organic layout for the specified graph.

Parameters:
graph

Member Function Documentation

void com.mxgraph.mxFastOrganicLayout.calcAttraction ( ) [inline, protected]

Calculates the attractive forces between all laid out nodes linked by edges.

void com.mxgraph.mxFastOrganicLayout.calcPositions ( ) [inline, protected]

Takes the displacements calculated for each cell and applies them to the local cache of cell positions. Limits the displacement to the current temperature.

void com.mxgraph.mxFastOrganicLayout.calcRepulsion ( ) [inline, protected]

Calculates the repulsive forces between all laid out nodes.

void com.mxgraph.mxFastOrganicLayout.execute ( Object  parent) [inline]

Executes the fast organic layout.

Parameters:
parent

Implements com.mxgraph.mxIGraphLayout.

bool com.mxgraph.mxFastOrganicLayout.IsCellIgnored ( Object  cell) [inline]

Returns true if the given cell should be ignored by the layout algorithm. This implementation returns false if the cell is a vertex and has at least one connected edge.

Parameters:
cellObject that represents the cell.
Returns:
Returns true if the given cell should be ignored.
void com.mxgraph.mxFastOrganicLayout.move ( Object  cell,
double  x,
double  y 
) [inline]

Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg. index) so that the outcome of the layou will position the vertex as close to the point (x, y) as possible.

Not yet implemented.

Parameters:
cell
x
y

Implements com.mxgraph.mxIGraphLayout.

Reduces the temperature of the layout from an initial setting in a linear fashion to zero.


Member Data Documentation

Boolean flag that specifies if the layout is allowed to run. If this is set to false, then the layout exits in the following iteration.

An array of locally stored co-ordinate positions for the vertices.

An array of locally stored X co-ordinate displacements for the vertices.

An array of locally stored Y co-ordinate displacements for the vertices.

The force constant by which the attractive forces are divided and the replusive forces are multiple by the square of. The value equates to the average radius there is of free space around each node. Default is 50.

Cache of forceConstant^2 for performance.

Holds the enclosing graph.

Dictionary<object, int> com.mxgraph.mxFastOrganicLayout.indices = new Dictionary<object, int>() [protected]

Maps from vertices to indices.

Start value of temperature. Default is 200.

Array of booleans representing the movable states of the vertices.

Current iteration count.

Total number of iterations to run the layout though.

Minimal distance limit. Default is 2. Prevents of dividing by zero.

Cached version of minDistanceLimit squared.

Local copy of cell neighbours.

The approximate radius of each cell, nodes only.

The approximate radius squared of each cell, nodes only.

Random com.mxgraph.mxFastOrganicLayout.random = new Random() [protected]

Random number generator.

Temperature to limit displacement at later stages of layout.

An array of all vertices to be laid out.


Property Documentation

Force constant to be used for the springs.

Initial temperature.

Flag to stop a running layout run.

Maximum number of iterations.

Minimum distance between nodes.


The documentation for this class was generated from the following file: