mxGraph
|
Fast organic layout algorithm. More...
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. |
Fast organic layout algorithm.
com.mxgraph.mxFastOrganicLayout.mxFastOrganicLayout | ( | mxGraph | graph | ) | [inline] |
Constructs a new fast organic layout for the specified graph.
graph |
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] |
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.
cell | Object that represents the cell. |
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.
cell | |
x | |
y |
Implements com.mxgraph.mxIGraphLayout.
void com.mxgraph.mxFastOrganicLayout.reduceTemperature | ( | ) | [inline, protected] |
Reduces the temperature of the layout from an initial setting in a linear fashion to zero.
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.
double com.mxgraph.mxFastOrganicLayout.ForceConstant [get, set] |
Force constant to be used for the springs.
double com.mxgraph.mxFastOrganicLayout.InitialTemp [get, set] |
Initial temperature.
bool com.mxgraph.mxFastOrganicLayout.IsAllowedToRun [get, set] |
Flag to stop a running layout run.
int com.mxgraph.mxFastOrganicLayout.MaxIterations [get, set] |
Maximum number of iterations.
double com.mxgraph.mxFastOrganicLayout.MinDistanceLimit [get, set] |
Minimum distance between nodes.