com.jgraph.layout.hierarchical

Class JGraphHierarchicalLayout

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
Field Summary
protected booleancompactLayout
Whether or not to pull together sections of layout into empty space
protected JGraphHierarchicalLayoutStepcrossingStage
The second stage of a Sugiyama layout
protected JGraphHierarchicalLayoutStepcycleStage
A cycle pre-processing stage
protected booleandeterministic
Whether or not cells are ordered according to the order in the graph model.
protected booleanfineTuning
Whether or not to perform local optimisations and iterate multiple times through the algorithm
protected booleanfixRoots
Whether or not to fix the position of the root cells.
protected doubleinterHierarchySpacing
The spacing buffer between unconnected hierarchies
protected doubleinterRankCellSpacing
The spacing buffer added between cell on adjacent layers
protected doubleintraCellSpacing
The spacing buffer added between cells on the same layer
protected JGraphHierarchicalLayoutSteplayeringStage
The first stage of a Sugiyama layout
protected booleanlayoutFromSinks
Whether 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 JGraphHierarchyModelmodel
The internal model formed of the layout
protected intorientation
The position of the root node(s) relative to the laid out graph in
protected doubleparallelEdgeSpacing
The distance between each parallel edge on each ranks for long edges
protected JGraphHierarchicalLayoutStepplacementStage
The third stage of a Sugiyama layout
protected JGraphLayoutProgressprogress
The layout progress bar
Constructor Summary
JGraphHierarchicalLayout()
The default constructor
JGraphHierarchicalLayout(boolean deterministic)
Creates a hierarchical layout, constructing the components of the layout stages
Method Summary
doublegetInterHierarchySpacing()
doublegetInterRankCellSpacing()
doublegetIntraCellSpacing()
intgetOrientation()
doublegetParallelEdgeSpacing()
JGraphLayoutProgressgetProgress()
booleanisCompactLayout()
booleanisDeterministic()
booleanisFineTuning()
booleanisFixRoots()
booleanisLayoutFromSinks()
voidrun(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 class
voidsetOrientation(int orientation)
voidsetParallelEdgeSpacing(double parallelEdgeSpacing)
StringtoString()
Returns Hierarchical, the name of this algorithm.

Field Detail

compactLayout

protected boolean compactLayout
Whether or not to pull together sections of layout into empty space

crossingStage

protected JGraphHierarchicalLayoutStep crossingStage
The second stage of a Sugiyama layout

cycleStage

protected JGraphHierarchicalLayoutStep cycleStage
A cycle pre-processing stage

deterministic

protected boolean deterministic
Whether 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)

fineTuning

protected boolean fineTuning
Whether or not to perform local optimisations and iterate multiple times through the algorithm

fixRoots

protected boolean fixRoots
Whether 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).

interHierarchySpacing

protected double interHierarchySpacing
The spacing buffer between unconnected hierarchies

interRankCellSpacing

protected double interRankCellSpacing
The spacing buffer added between cell on adjacent layers

intraCellSpacing

protected double intraCellSpacing
The spacing buffer added between cells on the same layer

layeringStage

protected JGraphHierarchicalLayoutStep layeringStage
The first stage of a Sugiyama layout

layoutFromSinks

protected boolean layoutFromSinks
Whether 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

protected JGraphHierarchyModel model
The internal model formed of the layout

orientation

protected int orientation
The position of the root node(s) relative to the laid out graph in

parallelEdgeSpacing

protected double parallelEdgeSpacing
The distance between each parallel edge on each ranks for long edges

placementStage

protected JGraphHierarchicalLayoutStep placementStage
The third stage of a Sugiyama layout

progress

protected JGraphLayoutProgress progress
The layout progress bar

Constructor Detail

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 Detail

getInterHierarchySpacing

public double getInterHierarchySpacing()

Returns: Returns the interHierarchySpacing.

getInterRankCellSpacing

public double getInterRankCellSpacing()

Returns: Returns the interRankCellSpacing.

getIntraCellSpacing

public double getIntraCellSpacing()

Returns: Returns the intraCellSpacing.

getOrientation

public int getOrientation()

Returns: Returns the orientation.

getParallelEdgeSpacing

public double getParallelEdgeSpacing()

getProgress

public JGraphLayoutProgress getProgress()

Returns: Returns the progress.

isCompactLayout

public boolean isCompactLayout()

Returns: Returns the compactLayout.

isDeterministic

public boolean isDeterministic()

Returns: Returns the deterministic.

isFineTuning

public boolean isFineTuning()

Returns: Returns the fineTuning.

isFixRoots

public boolean isFixRoots()

Returns: Returns the fixRoots.

isLayoutFromSinks

public boolean isLayoutFromSinks()

run

public void run(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. It runs each stage of the layout that has been created.

Parameters: facade the facade object that describes and filters the graph to be acted upon

setCompactLayout

public void setCompactLayout(boolean compactLayout)

Parameters: compactLayout The compactLayout to set.

setDeterministic

public void setDeterministic(boolean deterministic)

Parameters: deterministic The deterministic to set.

setFineTuning

public void setFineTuning(boolean fineTuning)

Parameters: fineTuning The fineTuning to set.

setFixRoots

public void setFixRoots(boolean fixRoots)

Parameters: fixRoots The fixRoots to set.

setInterHierarchySpacing

public void setInterHierarchySpacing(double interHierarchySpacing)

Parameters: interHierarchySpacing The interHierarchySpacing to set.

setInterRankCellSpacing

public void setInterRankCellSpacing(double interRankCellSpacing)

Parameters: interRankCellSpacing The interRankCellSpacing to set.

setIntraCellSpacing

public void setIntraCellSpacing(double intraCellSpacing)

Parameters: intraCellSpacing The intraCellSpacing to set.

setLayoutFromSinks

public void setLayoutFromSinks(boolean layoutFromSinks)

setLoggerLevel

public void setLoggerLevel(Level level)
Sets the logging level of this class

Parameters: level the logging level to set

setOrientation

public void setOrientation(int orientation)

Parameters: orientation The orientation to set.

setParallelEdgeSpacing

public void setParallelEdgeSpacing(double parallelEdgeSpacing)

toString

public String toString()
Returns Hierarchical, the name of this algorithm.
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.