C

SingleLayerSubtreePlacer

The SingleLayerSubtreePlacer arranges the subtrees of a local root in a single layer.

Remarks

Layout Style

With its default settings, this placer generates tree layouts with orthogonal edge routes and child nodes that are placed next to each other and below their parent node.

Example layout using default settings

The layout style can be customized in several ways. Subtrees sharing the same local root node are either placed above or below each other.

Example using customized settings: each layer in the tree uses different configurations of SingleLayerSubtreePlacer

Features

SubtreeShapes can be arranged in each main direction specified in transformation. That way, the subtrees of the same graph can have different directions.

This subtree placer aligns the local root node according to a chosen alignment.

There are various routing styles that result in different edge routes.

Default Values of Properties

NameDefaultDescription
edgeRoutingStyleSingleLayerSubtreePlacerRoutingStyle.ORTHOGONAL
minimumChannelSegmentDistance0
rootAlignmentSingleLayerSubtreePlacerRootAlignment.CENTER
verticalAlignment-1
Nodes are not aligned.

See Also

Developer's Guide

Members

Show:

Constructors

Creates a new SingleLayerSubtreePlacer instance.

Parameters

transformation?: SubtreeTransform
The modification matrix that defines the direction of the subtree. Default is NONE.
rootAlignment?: SingleLayerSubtreePlacerRootAlignment
The alignment specifier describing how the root node is aligned with its child nodes. Default is CENTER.
edgeRoutingStyle?: SingleLayerSubtreePlacerRoutingStyle
The routing style specifier. Default is ORTHOGONAL.
verticalDistance?: number
The vertical distance between the SubtreeShapes. Default is 20.0d.
horizontalDistance?: number
The horizontal distance between the SubtreeShapes. Default is 20.0d.
minFirstSegmentLength?: number
The minimum length of the first edge segment (connected to the root node). Default is 20.0.
minLastSegmentLength?: number
The minimum length of the last edge segment (connected to the child node). Default is 20.0.
minSlope?: number
The minimum slope between the root node and the SubtreeShapes. Default is 0.0.
minSlopeHeight?: number
The minimum vertical height of sloped edge segments. Default is 0.0.

See Also

API
transformation, rootAlignment, edgeRoutingStyle, verticalDistance, horizontalDistance, minimumFirstSegmentLength, minimumLastSegmentLength, minimumSlope, minimumSlopeHeight

Properties

Gets or sets whether or not nodes are placed so that the source and target port of an edge are aligned.

Dependent on the root alignment the subtree root is moved in a way that the edge connecting the root to one of its children is straightened.

This setting only applies to the following rootAlignments:

final

Property Value

true if the ports are to be aligned, false otherwise

Default Value

The default value is: false
Ports are not aligned.

Sample Graphs

ShownSetting: false

See Also

API
rootAlignment
Gets or sets the style in which edge paths are routed.
conversionfinal

Property Value

the routing style specifier

Throws

Exception ({ name: 'ArgumentError' })
if the specified routing style is unknown

Default Value

Gets or sets the horizontal distance between nodes or SubtreeShapes.
The distance needs to be non-negative.
final

Property Value

the non-negative horizontal distance

Throws

Exception ({ name: 'ArgumentError' })
if the specified distance is negative

Default Value

The default value is: 20

Sample Graphs

ShownSetting: 40
Gets or sets the minimum (non-negative) distance between edge segments that are routed orthogonally in the channel between the root node and the child nodes (see ORTHOGONAL).
If this distance is set to 0, all segments are routed in a bus-like style.
The specified distance is only considered if minimumSlope is equal to 0, minimumSlopeHeight is equal to 0, edgeRoutingStyle is ORTHOGONAL and rootAlignment is not equal to LEADING_ON_BUS or TRAILING_ON_BUS.
Values greater than 0 are especially useful if the ITreeLayoutPortAssigner distributes the ports at the nodes' border.
final

Property Value

the minimum distance between edge segments

Throws

Exception ({ name: 'ArgumentError' })
if the specified distance is smaller than 0

Default Value

The default value is: 0

Sample Graphs

ShownSetting: Minimum edge distance 0 with centered ports
Gets or sets the minimum length for the first segment of an edge.

During layout calculation, the edges of the tree are directed. Hence, the first segment is always the segment that is attached to the source, which is the local root node.

The length needs to be non-negative.

The specified length is only considered if the routing style is set to ORTHOGONAL or POLYLINE.
final

Property Value

the non-negative minimum segment length

Throws

Exception ({ name: 'ArgumentError' })
if the minimum segment length is negative

Default Value

The default value is: 20

Sample Graphs

ShownSetting: 15

See Also

Developer's Guide
Gets or sets the minimum length for the last segment of an edge.

During layout calculation, the edges of the tree are directed. Hence, the last segment is always the segment that is attached to the target, which is a child node.

The length needs to be non-negative.

The specified length is only considered if the routing style is set to ORTHOGONAL or POLYLINE.
final

Property Value

the non-negative minimum segment length

Throws

Exception ({ name: 'ArgumentError' })
if the minimum segment length is negative

Default Value

The default value is: 20

Sample Graphs

ShownSetting: 15
Gets or sets the minimum slope of the polyline edge segments.

These polyline segments are between the vertical first and last segment of the edge.

The segments may become steeper but they will have at least the specified slope. Negative minimum slopes can lead to edge routes looking like spider legs.

The specified value is only considered if the routing style is set to POLYLINE.
The actual slopes also depend on the vertical distance slope segments can have.
final

Property Value

the minimum slope

Default Value

The default value is: 0.1d

Sample Graphs

ShownSetting: 0

See Also

API
minimumSlopeHeight
Gets or sets the minimum height for polyline edge segments.

These polyline segments are between the vertical first and last segment of the edge.

The segments may become steeper to reach the specified height.

The specified value is only considered if the routing style is set to POLYLINE.
The actual slopes also depend on the minimumSlope minimum slope} segments can have.
final

Property Value

the minimum height for sloped segments

Default Value

The default value is: 0

Sample Graphs

ShownSetting: 0

See Also

API
minimumSlope
Gets or sets how the root node is aligned with its children and their SubtreeShapes.
conversionfinal

Property Value

one of the valid root alignment specifiers

Throws

Exception ({ name: 'ArgumentError' })
if an unknown root alignment specifier is set

Default Value

See Also

Developer's Guide
Gets the modification matrix that defines the direction of the subtree.
conversionfinal

Property Value

the modification matrix

Default Value

The default value is: SubtreeTransform.NONE
Gets or sets the relative vertical alignment of nodes with the same parent.

All values between 0 and 1 result in a valid alignment.

  • 0 - nodes are top-aligned
  • 0.5 - nodes are center-aligned
  • 1 - nodes are bottom-aligned

Values outside the interval [0,1] will result in a more compact node placement with unaligned nodes.

final

Property Value

the relative vertical alignment of nodes that have the same parent node

Default Value

The default value is: -1
Nodes are not aligned.

Sample Graphs

ShownSetting: 0
Gets or sets the vertical distance between nodes or SubtreeShapes.
The distance needs to be non-negative.
final

Property Value

the non-negative vertical distance

Throws

Exception ({ name: 'ArgumentError' })
if the specified distance is negative

Default Value

The default value is: 20

Sample Graphs

ShownSetting: 40

See Also

Developer's Guide

Methods

Returns a clone of this ISubtreePlacer instance.
final

Return Value

any
an exact copy of this ISubtreePlacer instance
Creates a comparison for outgoing edges which takes the initial coordinates of the edges' targets into account.
Child nodes are sorted in a way that the layout will resemble the current arrangement of the nodes. This is especially useful for interactive or incremental layout calculation.
final

Return Value

function(LayoutEdge, LayoutEdge): number
a comparison that considers the initial coordinates of the nodes
Creates an optional ISubtreePlacerProcessor for pre- and post-processing.
This implementation returns null. Hence, no pre- or post-processing will be done.

Parameters

treeLayout: TreeLayout
the current TreeLayout instance
graph: LayoutGraph
the input graph
currentRoot: LayoutNode
the root node handled by this ISubtreePlacer

Return Value

ISubtreePlacerProcessor
null
Determines the connector direction for each subtree based on the selected transformation applied to the subtree.
This method assigns a connector direction for each subtree relative to the position of the local root node. The direction is determined by the applied transformation, which changes the orientation of the subtree. The connector direction will be one of the four cardinal directions (ParentConnectorDirection). The following cases are considered based on the SubtreeTransform:
final

Parameters

localRoot: LayoutNode
The local root node for which the connector direction is determined.
connectorMap: IMapper<LayoutNode, ParentConnectorDirection>
The IMapper<K, V> used to store the connector direction specifiers for the subtrees.

See Also

API
transformation
Initializes the local data structures and then arranges the local root relative to the SubtreeShape of its children.
final

Parameters

nodeShapeProvider: IMapper<LayoutNode, SubtreeShape>
the IMapper<K, V> for obtaining an initial shape of the root node
subtreeShapeProvider: IMapper<LayoutNode, SubtreeShape>
the IMapper<K, V> for accessing the pre-calculated shapes of the subtrees
graph: LayoutGraph
the input graph
localRoot: LayoutNode
the root of the subtree that should be arranged by this method
parentConnectorDirection: ParentConnectorDirection
the direction specifier for the connector of the local root node to its parent node

Return Value

SubtreeShape
the merged SubtreeShape for the subtree rooted at the local root node