C

GroupBoundsCalculator

This ILayoutGroupBoundsCalculator calculates the bounds of group nodes, allows to specify custom padding for each group node, and guarantees that their provided minimum sizes will be maintained.
ImplementsInheritance Hierarchy

Remarks

Padding is provided by an IMapper<K, V> that must have been registered with the graph using the data key GROUP_NODE_PADDING_DATA_KEY prior to the invocation of the layout algorithm. Furthermore, it guarantees that a desired minimum size is maintained. The minimum sizes are provided by an IMapper<K, V> registered with the graph using the data key MINIMUM_GROUP_NODE_SIZE_DATA_KEY or by the property defaultMinimumNodeSize.

Default Values of Properties

NameDefaultDescription
considerEdgeLabelsfalse
Edge labels are not considered during the group bounds calculation.
considerNodeLabelsfalse
Node labels are not considered during the group bounds calculation.
considerNodeMarginstrue
margins are considered during the group bounds calculation.
defaultMinimumNodeSizeSizeD(0,0)
A Size object with width and height set to 0.
xAlignment0.5
Nodes grow equally to the left and to the right, while the center remains unchanged.
yAlignment0.5
Nodes grow equally upwards and downwards, while the center remains unchanged.

Members

No filters for this type

Constructors

Constructs an instance of GroupBoundsCalculator with default settings.

Properties

Gets or sets whether or not the labels of edges contained in a group are considered while calculating the bounds of the group node.
final

Property Value

true if the labels of the edges are considered when calculating the bounds of group nodes, false otherwise

Default Value

The default value is: false
Edge labels are not considered during the group bounds calculation.

Sample Graphs

ShownSetting: false
Gets or sets whether or not the labels of nodes contained in a group are considered while calculating the bounds of the group node.
final

Property Value

true if the labels of the nodes are considered when calculating the bounds of the node's parent group, false otherwise

Default Value

The default value is: false
Node labels are not considered during the group bounds calculation.

Sample Graphs

ShownSetting: false
Gets or sets whether the calculation of the bounds of a group node considers the margins associated with the group's child nodes.
final

Property Value

true if margins associated with nodes should be considered, false otherwise

Default Value

The default value is: true
margins are considered during the group bounds calculation.

Sample Graphs

ShownSetting: false
Gets or sets the default minimum size (width and height) for group nodes.
The default minimum size is used if the IMapper<K, V> registered with MINIMUM_GROUP_NODE_SIZE_DATA_KEY does not contain a mapping for a group node.
conversionfinal

Property Value

a Size instance representing the default minimum width and height

Default Value

The default value is: SizeD(0,0)
A Size object with width and height set to 0.

Sample Graphs

ShownSetting: Minimum group node size 50 x 50
Gets or sets the default padding that will be used if the IMapper<K, V> registered with the data key GROUP_NODE_PADDING_DATA_KEY does not contain a mapping for a specific node.
conversionfinal

Property Value

The default padding used for group nodes without specific padding

Default Value

The default value is: Insets(15,15,15,15)
The padding from the top, left, bottom, and right are set to 15.
Gets or sets how the nodes are resized horizontally if the calculated width is smaller than the preferred minimum width of a group node.
The alignment is defined to be a value between 0 and 1, such that:
  • A value of 0 means that the nodes grow to the right while the left border remains unchanged.
  • A value of 1 means that the nodes grow to the left while the right border remains unchanged.
final

Property Value

a horizontal alignment value from the interval [0,1]

Throws

Exception ({ name: 'ArgumentError' })
if the given value does not lie within [0,1]

Default Value

The default value is: 0.5
Nodes grow equally to the left and to the right, while the center remains unchanged.

Sample Graphs

ShownSetting: X-alignment 0 when minimum group node size is 200 x 200
Gets or sets how the nodes are resized vertically if the calculated height is smaller than the preferred minimum height of a group node.
The alignment is defined to be a value between 0 and 1, such that:
  • A value of 0 means that the nodes grow downwards while the top border remains unchanged.
  • A value of 1 means that the nodes grow upwards while the bottom border remains unchanged.
final

Property Value

a vertical alignment value from the interval [0,1]

Throws

Exception ({ name: 'ArgumentError' })
if the given value does not lie within [0,1]

Default Value

The default value is: 0.5
Nodes grow equally upwards and downwards, while the center remains unchanged.

Sample Graphs

ShownSetting: Y-alignment 0 when minimum group node size is 200 x 200

Methods

Calculates the bounds of the given group node, enlarges the bounds by the padding associated with the group node, and ensures that the size of the group node obeys the associated minimum size.

The padding associated with the group node will be retrieved from an IMapper<K, V> registered with the graph with the data key GROUP_NODE_PADDING_DATA_KEY.

The minimum sizes associated with the group node will be retrieved from an IMapper<K, V> registered with the graph with key MINIMUM_GROUP_NODE_SIZE_DATA_KEY or from the property defaultMinimumNodeSize.

For empty group nodes, the calculated bounds will keep the current center of the group node.
This implementation assumes that the given children are contained in the given graph (which is always true if it is called within the RecursiveGroupLayout).

Parameters

graph: LayoutGraph
the input graph
groupNode: LayoutNode
the group node whose bounds will be calculated
children: IListEnumerable<LayoutNode>
an IListEnumerable<Node> containing the nodes that reside inside the group node

Return Value

Rect
a Rect instance that describes the bounds of the group node