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 classSugiyamaLayoutAlgorithm.BarycentricCrossingReducerstatic interfaceSugiyamaLayoutAlgorithm.CrossingReducerAn interface for heuristics that reduces edge crossings.static classSugiyamaLayoutAlgorithm.DFSLayerProviderProcessing the nodes based on depth first search and creating a list of layersstatic classSugiyamaLayoutAlgorithm.DirectionSpecifies the direction for theSugiyamaLayoutAlgorithm.static classSugiyamaLayoutAlgorithm.GreedyCrossingReducerImplemented the CrossingReducer interface.static interfaceSugiyamaLayoutAlgorithm.LayerProviderAn interface for creating layers.static classSugiyamaLayoutAlgorithm.NodeWrapperStructure to store nodes and their positions in the layers.static classSugiyamaLayoutAlgorithm.SimpleLayerProviderstatic classSugiyamaLayoutAlgorithm.SplitCrossingReducerImplements the CrossingReducer interface.
-
Constructor Summary
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyLayout(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 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
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, Dimension dim)
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
public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir)
Constructs a newSugiyamaLayoutAlgorithmwith the givenSugiyamaLayoutAlgorithm.Direction.- Parameters:
dir- TheSugiyamaLayoutAlgorithm.Directionfor thisSugiyamaLayoutAlgorithm.
-
SugiyamaLayoutAlgorithm
public SugiyamaLayoutAlgorithm()
Constructs a newSugiyamaLayoutAlgorithmwithSugiyamaLayoutAlgorithm.Direction.VERTICALdirection.
-
-
Method Detail
-
applyLayout
public void applyLayout(LayoutContext layoutContext, boolean clean)
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.
-
-