This stage offers generic support for LayoutGrid structures so that a grid can be considered even when running a layout algorithm that natively does not support it.
Remarks
It is not required to apply this stage when executing a layout algorithm that already supports the LayoutGrid natively, for example, HierarchicalLayout, OrganicLayout or EdgeRouter.
The stage performs the following steps:
- First it determines sub-components such that each component only contains nodes associated with the same grid cell. Nodes without associated grid cell are temporarily assigned to a suitable cell.
- Now this stage applies the specified coreLayout to each sub-component and, afterwards, reassembles the global layout grid structure. Since the sub-components do not contain nodes of different cells, the core layout algorithm doesn't require support for layout grid on its own.
- Finally, this stage routes edges that connect nodes of different sub-components by means of the specified inter-edge router. Note that such edges are temporarily hidden during the core layout runs.
Disabling property splitMultiCellComponents allows to switch to a mode where connected components are not split into smaller sub-components. Hence, a component may contain nodes of different grid cells and, thus, the specified coreLayout has to support layout grid structures by itself. In this case, this stage doesn't offer a generic layout grid support (since the core layout algorithm already has to support such structures). Instead it may speed up the layout calculation since the core layout algorithm is applied to different smaller graphs instead of a single, larger input graph.
Default Values of Properties
interEdgeRouter | null | Inter-edges are routed as straight lines. |
nodeLabelPlacement | CONSIDER
| Node labels are included in the bounds of the grid cells. |
splitMultiCellComponents | true | Components with nodes of different layout grid cells are split. |
Type Details
- yFiles module
- algorithms
See Also
Constructors
Creates a new instance using the given coreLayout.
Parameters
A map of options to pass to the method.
- coreLayout - ILayoutAlgorithm
- the core layout algorithm
- nodeLabelPlacement - BasicNodeLabelPlacement
- Whether or not to take node labels into account when calculating the bounds of the layout grid cells. This option sets the nodeLabelPlacement property on the created object.
- edgeLabelPlacement - BasicEdgeLabelPlacement
- Whether or not to take edge labels into account when calculating the bounds of the layout grid cells. This option sets the edgeLabelPlacement property on the created object.
- interEdgeRouter - ILayoutAlgorithm
- The current edge routing algorithm for handling inter-edges. This option sets the interEdgeRouter property on the created object.
- splitMultiCellComponents - boolean
- Whether or not the algorithm should split connected components that have nodes associated with different layout grid cells. This option sets the splitMultiCellComponents property on the created object.
- enabled - boolean
Properties
Gets or sets the core ILayoutAlgorithm that is wrapped by this stage.
Gets or sets whether or not to take edge labels into account when calculating the bounds of the layout grid cells.
Default Value
Property Value
See Also
Gets or sets a value that determines whether this stage should do anything but execute the coreLayout.
Remarks
By default, when constructed, stages should be enabled. Users may disable a stage's functionality by setting this property to false
.
Stages that can guarantee that the graph will not change can choose to not even execute the coreLayout when disabled.
Implements
Gets or sets the current edge routing algorithm for handling inter-edges.
Remarks
Default Value
null
.Inter-edges are routed as straight lines.
Property Value
null
if edges are routed as straight linesGets or sets whether or not to take node labels into account when calculating the bounds of the layout grid cells.
Default Value
Property Value
See Also
Gets or sets whether or not the algorithm should split connected components that have nodes associated with different layout grid cells.
Remarks
If this option is enabled, such components are split into sub-components that only include nodes associated with the same grid cell. Hence, the coreLayout doesn't see the LayoutGrid at all. Edges that connect nodes of different sub-components are temporarily hidden and routed afterwards by means of the inter-edge router.
If this option is disabled, the layout algorithm determines independent components and calls the coreLayout for each of them. Note that two connected components are only independent if there is no group node that contains a node of each of them and if the two sub-layout grids induced by the connected components do not have a common LayoutGridColumn or LayoutGridRow. The core layout algorithm is called once for each independent component and, thus, has to support layout grid structures.
Default Value
true
.Components with nodes of different layout grid cells are split.
Property Value
true
if connected components with nodes of different layout grid cells are split, false
otherwiseMethods
Implementation of the ILayoutAlgorithm interface and main entry point for the layout calculation.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- The graph to apply the layout to.
Implements
Starts the layout.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
Implements
createLayoutData
(graph: LayoutGraph) : GenericLayoutGridStageData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the GenericLayoutGridStage.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪GenericLayoutGridStageData<LayoutNode,LayoutEdge,LayoutNodeLabel,LayoutEdgeLabel>
- an instance of layout data that can be used to perform item-specific configurations for the given GenericLayoutGridStage.
Returns an instance of LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> that can be used to perform item-specific configurations for the GenericLayoutGridStage.
Remarks
Parameters
A map of options to pass to the method.
- graph - IGraph
- the graph that determines the generic type arguments of the created layout data
Returns
- ↪GenericLayoutGridStageData<INode,IEdge,ILabel,ILabel>
- an instance of layout data that can be used to perform item-specific configurations for the given GenericLayoutGridStage.
LayoutExecutor
type is available at runtime.Constants
An IMapper<K,V> key for marking the inter-edges to be routed.
Remarks
true
and regular edges as false
.A data key for explicitly marking (some) edges that should not be considered when calculating the sub-components.
Remarks
This key is only considered if property splitMultiCellComponents is disabled. The marked edges, the so-called split-edges, are temporarily removed during the calculation of the sub-components and, finally, routed with the specified inter-edge router. This allows to control how the graph is split into smaller graph components. Recall that with this setting a component may contain nodes of different layout grid cells.
Assign true
if the edge should be considered when calculating the sub-components, false
otherwise.