The AssistantNodePlacer places nodes that are marked as assistants left and right of their parents and all other nodes below the assistant nodes.
Remarks
Layout Style
Concept
This ITreeLayoutNodePlacer delegates the placement of all assistant nodes to an instance of LeftRightNodePlacer. The non-assistant nodes are handled by another node placer. To be able to do this, AssistantNodePlacer uses a IProcessor which prepares the graph for node placing.
A IDataProvider that is registered using ASSISTANT_NODE_DP_KEY returns true
for assistant nodes and false
for all other nodes.
Default Values of Properties
childNodePlacer | SimpleNodePlacer
| A |
spacing | 20 |
Type Details
- yfiles module
- layout-tree
- yfiles-umd modules
- layout-orthogonal-compact, layout-orthogonal, layout-tree, layout
- Legacy UMD name
- yfiles.tree.AssistantNodePlacer
See Also
Constructors
Creates a new AssistantNodePlacer instance that uses the transformation defined by the given matrix.
Parameters
A map of options to pass to the method.
- modificationMatrix - RotatableNodePlacerMatrix
- the transformation matrix. DEFAULT if none is provided.
- spacing - number
The spacing between subtrees for the delegate ITreeLayoutNodePlacer. This option sets the spacing property on the created object.
- childNodePlacer - ITreeLayoutNodePlacer
The ITreeLayoutNodePlacer instance that places the non-assistant children. This option sets the childNodePlacer property on the created object.
- alignPorts - boolean
Whether or not nodes are placed so that the source and target port of an edge are aligned. This option sets the alignPorts property on the created object.
Properties
Gets or sets whether or not nodes are placed so that the source and target port of an edge are aligned.
Remarks
Dependent on the RootNodeAlignment 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 RootNodeAlignments:
Default Value
false
.Ports are not aligned.
Sample Graphs
Defined in
Gets or sets the ITreeLayoutNodePlacer instance that places the non-assistant children.
Remarks
Default Value
Throws
- Exception({ name: 'ArgumentError' })
- if the given child placer is
null
or an instance of class.
See Also
Gets the modification matrix that defines the direction of the subtree.
Gets or sets the spacing between subtrees for the delegate ITreeLayoutNodePlacer.
Remarks
Default Value
20
.Throws
- Exception({ name: 'ArgumentError' })
- if the given spacing is negative
Sample Graphs
Overrides
Methods
Delegates the creation of from-sketch comparators to the two ITreeLayoutNodePlacers handling assistant and non-assistant nodes.
Remarks
Returns
- ↪IComparer<any>
- the IComparer<T> to compare edges, considering the initial locations of their target nodes
See Also
Overrides
Delegates to createComparer.
Creates a IProcessor that prepares the graph for placing assistant node.
Remarks
The pre-processing step adds a dummy node as a child to the current root and changes all edges of non-assistant children such that they start at this dummy node. That way, AssistantNodePlacer is able to delegate the assistant nodes to a ITreeLayoutNodePlacer different from the one used for placing non-assistant nodes. The child node placer is assigned to the dummy node. So the non-assistant children are placed by this delegate placer.
All changes will be cleaned up during the post-processing step.
Parameters
A map of options to pass to the method.
- layouter - TreeLayout
- the current TreeLayout instance
- graph - LayoutGraph
- the input graph
- currentRoot - YNode
- the root node handled by this ITreeLayoutNodePlacer
Returns
- ↪IProcessor
- the IProcessor instance that prepares the graph for AssistantNodePlacer, or
null
if the out-degree of the given root node is zero
Overrides
Determines a connector direction for the given child node.
Parameters
A map of options to pass to the method.
- child - YNode
- the child node
Returns
- ↪ParentConnectorDirection
- a direction specifier as defined in the ITreeLayoutNodePlacer interface
Throws
- Exception({ name: 'InvalidOperationError' })
- if this method is called
Implements
Delegates the calculation of the child connectors to the LeftRightNodePlacer which arranges the assistant nodes.
Parameters
A map of options to pass to the method.
- localRoot - YNode
- the local root node
- connectorMap - IDataMap
- the map that must be used for storing the direction specifiers of the child nodes
Domain YNode a child node of the local root Values number the direction specifier assigned to the child node
See Also
Overrides
Returns the rotated subtree shape for the given node.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the node
Returns
- ↪RotatedSubtreeShape
- the subtree shape for the given node
Defined in
Returns the target PortConstraint for the local root's incoming edge.
Remarks
This method translates the PortConstraint according to the rotation described by the modification matrix. It should be used instead of getTPC.
This method may be used in placeSubtreeOfNode to route the edges to the according port. It may be overridden to provide constant PortConstraints for each node.
Parameters
A map of options to pass to the method.
- localRoot - YNode
- the local root
Returns
- ↪PortConstraint
- the PortConstraint for the incoming edge of the local root or ANY if no PortConstraint is assigned for that edge
Defined in
Returns the absolute source point of the given edge depending on the rotation of this ITreeLayoutNodePlacer.
Remarks
This method translates the source point according to the rotation described by the modification matrix. It should be used instead of getSourcePointAbs.
It can be used in an implementation of placeSubtreeOfNode.
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge whose absolute source point should be calculated
Returns
- ↪YPoint
- the translated absolute source point for the given edge and current modification matrix
Defined in
Returns the rotated subtree shape for the subtree rooted at the given node.
Remarks
Parameters
A map of options to pass to the method.
- node - YNode
- the local root node
Returns
- ↪RotatedSubtreeShape
- the rotated subtree shape of the subtree rooted at the given local root node
Defined in
placeSubtree
(nodeShapeProvider: IDataProvider, subtreeShapeProvider: IDataProvider, graph: LayoutGraph, localRoot: YNode, parentConnectorDirection: ParentConnectorDirection) : SubtreeShapeDelegates the arrangement of SubtreeShapes to an instance of LeftRightNodePlacer.
Remarks
Parameters
A map of options to pass to the method.
- nodeShapeProvider - IDataProvider
- the IDataProvider for obtaining an initial shape of the root node
Domain YNode Values SubtreeShape the shape of the node - subtreeShapeProvider - IDataProvider
- the IDataProvider for accessing the pre-calculated shapes of the subtrees
Domain YNode Values SubtreeShape the shape of the subtree rooted at the node - graph - LayoutGraph
- the input graph
- localRoot - YNode
- 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 merged SubtreeShape containing the local root and all assistant nodes and non-assistant nodes
See Also
Overrides
placeSubtreeOfNode
(localRoot: YNode, parentConnectorDirection: ParentConnectorDirection) : RotatedSubtreeShapeArranges the local root relative to the subtree shape of its children.
Parameters
A map of options to pass to the method.
- localRoot - YNode
- the local root node
- parentConnectorDirection - ParentConnectorDirection
- the direction specifier for the connector of the local root node to its parent node
Returns
- ↪RotatedSubtreeShape
- the merged subtree shape that contains the local root node and all its children
Throws
- Exception({ name: 'InvalidOperationError' })
- if this method is called
Implements
Translates the given real direction of the resulting layout to the model direction of this RotatableNodePlacerBase.
Remarks
Parameters
A map of options to pass to the method.
- realDirection - ParentConnectorDirection
- the real direction
Returns
- ↪number
- the model direction
Throws
- Exception({ name: 'ArgumentError' })
- if translation for the given real direction is not implemented
Defined in
Translates the given model direction to the real direction in the resulting layout.
Remarks
Parameters
A map of options to pass to the method.
- modelDirection - ParentConnectorDirection
- the model direction
Returns
- ↪number
- the real direction
Throws
- Exception({ name: 'ArgumentError' })
- if translation for the given model direction is not implemented
Defined in
Fields
The list containing the created children.
Defined in
The graph instance this ITreeLayoutNodePlacer is working on.
Defined in
The provider of SubtreeShapes for single nodes.
Defined in
The provider of SubtreeShapes for whole subtrees.
Defined in
Constants
A data provider key for marking which nodes are placed as assistants.
Static Methods
createCompoundComparer
(assistantComparer: IComparer<Object>, childComparer: IComparer<Object>) : IComparer<any>Creates a IComparer<T> that compares outgoing edges connecting to assistant nodes and edges connecting to non-assistant nodes separately.
Parameters
A map of options to pass to the method.
- assistantComparer - IComparer<Object>
- the IComparer<T> for edges connecting to assistant nodes
- childComparer - IComparer<Object>
- the IComparer<T> for edges connecting to non-assistant nodes
Returns
- ↪IComparer<any>
- a IComparer<T> that compares edges to assistant nodes separately from edges to non-assistant nodes