Class JGraphHierarchicalLayout
java.lang.Object
com.jgraph.layout.hierarchical.JGraphHierarchicalLayout
- All Implemented Interfaces:
JGraphLayout, JGraphLayout.Stoppable
public class JGraphHierarchicalLayout
extends Object
implements JGraphLayout, JGraphLayout.Stoppable
The top level compound layout of the hierarchical layout. The individual
elements of the layout are called in sequence. This layout does not inherit
from
JGraphCompoundLayout as a complete model of the hierarchy
needs to be passed into each step and-
Nested Class Summary
Nested classes/interfaces inherited from interface JGraphLayout
JGraphLayout.Stoppable -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether or not to pull together sections of layout into empty spaceprotected JGraphHierarchicalLayoutStepThe second stage of a Sugiyama layoutprotected JGraphHierarchicalLayoutStepA cycle pre-processing stageprotected booleanWhether or not cells are ordered according to the order in the graph model.protected booleanWhether or not to perform local optimisations and iterate multiple times through the algorithmprotected booleanWhether or not to fix the position of the root cells.protected doubleThe spacing buffer between unconnected hierarchiesprotected doubleThe spacing buffer added between cell on adjacent layersprotected doubleThe spacing buffer added between cells on the same layerprotected JGraphHierarchicalLayoutStepThe first stage of a Sugiyama layoutprotected booleanWhether or not the initial scan of the graph to determine the layer assigned to each vertex starts from the sinks or source (the sinks being vertices with the fewest, preferable zero, outgoing edges and sources same with incoming edges).protected JGraphHierarchyModelThe internal model formed of the layoutprotected intThe position of the root node(s) relative to the laid out graph inprotected doubleThe distance between each parallel edge on each ranks for long edgesprotected JGraphHierarchicalLayoutStepThe third stage of a Sugiyama layoutprotected JGraphLayoutProgressThe layout progress barFields inherited from interface JGraphLayout
VERSION -
Constructor Summary
ConstructorsConstructorDescriptionThe default constructorJGraphHierarchicalLayout(boolean deterministic) Creates a hierarchical layout, constructing the components of the layout stages -
Method Summary
Modifier and TypeMethodDescriptiondoubledoubledoubleintdoubleReturns the progress object that represents the progress of the current layout run.booleanbooleanbooleanbooleanbooleanvoidrun(JGraphFacade facade) The API method used to exercise the layout upon the facade description and produce a separate description of the vertex position and edge routing changes made.voidsetCompactLayout(boolean compactLayout) voidsetDeterministic(boolean deterministic) voidsetFineTuning(boolean fineTuning) voidsetFixRoots(boolean fixRoots) voidsetInterHierarchySpacing(double interHierarchySpacing) voidsetInterRankCellSpacing(double interRankCellSpacing) voidsetIntraCellSpacing(double intraCellSpacing) voidsetLayoutFromSinks(boolean layoutFromSinks) voidsetLoggerLevel(Level level) Sets the logging level of this classvoidsetOrientation(int orientation) voidsetParallelEdgeSpacing(double parallelEdgeSpacing) toString()ReturnsHierarchical, the name of this algorithm.
-
Field Details
-
intraCellSpacing
protected double intraCellSpacingThe spacing buffer added between cells on the same layer -
interRankCellSpacing
protected double interRankCellSpacingThe spacing buffer added between cell on adjacent layers -
interHierarchySpacing
protected double interHierarchySpacingThe spacing buffer between unconnected hierarchies -
parallelEdgeSpacing
protected double parallelEdgeSpacingThe distance between each parallel edge on each ranks for long edges -
orientation
protected int orientationThe position of the root node(s) relative to the laid out graph in -
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 -
deterministic
protected boolean deterministicWhether or not cells are ordered according to the order in the graph model. Defaults to false since sorting usually produces quadratic performance. Note that since MxGraph returns edges in a deterministic order, it might be that this layout is always deterministic using that JGraph regardless of this flag setting (i.e. leave it false in that case) -
fixRoots
protected boolean fixRootsWhether or not to fix the position of the root cells. Keep in mind to turn off features such as move to origin when fixing the roots, move to origin usually overrides this flag (in JGraph it does). -
layoutFromSinks
protected boolean layoutFromSinksWhether or not the initial scan of the graph to determine the layer assigned to each vertex starts from the sinks or source (the sinks being vertices with the fewest, preferable zero, outgoing edges and sources same with incoming edges). Starting from either direction can tight the layout up and also produce better results for certain types of graphs. If the result for the default is not good enough try a few sample layouts with the value false to see if they improve -
model
The internal model formed of the layout -
cycleStage
A cycle pre-processing stage -
layeringStage
The first stage of a Sugiyama layout -
crossingStage
The second stage of a Sugiyama layout -
placementStage
The third stage of a Sugiyama layout -
progress
The layout progress bar
-
-
Constructor Details
-
JGraphHierarchicalLayout
public JGraphHierarchicalLayout()The default constructor -
JGraphHierarchicalLayout
public JGraphHierarchicalLayout(boolean deterministic) Creates a hierarchical layout, constructing the components of the layout stages- Parameters:
deterministic- whether or not this layout should be deterministic
-
-
Method Details
-
run
The API method used to exercise the layout upon the facade description and produce a separate description of the vertex position and edge routing changes made. It runs each stage of the layout that has been created.- Specified by:
runin interfaceJGraphLayout- Parameters:
facade- the facade object that describes and filters the graph to be acted upon
-
toString
-
getProgress
Description copied from interface:JGraphLayout.StoppableReturns the progress object that represents the progress of the current layout run. Once created, this instance should not be replaced during a layout run. For new runs you should use the reset method on the progress. Consequently, the max progress is only valid after the run method has been invoked, which means you should use a listener if you spawn a new thread.By convention, the layout must check the isStopped method in its inner-most loops and return immediately if the method returns
true.- Specified by:
getProgressin interfaceJGraphLayout.Stoppable- Returns:
- Returns the progress.
-
getIntraCellSpacing
public double getIntraCellSpacing()- Returns:
- Returns the intraCellSpacing.
-
setIntraCellSpacing
public void setIntraCellSpacing(double intraCellSpacing) - Parameters:
intraCellSpacing- The intraCellSpacing to set.
-
getInterRankCellSpacing
public double getInterRankCellSpacing()- Returns:
- Returns the interRankCellSpacing.
-
setInterRankCellSpacing
public void setInterRankCellSpacing(double interRankCellSpacing) - Parameters:
interRankCellSpacing- The interRankCellSpacing to set.
-
getOrientation
public int getOrientation()- Returns:
- Returns the orientation.
-
setOrientation
public void setOrientation(int orientation) - Parameters:
orientation- The orientation to set.
-
getInterHierarchySpacing
public double getInterHierarchySpacing()- Returns:
- Returns the interHierarchySpacing.
-
setInterHierarchySpacing
public void setInterHierarchySpacing(double interHierarchySpacing) - Parameters:
interHierarchySpacing- The interHierarchySpacing to set.
-
getParallelEdgeSpacing
public double getParallelEdgeSpacing() -
setParallelEdgeSpacing
public void setParallelEdgeSpacing(double parallelEdgeSpacing) -
isFineTuning
public boolean isFineTuning()- Returns:
- Returns the fineTuning.
-
setFineTuning
public void setFineTuning(boolean fineTuning) - Parameters:
fineTuning- The fineTuning to set.
-
isDeterministic
public boolean isDeterministic()- Returns:
- Returns the deterministic.
-
setDeterministic
public void setDeterministic(boolean deterministic) - Parameters:
deterministic- The deterministic to set.
-
isCompactLayout
public boolean isCompactLayout()- Returns:
- Returns the compactLayout.
-
setCompactLayout
public void setCompactLayout(boolean compactLayout) - Parameters:
compactLayout- The compactLayout to set.
-
isFixRoots
public boolean isFixRoots()- Returns:
- Returns the fixRoots.
-
setFixRoots
public void setFixRoots(boolean fixRoots) - Parameters:
fixRoots- The fixRoots to set.
-
isLayoutFromSinks
public boolean isLayoutFromSinks() -
setLayoutFromSinks
public void setLayoutFromSinks(boolean layoutFromSinks) -
setLoggerLevel
Sets the logging level of this class- Parameters:
level- the logging level to set
-