Class OrthogonalGroupLayouter
is an orthogonal layout provider specialized for laying out grouped graphs.
Those parts of a graph that belong to the same group will be placed in a way that they share a common rectangular area in the layout space. The positions and sizes of these group nodes will be calculated by the algorithm.
The layout algorithm is well suited for medium-sized sparse graphs. It produces compact drawings with no overlaps, few crossings, and few bends.
Figure 5.56. Sample group layouts produced by class OrthogonalGroupLayouter
![]() |
![]() |
| A diagram with four groups and edges connecting nodes within these groups. | A diagram with grouped groups. |
Class OrthogonalGroupLayouter knows a number of data provider keys which are used to retrieve supplemental layout data for a graph's elements. The data is bound to the graph by means of a data provider, which is registered using a given look-up key. Table 5.36, “Data provider look-up keys” lists all look-up keys for OrthogonalGroupLayouter.
Binding supplemental layout data to a graph is described in the section called “Providing Supplemental Layout Data”.
Table 5.36. Data provider look-up keys
| Key | Element Type | Value Type | Description |
|---|---|---|---|
| GroupDpKey |
node | bool | For each node a boolean value indicating whether it is a group node or not. |
| NodeIdDpKey |
node | object | For each node an object that serves as a unique ID. |
| ParentNodeIdDpKey |
node | object | For each node an object indicating the group node it belongs to. The object matches the unique ID of a group node that is in the same graph. |
| GroupNodeInsetsDpKey |
node | Insets |
For each group node an
Insets |
| MinimumNodeSizeDpKey |
node | YDimension |
For each group node a YDimension |
| EdgeLabelLayoutDpKey |
edge | LabelLayoutData[] | For each edge an array of LabelLayoutData objects that encode size and preferred placement for all labels of the edge. |
Setup of a grouped graph's hierarchy of nodes (using GroupDpKey, NodeIdDpKey, and ParentNodeIdDpKey) is done transparently by the IGraph-related adapter mechanisms. See also the section called “Setup for Layout” and Chapter 3, Using yFiles.NET Algorithms Functionality.
Unlike the more general orthogonal layout algorithm this specialized layout algorithm provides only a few options.
| Grid | |
| API | int Grid { get; set; } |
| Description | Defines the virtual grid spacing used by the layouter. Each node will be placed in such a way that its center point lies on a grid point. Edges will be routed in such a way that their segments lie on grid lines, if the terminal nodes of the edges allow to place the ports accordingly. |
| Layout Quality | |
| API | double LayoutQuality { get; set; } |
| Description | Sets the desired layout quality. Higher values result in less connection crossings and smaller layout area, but also increased computation time. |
The additional size requirements of group nodes (e.g., special insets or space
for custom labels) can be specified by the use of a data provider that provides
Insets objects for each group node.
The data provider must be registered with the input graph using the key
GroupNodeInsetsDpKey
.
When calculating a layout for a grouped graph, OrthogonalGroupLayouter also supports
minimum size constraints for group nodes.
A minimum size constraint can be conveniently used in order for the group node to
accommodate for the size of its label.
If a data provider is registered with the graph using the look-up key
MinimumNodeSizeDpKey
,
any minimum size constraints for group nodes held by this data provider are respected
by default.
Besides the generic labeling support as described in the section called “Generic Labeling”, which is available with all yFiles layout algorithms, OrthogonalGroupLayouter additionally supports integrated labeling. Furthermore, it can also be set up to take node labels into account during layout.
Integrated labeling is available for edge labels. They are taken into consideration when determining both node placement and edge path generation. With this strategy it is guaranteed that no edge label will overlap other objects in the diagram.
Integrated labeling can be enabled or disabled using the following property:
bool IntegratedEdgeLabeling { get; set; } |
|
| Description | Determines whether integrated labeling is enabled. |
See also the section called “Integrated Labeling”.
Optimal label placement with integrated labeling can be achieved using FreeEdgeLabelModel
as the label model for the edges.
As explained in the section called “Label Models”, this edge label model is ideally
suited in combination with integrated labeling and yields the best match for a label
location that is computed by OrthogonalGroupLayouter.
OrthogonalGroupLayouter provides support for node label-aware orthogonal layout. Node labels do not need to be placed, but instead their size needs to be considered for the placement of adjacent graph elements. Taking node labels into consideration during layout calculation guarantees that they will not overlap nodes in the diagram.
| Consider Node Labels | |
| API | bool ConsiderNodeLabels { get; set; } |
| Description | Enables node label-aware layout calculation. |
The layout module class OrthogonalLayoutModule.cs from the LayoutModulesForm demo application presents the setup of class OrthogonalGroupLayouter in an application context.
|
Copyright ©2004-2011, yWorks GmbH. All rights reserved. |