C

GroupingSupport

Provides less frequently used methods for analyzing and managing grouped graphs.
Inheritance Hierarchy

Remarks

An instance of this class configured for a given IGraph instance can be obtained via groupingSupport.

See Also

Developer's Guide

Members

No filters for this type

Constructors

Creates a new instance which operates on the given graph.

Parameters

graph: IGraph
The graph to use for operations on this instance.

Methods

Calculates the minimum area to enclose by the given group node with respect to its IGroupBoundsCalculator.
final

Parameters

groupNode: INode
The group node to calculate the minimum enclosed area of.

Return Value

Rect
The area to enclose for the given group node. This is EMPTY if the node is not a group node, or if it doesn't have any children.
Enlarges all group nodes in the graph so that the minimum enclosed area is respected.
final

See Also

API
enlargeGroupNode
Enlarges all group nodes in the graph in an interactive scenario, so that the minimum enclosed area is respected.
This method should be used in an interactive editing scenario. It records an ICompoundEdit to support undoability and uses the IReshapeHandler for the resizing of the nodes. That way, e.g. orthogonally edited edges will be properly reshaped.
final

Parameters

context: IInputModeContext
The context to use for the IReshapeHandlers.

See Also

API
enlargeGroupNode
Enlarges the given group node to ensure that the minimum enclosed area is inside its bounds.
This method can be used to resize a group node and all of its parent group nodes to fully contain its children, e.g. after a child node has changed its bounds. Note that this method will only enlarge the bounds of the group nodes, it will never reduce the size of a group node.
final

Parameters

groupNode: INode
The group node to resize.
ancestors: boolean
if set to true all ancestor group nodes will be resized, too, if necessary

See Also

API
enlargeGroupNode
Enlarges the group nodes in an interactive scenario, using IReshapeHandler implementations of the group nodes to perform the actual resizing.
This method should be used in an interactive editing scenario. It records an ICompoundEdit to support undoability and uses the IReshapeHandler for the resizing of the nodes. That way, e.g. orthogonally edited edges will be properly reshaped.
final

Parameters

context: IInputModeContext
The context to use for the IReshapeHandlers.
node: INode
The node to enlarge appropriately.
ancestors: boolean
if set to true ancestors the ancestor group nodes will be adjusted, too, if necessary.

See Also

API
IReshapeHandler
Gets the path to root traversing all parents of the given item.
final

Parameters

node: INode
The node to start.

Return Value

IListEnumerable<INode>
A readonly list that includes the node but not the root, unless they are identical and all parents in between them.

Examples

const pathToRoot = graph.groupingSupport.getAncestors(node1_1)
// node1_1, group1, innerGroup, outerGroup

See Also

Developer's Guide
Returns all descendants of the provided node that are part of the grouped graph.
The enumeration will be top down, i.e. all of a node's ancestors will be enumerated before the respective node.
final

Parameters

node: INode
The root node to get the descendants from.

Return Value

IEnumerable<INode>
An enumeration of the children of the node at the time of this invocation in reverse DFS prefix order.

Examples

// GetDescendants is available on the graph's grouping support
const descendants = graph.groupingSupport.getDescendants(outerGroup)
// nodeInOuterGroup, innerGroup, group2, node2_1, group1, node1_2, node1_1

See Also

Developer's Guide
API
getChildren, getDescendantsBottomUp
Returns all descendants of the provided node that are part of the grouped graph.
The enumeration will be bottom up, i.e. all of a node's children will be enumerated before the respective node.
final

Parameters

node: INode
The root node to get the descendants from.

Return Value

IEnumerable<INode>
An enumeration of the children of the node at the time of this invocation in DFS postfix order.

Examples

const descendantsBottomUp =
  graph.groupingSupport.getDescendantsBottomUp(outerGroup)
// node1_1, node1_2, group1, node2_1, group2, innerGroup, nodeInOuterGroup

See Also

Developer's Guide
API
getChildren, getDescendants
Determines the nearest common ancestor of the provided nodes in the graph.
final

Parameters

nodes: INode
The nodes to find the nearest common ancestor of.

Return Value

INode
The nearest common ancestor of the provided nodes.

Examples

// get the grouping support for the graph
const groupingSupport = graph.groupingSupport
// get the nearest common ancestor for node1_1 and node1_2
groupingSupport.getNearestCommonAncestor(node1_1, node1_2) // group1
// get the nearest common ancestor for node1_1 and node2_1
groupingSupport.getNearestCommonAncestor(node1_1, node2_1) // innerGroup

See Also

Developer's Guide
Determines the nearest common ancestor of the provided nodes in the graph.
final

Parameters

nodes: IEnumerable<INode>
The nodes to find the nearest common ancestor of.

Return Value

INode
The nearest common ancestor of the provided nodes.

Examples

// get the grouping support for the graph
const groupingSupport = graph.groupingSupport
// get the nearest common ancestor for node1_1 and node1_2
groupingSupport.getNearestCommonAncestor(node1_1, node1_2) // group1
// get the nearest common ancestor for node1_1 and node2_1
groupingSupport.getNearestCommonAncestor(node1_1, node2_1) // innerGroup

See Also

Developer's Guide
Determines whether there are group nodes in the graph.
This method considers all group nodes, that is, nodes that could have children.
final

Return Value

boolean
true if there are group.
Determines whether ancestor is an ancestor of node in the grouped graph.
final

Parameters

node: INode
The node to check.
ancestor: INode
The ancestor to check.

Return Value

boolean
Whether ancestor is an ancestor of node.

Examples

// get the graph's grouping support
const groupingSupport = graph.groupingSupport

// test whether a node is a descendant of a given group
const node1_1IsDescendantOfGroup1 = groupingSupport.isDescendant(
  node1_1,
  group1,
) // true
const node1_1IsDescendantOfOuterGroup = groupingSupport.isDescendant(
  node1_1,
  outerGroup,
) // true
const node1_1IsDescendantOfGroup2 = groupingSupport.isDescendant(
  node1_1,
  group2,
) // false

See Also

Developer's Guide
API
getDescendants, getDescendantsBottomUp