JGraph
v5.13.0.4


com.jgraph.layout.hierarchical
Class JGraphHierarchicalLayout

java.lang.Object
  extended by com.jgraph.layout.hierarchical.JGraphHierarchicalLayout
All Implemented Interfaces:
JGraphLayout, JGraphLayout.Stoppable

public class JGraphHierarchicalLayout
extends java.lang.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 com.jgraph.layout.JGraphLayout
JGraphLayout.Stoppable
 
Field Summary
protected  boolean compactLayout
          Whether or not to pull together sections of layout into empty space
protected  JGraphHierarchicalLayoutStep crossingStage
          The second stage of a Sugiyama layout
protected  JGraphHierarchicalLayoutStep cycleStage
          A cycle pre-processing stage
protected  boolean deterministic
          Whether or not cells are ordered according to the order in the graph model.
protected  boolean fineTuning
          Whether or not to perform local optimisations and iterate multiple times through the algorithm
protected  boolean fixRoots
          Whether or not to fix the position of the root cells.
protected  double interHierarchySpacing
          The spacing buffer between unconnected hierarchies
protected  double interRankCellSpacing
          The spacing buffer added between cell on adjacent layers
protected  double intraCellSpacing
          The spacing buffer added between cells on the same layer
protected  JGraphHierarchicalLayoutStep layeringStage
          The first stage of a Sugiyama layout
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).
protected  JGraphHierarchyModel model
          The internal model formed of the layout
protected  int orientation
          The position of the root node(s) relative to the laid out graph in
protected  double parallelEdgeSpacing
          The distance between each parallel edge on each ranks for long edges
protected  JGraphHierarchicalLayoutStep placementStage
          The third stage of a Sugiyama layout
protected  JGraphLayoutProgress progress
          The layout progress bar
 
Fields inherited from interface com.jgraph.layout.JGraphLayout
VERSION
 
Constructor Summary
JGraphHierarchicalLayout()
          The default constructor
JGraphHierarchicalLayout(boolean deterministic)
          Creates a hierarchical layout, constructing the components of the layout stages
 
Method Summary
 double getInterHierarchySpacing()
           
 double getInterRankCellSpacing()
           
 double getIntraCellSpacing()
           
 int getOrientation()
           
 double getParallelEdgeSpacing()
           
 JGraphLayoutProgress getProgress()
          Returns the progress object that represents the progress of the current layout run.
 boolean isCompactLayout()
           
 boolean isDeterministic()
           
 boolean isFineTuning()
           
 boolean isFixRoots()
           
 boolean isLayoutFromSinks()
           
 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.
 void setCompactLayout(boolean compactLayout)
           
 void setDeterministic(boolean deterministic)
           
 void setFineTuning(boolean fineTuning)
           
 void setFixRoots(boolean fixRoots)
           
 void setInterHierarchySpacing(double interHierarchySpacing)
           
 void setInterRankCellSpacing(double interRankCellSpacing)
           
 void setIntraCellSpacing(double intraCellSpacing)
           
 void setLayoutFromSinks(boolean layoutFromSinks)
           
 void setLoggerLevel(java.util.logging.Level level)
          Sets the logging level of this class
 void setOrientation(int orientation)
           
 void setParallelEdgeSpacing(double parallelEdgeSpacing)
           
 java.lang.String toString()
          Returns Hierarchical, the name of this algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

intraCellSpacing

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


interRankCellSpacing

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


interHierarchySpacing

protected double interHierarchySpacing
The spacing buffer between unconnected hierarchies


parallelEdgeSpacing

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


orientation

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


fineTuning

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


compactLayout

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


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)


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).


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


cycleStage

protected JGraphHierarchicalLayoutStep cycleStage
A cycle pre-processing stage


layeringStage

protected JGraphHierarchicalLayoutStep layeringStage
The first stage of a Sugiyama layout


crossingStage

protected JGraphHierarchicalLayoutStep crossingStage
The second stage of a Sugiyama layout


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

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.

Specified by:
run in interface JGraphLayout
Parameters:
facade - the facade object that describes and filters the graph to be acted upon

toString

public java.lang.String toString()
Returns Hierarchical, the name of this algorithm.

Overrides:
toString in class java.lang.Object

getProgress

public JGraphLayoutProgress getProgress()
Description copied from interface: JGraphLayout.Stoppable
Returns 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:
getProgress in interface JGraphLayout.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

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

Parameters:
level - the logging level to set

JGraph
v5.13.0.4


Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.