C

HierarchicalLayoutCore

This class offers advanced core functionality of the HierarchicalLayout algorithm which allows configurations and customizations and can be accessed via property core.
Inheritance Hierarchy

Remarks

Properties fromScratchLayerAssigner, fromScratchSequencer, fixedElementsLayerAssigner and fixedElementsSequencer allow to modify the layering and sequencing algorithms for calculating the hierarchical layout.

It is possible to customize various classes that are responsible to solve sub-problems during the HierarchicalLayout process, e.g., portAssigner, drawingDistanceCalculator or portCandidateSelector.

Furthermore, there are callback methods which can be overridden to realize highly customized scenarios, see for example createSubgraphLayerSequencer.

See Also

API

HierarchicalLayout, core

Members

Show:

Constructors

Creates a new HierarchicalLayoutCore instance with the default settings.

Properties

Gets or sets the ICoordinateAssigner instance that will calculate the final node coordinates.
final

Property Value

the ICoordinateAssigner instance

Throws

Exception ({ name: 'ArgumentError' })
if the ICoordinateAssigner is null

Default Value

Gets or sets the IDrawingDistanceCalculator instance responsible for determining the minimum distances between elements that belong to the same layer.
By default, an instance of DrawingDistanceCalculator is specified.
Specifying a custom implementation of IDrawingDistanceCalculator will make the properties nodeDistance, nodeToEdgeDistance and edgeDistance superfluous. Those properties delegate to DrawingDistanceCalculator and will throw an exception if a different class is used. Adjustments of those distances need to be done directly on the custom implementation of IDrawingDistanceCalculator.
final

Property Value

the given IDrawingDistanceCalculator instance

Throws

Exception ({ name: 'ArgumentError' })
if the specified IDrawingDistanceCalculator is null
Gets or sets the ILayerAssigner instance that obtains the layering for fixed nodes during the from sketch layout.
If the algorithm runs in fromSketchMode, the fixedElementsLayerAssigner is not considered. In this case, the layering is performed by the fromScratchLayerAssigner.
final

Property Value

the ILayerAssigner instance used for fixed nodes

Throws

Exception ({ name: 'ArgumentError' })
if the ILayerAssigner is null

Default Value

The default value is: FromSketchLayerAssigner

See Also

API
fromSketchMode
Gets or sets the ISequencer instance that calculates the sequence of the fixed nodes during the from sketch layout run.
final

Property Value

the ISequencer instance used for fixed elements

Throws

Exception ({ name: 'ArgumentError' })
if the given ISequencer is null

Default Value

The default value is: FromSketchSequencer

See Also

API
fromSketchMode
Gets or sets the ILayerAssigner instance that obtains the layering for the nodes if the layout algorithm does not run in from sketch mode.
If the graph consists of multiple components, then the ILayerAssigner instance should be wrapped in MultiComponentLayerAssigner.
If the algorithm runs in from sketch mode, the fromScratchLayerAssigner is not considered. In this case, the layering is performed by the fixedElementsLayerAssigner.
final

Property Value

the ILayerAssigner instance

Throws

Exception ({ name: 'ArgumentError' })
if the ILayerAssigner is null

Default Value

The default value is: A

See Also

API
fromSketchMode
Gets or sets the ISequencer instance that calculates the node sequence if the layout algorithm does not run in from sketch mode.
final

Property Value

the ISequencer instance

Throws

Exception ({ name: 'ArgumentError' })
if the ISequencer is null

Default Value

The default value is: DefaultSequencer

See Also

API
fromSketchMode
Gets or sets the IHierarchicalLayoutPortAssigner instance responsible for assigning port coordinates to the adjacent edges of each node.
By default, an instance of HierarchicalLayoutPortAssigner is specified.
final

Property Value

the current IHierarchicalLayoutPortAssigner instance

Throws

Exception ({ name: 'ArgumentError' })
if the specified IHierarchicalLayoutPortAssigner is null
Gets or sets the IPortCandidateSelector instance responsible for optimizing the assignment of selected port candidates to the adjacent edges of each node.
final

Property Value

The current IPortCandidateSelector instance.
Gets or sets whether or not to stop the layout algorithm after the layering step.

By then, each node will be assigned to a layer. Since the sequencing and drawing phases are skipped, the order of the nodes within a layer matches the initial order of the nodes, edges won't be routed and the nodes won't get coordinates assigned.

The calculated layering information can be retrieved from layerIndicesResult.

The layout algorithm may be stopped here if only the layer assignment is important and the sequencing or the actual drawing is not needed. For example, an initial layout run may be needed to determine the layering for a second layout run that will work with this information. Then stopping after layering will save runtime.
The bounds of group nodes depend on the locations of their content and the routes of connecting edges. Therefore, they are not yet calculated after the layering phase and will have width and height 1. Similarly, rows and columns of a layout grid do not get proper positions and height/width values.
final

Property Value

true if the layout algorithm should stop after the layering phase, false if the complete layout should be calculated

Default Value

The default value is: false
The algorithm calculates the complete layout.

See Also

API
layerIndicesResult
Gets or sets whether or not to stop the layout algorithm after the sequencing step.

By then, each node will be assigned to a layer and will have a place in the sequence of nodes in this layer. Since the drawing phase is skipped, edges won't be routed and the nodes won't get coordinates assigned.

The calculated layering and sequencing information can be retrieved from layerIndicesResult and sequenceIndicesResult.

The layout algorithm may be stopped here if only the location within the layers is important and the actual drawing is not needed. For example, an initial layout run may be needed to determine the layering and the sequencing for a second layout run that will work with this information. Then stopping after sequencing will save runtime.
The bounds of group nodes depend on the locations of their content and the routes of connecting edges. Therefore, they are not yet calculated after the layering phase and will have width and height 1. Similarly, rows and columns of a layout grid do not get proper positions and height/width values.
final

Property Value

true if the layout algorithm should stop after the sequencing phase, false if the complete layout should be calculated

Default Value

The default value is: false
The algorithm calculates the complete layout.

See Also

API
sequenceIndicesResult, layerIndicesResult

Methods

Factory method called during applyLayoutCore and creates an appropriate ILayerAssigner implementation.
By default, a ConstraintIncrementalLayerAssigner instance with a TopologicalLayerAssigner instance as argument is returned. This method may be overridden to return a custom ILayerAssigner implementation.
protected

Return Value

ILayerAssigner
an ILayerAssigner implementation
Callback method that is called during applyLayoutCore that creates the HierarchicalLayoutNodeContext and HierarchicalLayoutEdgeContext instances for nodes and edges and binds them to the items using ItemFactory.
protected

Parameters

graph: LayoutGraph
The input graph
layoutContext: HierarchicalLayoutContext
The HierarchicalLayoutContext providing access to the ItemFactory instance
Factory method called during applyLayoutCore which creates a ISequencer that sequences the items that are incrementally inserted.

By default, a suitable private implementation of ISequencer is returned. It may be overridden to return custom implementations of the ISequencer interface.

This sequencer instance is only relevant if the hierarchical layout runs in from sketch mode

protected

Return Value

ISequencer
a ISequencer implementation
Disposes of this instance by undoing preparation steps done during prepare.

This method is called by HierarchicalLayout after the actual layout is calculated. It may be overridden in order to revert a custom configuration made in prepare.

This implementation will remove the PortCandidateSelector that was created in case nodePortCandidates are defined and no portCandidateSelector was initially assigned.

Everything that was added to the graph or changed in the core layout algorithm in prepare should be undone here.
protected

Parameters

graph: LayoutGraph
the input graph
hierarchical: HierarchicalLayout
the hierarchical layout algorithm that is run
Prepares and configures this instance based on the settings of the given HierarchicalLayout.

This method is called by HierarchicalLayout before the actual layout is calculated. It may be overridden in order to manually reconfigure.

This implementation will temporarily set a PortCandidateSelector if nodePortCandidates are defined and no portCandidateSelector is assigned yet.

Everything that is added to the graph or changed in the core layout algorithm should be undone in dispose.
protected

Parameters

graph: LayoutGraph
the input graph
hierarchical: HierarchicalLayout
the hierarchical layout instance that is run
Callback method that publishes the layering information.
The layering information is defined with layerIndicesResult.
protected

Parameters

graph: LayoutGraph
the input graph
layoutContext: HierarchicalLayoutContext
The HierarchicalLayoutContext instance which contains the layers that provides the layering information

See Also

API
layerIndicesResult
Callback method that publishes the sequencing information.
The sequencing information is defined with sequenceIndicesResult.
protected

Parameters

graph: LayoutGraph
the input graph
layoutContext: HierarchicalLayoutContext
the HierarchicalLayoutContext instance which provides access to the HierarchicalLayoutNodeContext and HierarchicalLayoutEdgeContext instances, as well as the layers that provides the layering and sequencing information

See Also

API
sequenceIndicesResult
Removes the bends which are obviously not necessary.

By default, this method removes collinear bends from the graph. A bend point is considered to be collinear if it lies on a line with its preceding and succeeding bend point.

It may be overridden for a custom implementation of bend removal. It is called twice during the layout procedure at a point where the hierarchical layout is almost finished.

protected

Parameters

graph: LayoutGraph
the input graph