Package org.eclipse.gef.layout.algorithms

# Class SugiyamaLayoutAlgorithm

java.lang.Object
org.eclipse.gef.layout.algorithms.SugiyamaLayoutAlgorithm

All Implemented Interfaces:
  `ILayoutAlgorithm`

public class SugiyamaLayoutAlgorithm extends 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 layers
`static enum`
`SugiyamaLayoutAlgorithm.Direction`
Specifies the direction for the `SugiyamaLayoutAlgorithm`.
`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

Constructors
Constructor
Description
`SugiyamaLayoutAlgorithm()`
Constructs a new `SugiyamaLayoutAlgorithm` with `SugiyamaLayoutAlgorithm.Direction.VERTICAL` direction.
`SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir)`
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`.
`SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, Dimension dim)`
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.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 new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`, and `SugiyamaLayoutAlgorithm.CrossingReducer`.
`SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider)`
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`, `SugiyamaLayoutAlgorithm.LayerProvider`, and a `SugiyamaLayoutAlgorithm.BarycentricCrossingReducer`.
`SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider, SugiyamaLayoutAlgorithm.CrossingReducer crossing)`
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`, `SugiyamaLayoutAlgorithm.LayerProvider`, and `SugiyamaLayoutAlgorithm.CrossingReducer`.

## Method Summary

Modifier and Type
Method
Description
`void`
`applyLayout(LayoutContext layoutContext, boolean clean)`
Makes this algorithm perform layout computation and apply it to its context.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## 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 bottom
  `dim` - - desired size of the layout area. Uses the BOUNDS_PROPERTY of the LayoutContext if not set
  `layering` - - implementation of LayerProvider interface
  `crossing` - - implementation of CrossingReducer interface

### SugiyamaLayoutAlgorithm

public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider, SugiyamaLayoutAlgorithm.CrossingReducer crossing)
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`, `SugiyamaLayoutAlgorithm.LayerProvider`, and `SugiyamaLayoutAlgorithm.CrossingReducer`.

Parameters:
  `dir` - The `SugiyamaLayoutAlgorithm.Direction` for this `SugiyamaLayoutAlgorithm` .
  `layerProvider` - The LayerProvider for this `SugiyamaLayoutAlgorithm`.
  `crossing` - The CrossingReducer for this `SugiyamaLayoutAlgorithm`.

### SugiyamaLayoutAlgorithm

public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.LayerProvider layerProvider)
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`, `SugiyamaLayoutAlgorithm.LayerProvider`, and a `SugiyamaLayoutAlgorithm.BarycentricCrossingReducer`.

Parameters:
  `dir` - The `SugiyamaLayoutAlgorithm.Direction` for this `SugiyamaLayoutAlgorithm` .
  `layerProvider` - The LayerProvider for this `SugiyamaLayoutAlgorithm`.

### SugiyamaLayoutAlgorithm

public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, SugiyamaLayoutAlgorithm.CrossingReducer crossing)
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`, and `SugiyamaLayoutAlgorithm.CrossingReducer`.

Parameters:
  `dir` - The `SugiyamaLayoutAlgorithm.Direction` for this `SugiyamaLayoutAlgorithm` .
  `crossing` - The CrossingReducer for this `SugiyamaLayoutAlgorithm`.

### SugiyamaLayoutAlgorithm

public SugiyamaLayoutAlgorithm(SugiyamaLayoutAlgorithm.Direction dir, Dimension dim)
Constructs a new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`, and the given dimension.

Parameters:
  `dir` - The `SugiyamaLayoutAlgorithm.Direction` for this `SugiyamaLayoutAlgorithm` .
  `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 new `SugiyamaLayoutAlgorithm` with the given `SugiyamaLayoutAlgorithm.Direction`.

Parameters:
  `dir` - The `SugiyamaLayoutAlgorithm.Direction` for this `SugiyamaLayoutAlgorithm` .

### SugiyamaLayoutAlgorithm

public SugiyamaLayoutAlgorithm()
Constructs a new `SugiyamaLayoutAlgorithm` with `SugiyamaLayoutAlgorithm.Direction.VERTICAL` direction.

## Method Details

### 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 interface `ILayoutAlgorithm`
Parameters:
  `layoutContext` - The `LayoutContext` 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.