com.mxgraph.layout.hierarchical.stage
public class mxCoordinateAssignment extends Object implements mxHierarchicalLayoutStage
Modifier and Type | Class and Description |
---|---|
protected class |
mxCoordinateAssignment.AreaSpatialCache
Utility class that stores a collection of vertices and edge points within
a certain area.
|
protected class |
mxCoordinateAssignment.WeightedCellSorter
A utility class used to track cells whilst sorting occurs on the weighted
sum of their connected edges.
|
Modifier and Type | Field and Description |
---|---|
protected int |
channelBuffer
The size of the vertical buffer in the center of inter-rank channels
where edge control points should not be placed
|
protected double |
currentXDelta
The sum of x-displacements for the current iteration
|
protected boolean |
disableEdgeStyle
Specifies if the STYLE_NOEDGESTYLE flag should be set on edges that are
modified by the result.
|
protected com.mxgraph.layout.hierarchical.stage.mxCoordinateAssignment.HierarchicalEdgeStyle |
edgeStyle
The style to apply between cell layers to edge segments
|
protected boolean |
fineTuning
Whether or not to perform local optimisations and iterate multiple times
through the algorithm
|
protected int |
groupPadding
Padding added to resized parents
|
protected double |
initialX
The minimum x position node placement starts at
|
protected double |
interRankCellSpacing
The minimum distance between cells on adjacent ranks
|
protected double |
intraCellSpacing
The minimum buffer between cells on the same rank
|
protected Map<mxGraphHierarchyEdge,double[]> |
jettyPositions
Map of internal edges and (x,y) pair of positions of the start and end jetty
for that edge where it connects to the source and target vertices.
|
protected mxHierarchicalLayout |
layout
Reference to the enclosing layout algorithm
|
protected double |
limitX
The maximum x value this positioning lays up to
|
protected int |
maxIterations
The number of heuristic iterations to run
|
protected int |
minEdgeJetty
The minimum distance for an edge jetty from a vertex
|
protected mxGraphAbstractHierarchyCell[][] |
nextLayerConnectedCache
A store of connections to the layer above for speed
|
protected int |
orientation
The position of the root ( start ) node(s) relative to the rest of the
laid out graph
|
protected double |
parallelEdgeSpacing
The distance between each parallel edge on each ranks for long edges
|
protected int |
prefHozEdgeSep
The preferred horizontal distance between edges exiting a vertex
|
protected int |
prefVertEdgeOff
The preferred vertical offset between edges exiting a vertex
|
protected mxGraphAbstractHierarchyCell[][] |
previousLayerConnectedCache
A store of connections to the layer below for speed
|
protected double[] |
rankBottomY
Internal cache of bottom-most value of Y for each rank
|
protected double[] |
rankTopY
Internal cache of top-most values of Y for each rank
|
protected double[] |
rankWidths
The width of all the ranks
|
protected double[] |
rankY
The Y-coordinate of all the ranks
|
protected double |
vertexConnectionBuffer
The buffer on either side of a vertex where edges must not connect.
|
protected int |
widestRank
The rank that has the widest x position
|
protected double |
widestRankValue
The X-coordinate of the edge of the widest rank
|
Constructor and Description |
---|
mxCoordinateAssignment(mxHierarchicalLayout layout,
double intraCellSpacing,
double interRankCellSpacing,
int orientation,
double initialX,
double parallelEdgeSpacing)
Creates a coordinate assignment.
|
Modifier and Type | Method and Description |
---|---|
protected void |
adjustParents(Set<Object> parentsChanged)
Adjust parent cells whose child geometries have changed.
|
protected void |
calculateWidestRank(mxGraph graph,
mxGraphHierarchyModel model)
Calculates the width rank in the hierarchy.
|
void |
execute(Object parent)
A basic horizontal coordinate assignment algorithm
|
double |
getInterRankCellSpacing() |
double |
getIntraCellSpacing() |
double |
getLimitX() |
int |
getOrientation() |
boolean |
isFineTuning() |
protected void |
localEdgeProcessing(mxGraphHierarchyModel model)
Separates the x position of edges as they connect to vertices
|
protected void |
minPath(mxGraphHierarchyModel model)
Straightens out chains of virtual nodes where possible
|
void |
printStatus()
Utility method to display the x co-ords
|
protected void |
processReversedEdge(mxGraphHierarchyEdge edge,
Object realEdge)
Hook to add additional processing
|
protected void |
rankCoordinates(int rankValue,
mxGraph graph,
mxGraphHierarchyModel model)
Sets up the layout in an initial positioning.
|
protected void |
rankMedianPosition(int rankValue,
mxGraphHierarchyModel model,
int nextRankValue)
Performs median minimisation over one rank.
|
protected boolean |
repositionValid(mxGraphHierarchyModel model,
mxGraphAbstractHierarchyCell cell,
int rank,
double position)
Determines whether or not a node may be moved to the specified x
position on the specified rank
|
protected void |
setCellLocations(mxGraph graph,
mxGraphHierarchyModel model)
Sets the cell locations in the facade to those stored after this layout
processing step has completed.
|
protected void |
setEdgePosition(mxGraphAbstractHierarchyCell cell)
Fixes the control points
|
void |
setFineTuning(boolean fineTuning) |
void |
setInterRankCellSpacing(double interRankCellSpacing) |
void |
setIntraCellSpacing(double intraCellSpacing) |
void |
setLimitX(double limitX) |
void |
setLoggerLevel(Level level)
Sets the logging level of this class
|
void |
setOrientation(int orientation) |
protected void |
setVertexLocation(mxGraphAbstractHierarchyCell cell)
Fixes the position of the specified vertex
|
protected mxHierarchicalLayout layout
protected double intraCellSpacing
protected double interRankCellSpacing
protected double parallelEdgeSpacing
protected double vertexConnectionBuffer
protected int maxIterations
protected int prefHozEdgeSep
protected int prefVertEdgeOff
protected int minEdgeJetty
protected int channelBuffer
protected Map<mxGraphHierarchyEdge,double[]> jettyPositions
protected int orientation
protected double initialX
protected double limitX
protected double currentXDelta
protected int widestRank
protected double[] rankTopY
protected double[] rankBottomY
protected double widestRankValue
protected double[] rankWidths
protected double[] rankY
protected boolean fineTuning
protected boolean disableEdgeStyle
protected com.mxgraph.layout.hierarchical.stage.mxCoordinateAssignment.HierarchicalEdgeStyle edgeStyle
protected mxGraphAbstractHierarchyCell[][] nextLayerConnectedCache
protected int groupPadding
protected mxGraphAbstractHierarchyCell[][] previousLayerConnectedCache
public mxCoordinateAssignment(mxHierarchicalLayout layout, double intraCellSpacing, double interRankCellSpacing, int orientation, double initialX, double parallelEdgeSpacing)
intraCellSpacing
- the minimum buffer between cells on the same rankinterRankCellSpacing
- the minimum distance between cells on adjacent ranksorientation
- the position of the root node(s) relative to the graphinitialX
- the leftmost coordinate node placement starts atpublic void printStatus()
public void execute(Object parent)
execute
in interface mxHierarchicalLayoutStage
protected void rankMedianPosition(int rankValue, mxGraphHierarchyModel model, int nextRankValue)
rankValue
- the layer number of this rankmodel
- an internal model of the hierarchical layoutnextRankValue
- the layer number whose connected cels are to be laid out
relative toprotected void rankCoordinates(int rankValue, mxGraph graph, mxGraphHierarchyModel model)
rankValue
- the current rank being processedgraph
- the facade describing the input graphmodel
- an internal model of the hierarchical layoutprotected void calculateWidestRank(mxGraph graph, mxGraphHierarchyModel model)
graph
- the facade describing the input graphmodel
- an internal model of the hierarchical layoutprotected void minPath(mxGraphHierarchyModel model)
model
- an internal model of the hierarchical layoutprotected boolean repositionValid(mxGraphHierarchyModel model, mxGraphAbstractHierarchyCell cell, int rank, double position)
model
- the layout modelcell
- the cell being analysedrank
- the layer of the cellposition
- the x position being soughtprotected void setCellLocations(mxGraph graph, mxGraphHierarchyModel model)
graph
- the facade describing the input graphmodel
- an internal model of the hierarchical layoutprotected void adjustParents(Set<Object> parentsChanged)
protected void localEdgeProcessing(mxGraphHierarchyModel model)
model
- an internal model of the hierarchical layoutprotected void setEdgePosition(mxGraphAbstractHierarchyCell cell)
cell
- protected void setVertexLocation(mxGraphAbstractHierarchyCell cell)
cell
- the vertex to positionprotected void processReversedEdge(mxGraphHierarchyEdge edge, Object realEdge)
edge
- The hierarchical model edgerealEdge
- The real edge in the graphpublic double getInterRankCellSpacing()
public void setInterRankCellSpacing(double interRankCellSpacing)
interRankCellSpacing
- The interRankCellSpacing to set.public double getIntraCellSpacing()
public void setIntraCellSpacing(double intraCellSpacing)
intraCellSpacing
- The intraCellSpacing to set.public int getOrientation()
public void setOrientation(int orientation)
orientation
- The orientation to set.public double getLimitX()
public void setLimitX(double limitX)
limitX
- The limitX to set.public boolean isFineTuning()
public void setFineTuning(boolean fineTuning)
fineTuning
- The fineTuning to set.public void setLoggerLevel(Level level)
level
- the logging level to setCopyright (c) 2010 Gaudenz Alder. All rights reserved.