Class JGraphCoordinateAssignment
java.lang.Object
com.jgraph.layout.hierarchical.JGraphCoordinateAssignment
- All Implemented Interfaces:
JGraphHierarchicalLayoutStep
Sets the horizontal locations of node and edge dummy nodes on each layer.
Uses median down and up weighings as well heuristic to straighten edges as
far as possible.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classUtility class that stores a collection of vertices and edge points within a certain area.protected classA utility class used to track cells whilst sorting occurs on the weighted sum of their connected edges. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether or not to pull together sections of layout into empty spaceprotected doubleThe sum of x-displacements for the current iterationprotected booleanWhether or not to perform local optimisations and iterate multiple times through the algorithmprotected doubleThe minimum x position node placement starts atprotected doubleThe minimum distance between cells on adjacent ranksprotected doubleThe minimum buffer between cells on the same rankprotected doubleThe maximum x value this positioning lays up toprotected intThe number of heuristic iterations to runprotected JGraphAbstractHierarchyCell[][]A store of connections to the layer above for speedprotected intThe position of the root ( start ) node(s) relative to the rest of the laid out graphprotected doubleThe distance between each parallel edge on each ranks for long edgesprotected JGraphAbstractHierarchyCell[][]A store of connections to the layer below for speedprotected double[]The width of all the ranksprotected double[]protected intThe rank that has the widest x positionprotected doubleThe X-coordinate of the edge of the widest rank -
Constructor Summary
ConstructorsConstructorDescriptionJGraphCoordinateAssignment(double intraCellSpacing, double interRankCellSpacing, int orientation, boolean compactLayout, double initialX, double parallelEdgeSpacing) Creates a JGraphCoordinateAssignment -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcalculateWidestRank(JGraphFacade facade, JGraphHierarchyModel model) Calculates the width rank in the hierarchy.doubledoubledoubleintbooleanbooleanprotected voidrankCoordinates(int rankValue, JGraphFacade facade, JGraphHierarchyModel model) Sets up the layout in an initial positioning.protected voidrankMedianPosition(int rankValue, JGraphHierarchyModel model, int nextRankValue) Performs median minimisation over one rank.run(JGraphFacade facade, JGraphHierarchyModel model) A basic horizontal coordinate assignment algorithmvoidsetCompactLayout(boolean compactLayout) voidsetFineTuning(boolean fineTuning) voidsetInterRankCellSpacing(double interRankCellSpacing) voidsetIntraCellSpacing(double intraCellSpacing) voidsetLimitX(double limitX) voidsetLoggerLevel(Level level) Sets the logging level of this classvoidsetOrientation(int orientation)
-
Field Details
-
intraCellSpacing
protected double intraCellSpacingThe minimum buffer between cells on the same rank -
interRankCellSpacing
protected double interRankCellSpacingThe minimum distance between cells on adjacent ranks -
parallelEdgeSpacing
protected double parallelEdgeSpacingThe distance between each parallel edge on each ranks for long edges -
maxIterations
protected int maxIterationsThe number of heuristic iterations to run -
orientation
protected int orientationThe position of the root ( start ) node(s) relative to the rest of the laid out graph -
initialX
protected double initialXThe minimum x position node placement starts at -
limitX
protected double limitXThe maximum x value this positioning lays up to -
currentXDelta
protected double currentXDeltaThe sum of x-displacements for the current iteration -
widestRank
protected int widestRankThe rank that has the widest x position -
widestRankValue
protected double widestRankValueThe X-coordinate of the edge of the widest rank -
rankWidths
protected double[] rankWidthsThe width of all the ranks -
rankY
protected double[] rankY -
fineTuning
protected boolean fineTuningWhether or not to perform local optimisations and iterate multiple times through the algorithm -
compactLayout
protected boolean compactLayoutWhether or not to pull together sections of layout into empty space -
nextLayerConnectedCache
A store of connections to the layer above for speed -
previousLayerConnectedCache
A store of connections to the layer below for speed
-
-
Constructor Details
-
JGraphCoordinateAssignment
public JGraphCoordinateAssignment(double intraCellSpacing, double interRankCellSpacing, int orientation, boolean compactLayout, double initialX, double parallelEdgeSpacing) Creates a JGraphCoordinateAssignment- Parameters:
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 at
-
-
Method Details
-
run
A basic horizontal coordinate assignment algorithm- Specified by:
runin interfaceJGraphHierarchicalLayoutStep- Parameters:
facade- the facade describing the input graphmodel- an internal model of the hierarchical layout- Returns:
- the updated hierarchy model
-
rankMedianPosition
Performs median minimisation over one rank.- Parameters:
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 to
-
rankCoordinates
Sets up the layout in an initial positioning. All the first cells in each rank are moved to the left and the rest of the rank inserted as close together as their size and buffering permits. This method works on just the specified rank.- Parameters:
rankValue- the current rank being processedfacade- the facade describing the input graphmodel- an internal model of the hierarchical layout
-
calculateWidestRank
Calculates the width rank in the hierarchy. Also set the y value of each rank whilst performing the calculation- Parameters:
facade- the facade describing the input graphmodel- an internal model of the hierarchical layout
-
getInterRankCellSpacing
public double getInterRankCellSpacing()- Returns:
- Returns the interRankCellSpacing.
-
setInterRankCellSpacing
public void setInterRankCellSpacing(double interRankCellSpacing) - Parameters:
interRankCellSpacing- The interRankCellSpacing to set.
-
getIntraCellSpacing
public double getIntraCellSpacing()- Returns:
- Returns the intraCellSpacing.
-
setIntraCellSpacing
public void setIntraCellSpacing(double intraCellSpacing) - Parameters:
intraCellSpacing- The intraCellSpacing to set.
-
getOrientation
public int getOrientation()- Returns:
- Returns the orientation.
-
setOrientation
public void setOrientation(int orientation) - Parameters:
orientation- The orientation to set.
-
getLimitX
public double getLimitX()- Returns:
- Returns the limitX.
-
setLimitX
public void setLimitX(double limitX) - Parameters:
limitX- The limitX to set.
-
isFineTuning
public boolean isFineTuning()- Returns:
- Returns the fineTuning.
-
setFineTuning
public void setFineTuning(boolean fineTuning) - Parameters:
fineTuning- The fineTuning to set.
-
isCompactLayout
public boolean isCompactLayout()- Returns:
- Returns the compactLayout.
-
setCompactLayout
public void setCompactLayout(boolean compactLayout) - Parameters:
compactLayout- The compactLayout to set.
-
setLoggerLevel
Sets the logging level of this class- Parameters:
level- the logging level to set
-