Gets the ISubtreePlacer instance that will arrange the primary subtree.
SingleSplitSubtreePlacer delegates the arrangement of the children to two different ISubtreePlacers.
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.
Default Values of Properties
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,
})
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new SingleSplitSubtreePlacer instance with default settings using the given subtree placers as delegates.
Parameters
A map of options to pass to the method.
- 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.
- transformation - SubtreeTransform
- The modification matrix that defines the direction of the subtree. This option sets the transformation property on the created object.
See Also
Properties
Gets the ISubtreePlacer instance that will arrange the secondary subtree.
Gets the modification matrix that defines the direction of the subtree.
Methods
createProcessor
(treeLayout: TreeLayout, graph: LayoutGraph, currentRoot: LayoutNode) : ISubtreePlacerProcessorCreates an optional ISubtreePlacerProcessor for pre- and post-processing.
Remarks
null
.Parameters
A map of options to pass to the method.
- treeLayout - TreeLayout
- the current TreeLayout instance
- graph - LayoutGraph
- the input graph
- currentRoot - LayoutNode
- the root node handled by this ISubtreePlacer
Returns
- ↪ISubtreePlacerProcessor?
- a ISubtreePlacerProcessor instance or
null
Implements
determineChildConnectors
(localRoot: LayoutNode, connectorMap: IMapper<LayoutNode,ParentConnectorDirection>)Provides the direction of the connector to the SubtreeShape for each child node.
Remarks
Parameters
A map of options to pass to the method.
- 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
placeSubtree
(nodeShapeProvider: IMapper<LayoutNode,SubtreeShape>, subtreeShapeProvider: IMapper<LayoutNode,SubtreeShape>, graph: LayoutGraph, localRoot: LayoutNode, parentConnectorDirection: ParentConnectorDirection) : SubtreeShapeArranges the SubtreeShapes of the local root and its children and routes the edges that connect them.
Remarks
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
A map of options to pass to the method.
- 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
Returns
- ↪SubtreeShape
- the combined shape of the whole subtree
Implements
Constants
A data key for dividing the children into two sets.
Remarks
Assign true
to a node that should be placed in the primary subtree, or false
if it should be placed in the secondary subtree.
If there is no IMapper<K,V> registered with this key, half of the nodes are placed in the primary subtree and the remaining nodes are placed in the secondary subtree.