- I
Remarks
Layout Style
This ISubtreePlacer can, for example, be used for creating mind maps or a playing schedule of a sports competition.
Usage
The SingleSplitSubtreePlacer is designed to create two subtree layouts on opposite sides of a common root node. It delegates the arrangement of child nodes to two different ISubtreePlacers, known as the primary and secondary subtree placers. The child nodes are partitioned into primary and secondary sets, either automatically or as defined by the user via singleSplitSubtreePlacerPrimaryNodes. The primary child nodes are arranged as a subtree by the primary subtree placer, with its root positioned at the original root node. Similarly, the secondary child nodes are arranged as a subtree by the secondary subtree placer, also with its root positioned at the original root node. To avoid overlaps between the two subtree layouts, the primary and secondary subtree placers must be configured accordingly. For example, they can be configured such that the subtrees lie on opposite sides.
Examples
const leftLevelAlignedSubtreePlacer = new LevelAlignedSubtreePlacer()
leftLevelAlignedSubtreePlacer.transformation =
SubtreeTransform.ROTATE_LEFT
const rightLevelAlignedSubtreePlacer = new LevelAlignedSubtreePlacer()
rightLevelAlignedSubtreePlacer.transformation =
SubtreeTransform.ROTATE_RIGHT
const subtreePlacer = new SingleSplitSubtreePlacer({
primaryPlacer: leftLevelAlignedSubtreePlacer,
secondaryPlacer: rightLevelAlignedSubtreePlacer,
})See Also
Developer's Guide
Members
Constructors
Creates a new SingleSplitSubtreePlacer instance with default settings using the given subtree placers as delegates.
Parameters
- primaryPlacer?: ISubtreePlacer
- The primary delegate ISubtreePlacer which places the primary subtree. If omitted, the defaultSubtreePlacer is used.
- secondaryPlacer?: ISubtreePlacer
- The secondary delegate ISubtreePlacer which places the right subtrees. If omitted, the defaultSubtreePlacer is used.
See Also
Properties
Gets the ISubtreePlacer instance that will arrange the primary subtree.
Gets the ISubtreePlacer instance that will arrange the secondary subtree.
Gets the modification matrix that defines the direction of the subtree.
Property Value
Default Value
Methods
Creates an optional ISubtreePlacerProcessor for pre- and post-processing.
null.Parameters
- treeLayout: TreeLayout
- the current TreeLayout instance
- graph: LayoutGraph
- the input graph
- currentRoot: LayoutNode
- the root node handled by this ISubtreePlacer
Return Value
- ISubtreePlacerProcessor
- a ISubtreePlacerProcessor instance or
null
Implements
ISubtreePlacer.createProcessordetermineChildConnectors
(localRoot: LayoutNode, connectorMap: IMapper<LayoutNode, ParentConnectorDirection>)Provides the direction of the connector to the SubtreeShape for each child node.
determineChildConnectors
(localRoot: LayoutNode, connectorMap: IMapper<LayoutNode, ParentConnectorDirection>)Parameters
- localRoot: LayoutNode
- the local root node
- connectorMap: IMapper<LayoutNode, ParentConnectorDirection>
- the IMapper<K, V> that is used for storing the direction specifiers of the child nodes
Implements
ISubtreePlacer.determineChildConnectorsArranges the SubtreeShapes of the local root and its children and routes the edges that connect them.
This method is the main method of the tree layout algorithm. It is called by TreeLayout in each recursion step to place the local root in relation to its children. Their shapes will be merged into one SubtreeShape, which is returned by this method.
The SubtreeShape for the local root can be obtained from the nodeShapeProvider. subtreeShapeProvider contains the SubtreeShapes assigned to the child nodes.
Due to the order in which the tree nodes are processed, it is guaranteed that at the time of the invocation of this method the SubtreeShape of every descendant node has already been calculated.
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 combined shape of the whole subtree