Class SugiyamaLayoutAlgorithm
java.lang.Object
org.eclipse.gef.layout.algorithms.SugiyamaLayoutAlgorithm
- All Implemented Interfaces:
ILayoutAlgorithm
The SugiyamaLayoutAlgorithm class implements an algorithm to arrange a
directed graph in a layered tree-like layout. The final presentation follows
five design principles for enhanced readability:
- Hierarchical layout of vertices - Least crossings of lines (edges) -
Straightness of lines when ever possible - Close layout of vertices connected
to each other, i.e. short paths - Balanced layout of lines coming into or
going from a vertex
For further information see http://dx.doi.org/10.1109/TSMC.1981.4308636
This layout algorithm works only with - directed graphs (otherwise an
appropriate RuntimeException is thrown)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
An interface for heuristics that reduces edge crossings.static class
Processing the nodes based on depth first search and creating a list of layersstatic enum
Specifies the direction for theSugiyamaLayoutAlgorithm
.static class
Implemented the CrossingReducer interface.static interface
An interface for creating layers.static class
Structure to store nodes and their positions in the layers.static class
static class
Implements the CrossingReducer interface. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newSugiyamaLayoutAlgorithm
withSugiyamaLayoutAlgorithm.Direction.VERTICAL
direction.Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
.Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
, and the given dimension.SugiyamaLayoutAlgorithm
(SugiyamaLayoutAlgorithm.Direction dir, Dimension dim, SugiyamaLayoutAlgorithm.LayerProvider layering, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a tree-like, layered layout of a directed graph.SugiyamaLayoutAlgorithm
(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
, andSugiyamaLayoutAlgorithm.CrossingReducer
.SugiyamaLayoutAlgorithm
(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider) Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
,SugiyamaLayoutAlgorithm.LayerProvider
, and aSugiyamaLayoutAlgorithm.BarycentricCrossingReducer
.SugiyamaLayoutAlgorithm
(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
,SugiyamaLayoutAlgorithm.LayerProvider
, andSugiyamaLayoutAlgorithm.CrossingReducer
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyLayout
(LayoutContext layoutContext, boolean clean) Makes this algorithm perform layout computation and apply it to its context.
-
Constructor Details
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, Dimension dim, SugiyamaLayoutAlgorithm.LayerProvider layering, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a tree-like, layered layout of a directed graph.- Parameters:
dir
-SugiyamaLayoutAlgorithm.Direction.HORIZONTAL
: left to right -SugiyamaLayoutAlgorithm.Direction.VERTICAL
: top to bottomdim
- - desired size of the layout area. Uses the BOUNDS_PROPERTY of the LayoutContext if not setlayering
- - implementation of LayerProvider interfacecrossing
- - implementation of CrossingReducer interface
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
,SugiyamaLayoutAlgorithm.LayerProvider
, andSugiyamaLayoutAlgorithm.CrossingReducer
.- Parameters:
dir
- TheSugiyamaLayoutAlgorithm.Direction
for thisSugiyamaLayoutAlgorithm
.layerProvider
- The LayerProvider for thisSugiyamaLayoutAlgorithm
.crossing
- The CrossingReducer for thisSugiyamaLayoutAlgorithm
.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider) Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
,SugiyamaLayoutAlgorithm.LayerProvider
, and aSugiyamaLayoutAlgorithm.BarycentricCrossingReducer
.- Parameters:
dir
- TheSugiyamaLayoutAlgorithm.Direction
for thisSugiyamaLayoutAlgorithm
.layerProvider
- The LayerProvider for thisSugiyamaLayoutAlgorithm
.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
, andSugiyamaLayoutAlgorithm.CrossingReducer
.- Parameters:
dir
- TheSugiyamaLayoutAlgorithm.Direction
for thisSugiyamaLayoutAlgorithm
.crossing
- The CrossingReducer for thisSugiyamaLayoutAlgorithm
.
-
SugiyamaLayoutAlgorithm
Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
, and the given dimension.- Parameters:
dir
- TheSugiyamaLayoutAlgorithm.Direction
for thisSugiyamaLayoutAlgorithm
.dim
- The desired size of the layout area. Uses the BOUNDS_PROPERTY of the LayoutContext if not set.
-
SugiyamaLayoutAlgorithm
Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
.- Parameters:
dir
- TheSugiyamaLayoutAlgorithm.Direction
for thisSugiyamaLayoutAlgorithm
.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm()Constructs a newSugiyamaLayoutAlgorithm
withSugiyamaLayoutAlgorithm.Direction.VERTICAL
direction.
-
-
Method Details
-
applyLayout
Description copied from interface:ILayoutAlgorithm
Makes this algorithm perform layout computation and apply it to its context.- Specified by:
applyLayout
in interfaceILayoutAlgorithm
- Parameters:
layoutContext
- TheLayoutContext
that provides all relevant information about what to layout.clean
- if true the receiver should assume that the layout context has changed significantly and recompute the whole layout even if it keeps track of changes with listeners. False can be used after dynamic layout in a context is turned back on so that layout algorithm working in background can apply accumulated changes. Static layout algorithm can ignore this call entirely if clean is false.
-