Class SugiyamaLayoutAlgorithm
- java.lang.Object
-
- org.eclipse.gef.layout.algorithms.SugiyamaLayoutAlgorithm
-
- All Implemented Interfaces:
ILayoutAlgorithm
public class SugiyamaLayoutAlgorithm extends java.lang.Object implements 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 Classes Modifier and Type Class Description static class
SugiyamaLayoutAlgorithm.BarycentricCrossingReducer
static interface
SugiyamaLayoutAlgorithm.CrossingReducer
An interface for heuristics that reduces edge crossings.static class
SugiyamaLayoutAlgorithm.DFSLayerProvider
Processing the nodes based on depth first search and creating a list of layersstatic class
SugiyamaLayoutAlgorithm.Direction
Specifies the direction for theSugiyamaLayoutAlgorithm
.static class
SugiyamaLayoutAlgorithm.GreedyCrossingReducer
Implemented the CrossingReducer interface.static interface
SugiyamaLayoutAlgorithm.LayerProvider
An interface for creating layers.static class
SugiyamaLayoutAlgorithm.NodeWrapper
Structure to store nodes and their positions in the layers.static class
SugiyamaLayoutAlgorithm.SimpleLayerProvider
static class
SugiyamaLayoutAlgorithm.SplitCrossingReducer
Implements the CrossingReducer interface.
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyLayout(LayoutContext layoutContext, boolean clean)
Makes this algorithm perform layout computation and apply it to its context.
-
-
-
Constructor Detail
-
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
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, Dimension dim)
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
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir)
Constructs a newSugiyamaLayoutAlgorithm
with the givenSugiyamaLayoutAlgorithm.Direction
.- Parameters:
dir
- TheSugiyamaLayoutAlgorithm.Direction
for thisSugiyamaLayoutAlgorithm
.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm()
Constructs a newSugiyamaLayoutAlgorithm
withSugiyamaLayoutAlgorithm.Direction.VERTICAL
direction.
-
-
Method Detail
-
applyLayout
public void applyLayout(LayoutContext layoutContext, boolean clean)
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.
-
-