Class mxFastOrganicLayout
java.lang.Object
com.mxgraph.layout.mxGraphLayout
com.mxgraph.layout.mxFastOrganicLayout
- All Implemented Interfaces:
mxIGraphLayout
Fast organic layout algorithm.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanBoolean flag that specifies if the layout is allowed to run.protected double[][]An array of locally stored co-ordinate positions for the vertices.protected booleanSpecifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result.protected double[]An array of locally stored X co-ordinate displacements for the vertices.protected double[]An array of locally stored Y co-ordinate displacements for the vertices.protected doubleThe force constant by which the attractive forces are divided and the replusive forces are multiple by the square of.protected doubleCache of^2 for performance. Maps from vertices to indices.protected doubleStart value of temperature.protected boolean[]Array of booleans representing the movable states of the vertices.protected doubleCurrent iteration count.protected doubleThe maximum distance between vertices, beyond which their repulsion no longer has an effectprotected doubleTotal number of iterations to run the layout though.protected doubleMinimal distance limit.protected doubleCached version ofsquared. protected int[][]Local copy of cell neighbours.protected double[]The approximate radius of each cell, nodes only.protected double[]The approximate radius squared of each cell, nodes only.protected booleanSpecifies if all edge points of traversed edges should be removed.protected doubleTemperature to limit displacement at later stages of layout.protected booleanSpecifies if the top left corner of the input cells should be the origin of the layout result.protected Object[]An array of all vertices to be laid out.Fields inherited from class mxGraphLayout
graph, parent, useBoundingBox -
Constructor Summary
ConstructorsConstructorDescriptionmxFastOrganicLayout(mxGraph graph) Constructs a new fast organic layout for the specified graph. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCalculates the attractive forces between all laid out nodes linked by edgesprotected voidTakes the displacements calculated for each cell and applies them to the local cache of cell positions.protected voidCalculates the repulsive forces between all laid out nodesvoidExecutes the layout for the children of the specified parent.doubledoubledoubledoubledoublebooleanbooleanbooleanbooleanisVertexIgnored(Object vertex) Returns a boolean indicating if the givenshould be ignored as a vertex. voidNotified when a cell is being moved in a parent that has automatic layout to update the cell state (eg.protected voidReduces the temperature of the layout from an initial setting in a linear fashion to zero.voidsetDisableEdgeStyle(boolean value) voidsetForceConstant(double value) voidsetInitialTemp(double value) voidsetMaxDistanceLimit(double maxDistanceLimit) voidsetMaxIterations(double value) voidsetMinDistanceLimit(double value) voidsetResetEdges(boolean value) voidsetUseInputOrigin(boolean value) Methods inherited from class mxGraphLayout
arrangeGroups, getConstraint, getConstraint, getGraph, getParentOffset, getVertexBounds, isEdgeIgnored, isUseBoundingBox, isVertexMovable, setEdgePoints, setEdgeStyleEnabled, setOrthogonalEdge, setUseBoundingBox, setVertexLocation
-
Field Details
-
useInputOrigin
protected boolean useInputOriginSpecifies if the top left corner of the input cells should be the origin of the layout result. Default is true. -
resetEdges
protected boolean resetEdgesSpecifies if all edge points of traversed edges should be removed. Default is true. -
disableEdgeStyle
protected boolean disableEdgeStyleSpecifies if the STYLE_NOEDGESTYLE flag should be set on edges that are modified by the result. Default is true. -
forceConstant
protected double forceConstantThe 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. -
forceConstantSquared
protected double forceConstantSquaredCache of^2 for performance. -
minDistanceLimit
protected double minDistanceLimitMinimal distance limit. Default is 2. Prevents of dividing by zero. -
minDistanceLimitSquared
protected double minDistanceLimitSquaredCached version ofsquared. -
maxDistanceLimit
protected double maxDistanceLimitThe maximum distance between vertices, beyond which their repulsion no longer has an effect -
initialTemp
protected double initialTempStart value of temperature. Default is 200. -
temperature
protected double temperatureTemperature to limit displacement at later stages of layout. -
maxIterations
protected double maxIterationsTotal number of iterations to run the layout though. -
iteration
protected double iterationCurrent iteration count. -
vertexArray
An array of all vertices to be laid out. -
dispX
protected double[] dispXAn array of locally stored X co-ordinate displacements for the vertices. -
dispY
protected double[] dispYAn array of locally stored Y co-ordinate displacements for the vertices. -
cellLocation
protected double[][] cellLocationAn array of locally stored co-ordinate positions for the vertices. -
radius
protected double[] radiusThe approximate radius of each cell, nodes only. -
radiusSquared
protected double[] radiusSquaredThe approximate radius squared of each cell, nodes only. -
isMoveable
protected boolean[] isMoveableArray of booleans representing the movable states of the vertices. -
neighbours
protected int[][] neighboursLocal copy of cell neighbours. -
allowedToRun
protected boolean allowedToRunBoolean flag that specifies if the layout is allowed to run. If this is set to false, then the layout exits in the following iteration. -
indices
-
-
Constructor Details
-
mxFastOrganicLayout
Constructs a new fast organic layout for the specified graph.
-
-
Method Details
-
isVertexIgnored
Returns a boolean indicating if the givenshould be ignored as a vertex. This returns true if the cell has no connections. - Overrides:
isVertexIgnoredin classmxGraphLayout- Parameters:
vertex- Object that represents the vertex to be tested.- Returns:
- Returns true if the vertex should be ignored.
-
isUseInputOrigin
public boolean isUseInputOrigin() -
setUseInputOrigin
public void setUseInputOrigin(boolean value) - Parameters:
value-
-
isResetEdges
public boolean isResetEdges() -
setResetEdges
public void setResetEdges(boolean value) - Parameters:
value-
-
isDisableEdgeStyle
public boolean isDisableEdgeStyle() -
setDisableEdgeStyle
public void setDisableEdgeStyle(boolean value) - Parameters:
value-
-
getMaxIterations
public double getMaxIterations() -
setMaxIterations
public void setMaxIterations(double value) - Parameters:
value-
-
getForceConstant
public double getForceConstant() -
setForceConstant
public void setForceConstant(double value) - Parameters:
value-
-
getMinDistanceLimit
public double getMinDistanceLimit() -
setMinDistanceLimit
public void setMinDistanceLimit(double value) - Parameters:
value-
-
getMaxDistanceLimit
public double getMaxDistanceLimit()- Returns:
- the maxDistanceLimit
-
setMaxDistanceLimit
public void setMaxDistanceLimit(double maxDistanceLimit) - Parameters:
maxDistanceLimit- the maxDistanceLimit to set
-
getInitialTemp
public double getInitialTemp() -
setInitialTemp
public void setInitialTemp(double value) - Parameters:
value-
-
reduceTemperature
protected void reduceTemperature()Reduces the temperature of the layout from an initial setting in a linear fashion to zero. -
moveCell
Description copied from interface:mxIGraphLayoutNotified 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 layout will position the vertex as close to the point (x, y) as possible.- Specified by:
moveCellin interfacemxIGraphLayout- Overrides:
moveCellin classmxGraphLayout- Parameters:
cell- Cell which is being moved.x- X-coordinate of the new cell location.y- Y-coordinate of the new cell location.
-
execute
Description copied from interface:mxIGraphLayoutExecutes the layout for the children of the specified parent.- Specified by:
executein interfacemxIGraphLayout- Overrides:
executein classmxGraphLayout- Parameters:
parent- Parent cell that contains the children to be layed out.
-
calcPositions
protected 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. -
calcAttraction
protected void calcAttraction()Calculates the attractive forces between all laid out nodes linked by edges -
calcRepulsion
protected void calcRepulsion()Calculates the repulsive forces between all laid out nodes
-