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 classstatic interfaceAn interface for heuristics that reduces edge crossings.static classProcessing the nodes based on depth first search and creating a list of layersstatic enumSpecifies the direction for theSugiyamaLayoutAlgorithm.static classImplemented the CrossingReducer interface.static interfaceAn interface for creating layers.static classStructure to store nodes and their positions in the layers.static classstatic classImplements the CrossingReducer interface. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newSugiyamaLayoutAlgorithmwithSugiyamaLayoutAlgorithm.Direction.VERTICALdirection.Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction.Constructs a newSugiyamaLayoutAlgorithmwith 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 newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction, andSugiyamaLayoutAlgorithm.CrossingReducer.SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider) Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction,SugiyamaLayoutAlgorithm.LayerProvider, and aSugiyamaLayoutAlgorithm.BarycentricCrossingReducer.SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction,SugiyamaLayoutAlgorithm.LayerProvider, andSugiyamaLayoutAlgorithm.CrossingReducer. -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyLayout(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 newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction,SugiyamaLayoutAlgorithm.LayerProvider, andSugiyamaLayoutAlgorithm.CrossingReducer.- Parameters:
dir- TheSugiyamaLayoutAlgorithm.Directionfor thisSugiyamaLayoutAlgorithm.layerProvider- The LayerProvider for thisSugiyamaLayoutAlgorithm.crossing- The CrossingReducer for thisSugiyamaLayoutAlgorithm.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider) Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction,SugiyamaLayoutAlgorithm.LayerProvider, and aSugiyamaLayoutAlgorithm.BarycentricCrossingReducer.- Parameters:
dir- TheSugiyamaLayoutAlgorithm.Directionfor thisSugiyamaLayoutAlgorithm.layerProvider- The LayerProvider for thisSugiyamaLayoutAlgorithm.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.CrossingReducer crossing) Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction, andSugiyamaLayoutAlgorithm.CrossingReducer.- Parameters:
dir- TheSugiyamaLayoutAlgorithm.Directionfor thisSugiyamaLayoutAlgorithm.crossing- The CrossingReducer for thisSugiyamaLayoutAlgorithm.
-
SugiyamaLayoutAlgorithm
Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction, and the given dimension.- Parameters:
dir- TheSugiyamaLayoutAlgorithm.Directionfor thisSugiyamaLayoutAlgorithm.dim- The desired size of the layout area. Uses the BOUNDS_PROPERTY of the LayoutContext if not set.
-
SugiyamaLayoutAlgorithm
Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction.- Parameters:
dir- TheSugiyamaLayoutAlgorithm.Directionfor thisSugiyamaLayoutAlgorithm.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm()Constructs a newSugiyamaLayoutAlgorithmwithSugiyamaLayoutAlgorithm.Direction.VERTICALdirection.
-
-
Method Details
-
applyLayout
Description copied from interface:ILayoutAlgorithmMakes this algorithm perform layout computation and apply it to its context.- Specified by:
applyLayoutin interfaceILayoutAlgorithm- Parameters:
layoutContext- TheLayoutContextthat 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.
-