mxGraph
Public Member Functions | Protected Member Functions | Protected Attributes | Properties | List of all members
com.mxgraph.mxFastOrganicLayout Class Reference

Fast organic layout algorithm. More...

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

Public Member Functions

 mxFastOrganicLayout (mxGraph graph)
 Constructs a new fast organic layout for the specified graph. More...
 
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. More...
 
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. More...
 
void execute (Object parent)
 Executes the fast organic layout. More...
 

Protected Member Functions

void reduceTemperature ()
 Reduces the temperature of the layout from an initial setting in a linear fashion to zero. More...
 
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. More...
 
void calcAttraction ()
 Calculates the attractive forces between all laid out nodes linked by edges More...
 
void calcRepulsion ()
 Calculates the repulsive forces between all laid out nodes More...
 

Protected Attributes

mxGraph graph
 Holds the enclosing graph. More...
 
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. More...
 
double forceConstantSquared = 0
 Cache of forceConstant^2 for performance. More...
 
double minDistanceLimit = 2
 Minimal distance limit. Default is 2. Prevents of dividing by zero. More...
 
double minDistanceLimitSquared = 0
 Cached version of minDistanceLimit squared. More...
 
double initialTemp = 200
 Start value of temperature. Default is 200. More...
 
double temperature = 0
 Temperature to limit displacement at later stages of layout. More...
 
int maxIterations = 0
 Total number of iterations to run the layout though. More...
 
int iteration = 0
 Current iteration count. More...
 
Object[] vertexArray
 An array of all vertices to be laid out. More...
 
double[] dispX
 An array of locally stored X co-ordinate displacements for the vertices. More...
 
double[] dispY
 An array of locally stored Y co-ordinate displacements for the vertices. More...
 
double[][] cellLocation
 An array of locally stored co-ordinate positions for the vertices. More...
 
double[] radius
 The approximate radius of each cell, nodes only. More...
 
double[] radiusSquared
 The approximate radius squared of each cell, nodes only. More...
 
bool[] isMoveable
 Array of booleans representing the movable states of the vertices. More...
 
int[][] neighbours
 Local copy of cell neighbours. More...
 
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. More...
 
Dictionary< object, int > indices = new Dictionary<object, int>()
 Maps from vertices to indices. More...
 
Random random = new Random()
 Random number generator. More...
 

Properties

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

Detailed Description

Fast organic layout algorithm.

Constructor & Destructor Documentation

com.mxgraph.mxFastOrganicLayout.mxFastOrganicLayout ( mxGraph  graph)
inline

Constructs a new fast organic layout for the specified graph.

Parameters
graph

Member Function Documentation

void com.mxgraph.mxFastOrganicLayout.calcAttraction ( )
inlineprotected

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

void com.mxgraph.mxFastOrganicLayout.calcPositions ( )
inlineprotected

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 ( )
inlineprotected

Calculates the repulsive forces between all laid out nodes

void com.mxgraph.mxFastOrganicLayout.execute ( Object  parent)
inline
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.

References com.mxgraph.mxIGraphModel.GetEdgeCount(), com.mxgraph.mxIGraphModel.IsVertex(), and com.mxgraph.mxGraph.Model.

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.

void com.mxgraph.mxFastOrganicLayout.reduceTemperature ( )
inlineprotected

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

Member Data Documentation

bool com.mxgraph.mxFastOrganicLayout.allowedToRun = true
protected

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.

double [][] com.mxgraph.mxFastOrganicLayout.cellLocation
protected

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

double [] com.mxgraph.mxFastOrganicLayout.dispX
protected

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

double [] com.mxgraph.mxFastOrganicLayout.dispY
protected

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

double com.mxgraph.mxFastOrganicLayout.forceConstant = 50
protected

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 com.mxgraph.mxFastOrganicLayout.forceConstantSquared = 0
protected

Cache of forceConstant^2 for performance.

mxGraph com.mxgraph.mxFastOrganicLayout.graph
protected

Holds the enclosing graph.

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

Maps from vertices to indices.

double com.mxgraph.mxFastOrganicLayout.initialTemp = 200
protected

Start value of temperature. Default is 200.

bool [] com.mxgraph.mxFastOrganicLayout.isMoveable
protected

Array of booleans representing the movable states of the vertices.

int com.mxgraph.mxFastOrganicLayout.iteration = 0
protected

Current iteration count.

int com.mxgraph.mxFastOrganicLayout.maxIterations = 0
protected

Total number of iterations to run the layout though.

double com.mxgraph.mxFastOrganicLayout.minDistanceLimit = 2
protected

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

double com.mxgraph.mxFastOrganicLayout.minDistanceLimitSquared = 0
protected

Cached version of minDistanceLimit squared.

int [][] com.mxgraph.mxFastOrganicLayout.neighbours
protected

Local copy of cell neighbours.

double [] com.mxgraph.mxFastOrganicLayout.radius
protected

The approximate radius of each cell, nodes only.

double [] com.mxgraph.mxFastOrganicLayout.radiusSquared
protected

The approximate radius squared of each cell, nodes only.

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

Random number generator.

double com.mxgraph.mxFastOrganicLayout.temperature = 0
protected

Temperature to limit displacement at later stages of layout.

Object [] com.mxgraph.mxFastOrganicLayout.vertexArray
protected

An array of all vertices to be laid out.

Property Documentation

double com.mxgraph.mxFastOrganicLayout.ForceConstant
getset

Force constant to be used for the springs.

double com.mxgraph.mxFastOrganicLayout.InitialTemp
getset

Initial temperature.

bool com.mxgraph.mxFastOrganicLayout.IsAllowedToRun
getset

Flag to stop a running layout run.

int com.mxgraph.mxFastOrganicLayout.MaxIterations
getset

Maximum number of iterations.

double com.mxgraph.mxFastOrganicLayout.MinDistanceLimit
getset

Minimum distance between nodes.


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