C

ClearAreaLayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>

Specifies custom data for the ClearAreaLayout.
Inheritance Hierarchy

Members

Show:

Constructors

Parameters

Properties

Gets or sets the group node inside which the cleared area should be located.

The area that is cleared of elements can be associated to one specific group node. This means that this group can grow because the free space must be created inside it. In consequence, all ancestor nodes of the group may grow, too. Other groups are treated as fixed and must be moved in order to avoid an overlap with the specified area.

If no group is specified, the free space will be created in the top-level hierarchy.

If multiple group nodes are provided, the first valid group is used. This can be useful when multiple components of the graph are handled independently, using e.g. ComponentLayout.

For many use cases it is suitable to define the innermost group that contains the center of the specified area as the area group node.
The area group is ignored if the area is defined by means of areaNodes. In that case the nearest common ancestor of the area nodes is automatically selected as the group node that contains the free space.
conversionfinal

Sample Graphs

ShownSetting: An input example with group nodes where the rectangular green area must be cleared.

See Also

API
AREA_GROUP_NODE_DATA_KEY
Gets or sets the collection of nodes that define the area which must be cleared.

These nodes define a sort of component from which the area that must be cleared is derived by calling method createAreaOutline This means that the area will exactly be defined by the current locations of these nodes (including the edges among them) such that after the algorithm execution there will not be any other elements intersecting with them.

Carefully observe that if group nodes are marked, all their descendants are treated as area nodes too. For example, if a folder node was expanded (and became a group node) then it suffices to only mark the group to get the effect that the area covered by it and all its descendants is cleared.

The areaGroupNode can not be defined manually, but the nearest common ancestor of all area nodes will become the area group node. For group nodes other than the area group either all their descendants including the group itself must be area nodes or all their descendants including the group must not be area nodes. If the input is not complete in this matter, the required nodes are internally automatically treated as area nodes too.

Defining the area this way is useful if a subgraph was moved or newly inserted and the area where it is located should be cleared of any other elements.
If area nodes are defined, then the values of properties area and areaOutline are ignored.
The specified area nodes are ignored when defining an expandedNode.
conversionfinal

Sample Graphs

ShownSetting: Input where the three selected nodes are the area nodes that should be inserted in an existing layout and would currently overlap with other elements.

See Also

Developer's Guide
API
AREA_NODES_DATA_KEY
Gets or sets the mapping from nodes to an object defining their component id.
Nodes of the same component should preferably not be separated. While the algorithm may move a whole component, it should try to not move only a subset of its elements. This means that the algorithm tries to move all elements of a component by the same offset (if at all). In order to achieve good results with this feature, the different components should not overlap in the initial drawing.
If custom components are specified, the componentAssignmentStrategy will be ignored. Furthermore, the components feature is only supported by clearing strategies PRESERVE_SHAPES, PRESERVE_SHAPES_UNIFORM and GLOBAL.
If the input graph contains group nodes or a LayoutGrid structure, maintaining the specified components is not always possible. Furthermore, a custom component can never pass the border of a group node or layout grid cell, i.e., all nodes of a custom component have to be associated with the same group or grid cell.
conversionfinal

See Also

API
COMPONENT_ID_DATA_KEY, componentAssignmentStrategy
Gets or sets the node that was expanded and, thus, defines the area that must be cleared.

When an expanded node is provided, the area that must be cleared is directly derived from the size of the expanded node. Defining an expanded node is intended for the case that a node's size increased such that it might now overlap with other graph elements. This includes the use case of expanding a folder node.

It is strongly recommended to additionally provide the original (smaller) bounds of the expanded node via property expandedNodeOriginalBounds. If the node has incident edges, it is also recommended to provide the original paths of these edges via expandedNodeOriginalEdgePaths. The original paths are the edge paths before the size of the node was changed (for example, before expanding a folder node). This includes paths of edges that were only incident to the non-expanded node and are now incident to descendants of it. Using this knowledge the algorithm clears the area occupied by the expanded node but also considers how the layout looked before the change. This way the mental map may be preserved to a higher degree.

If multiple nodes are provided, the first valid node is used. This can be useful when multiple components of the graph are handled independently, using e.g. ComponentLayout.

If an expanded node is specified, the areaNodes are ignored.
conversionfinal

See Also

Developer's Guide
API
expandedNodeOriginalBounds, expandedNodeOriginalEdgePaths, EXPANDED_NODE_DATA_KEY
Gets or sets the original, non-expanded bounds of the expandedNode.
When an expanded node is provided, the area that must be cleared is directly derived from the bounds of the expanded node. The original, non-expanded (smaller) bounds of the expanded node are helpful to preserve the mental map of the overall drawing to a higher degree than without the additional knowledge about the previous layout. Note, however, that only strategies PRESERVE_SHAPES, PRESERVE_SHAPES_UNIFORM and GLOBAL will significantly profit from it.
conversionfinal

See Also

Developer's Guide
API
expandedNode, expandedNodeOriginalEdgePaths, EXPANDED_NODE_ORIGINAL_BOUNDS_DATA_KEY
Gets or sets the mapping from edges adjacent to the expandedNode to their original edge paths, that is, their paths before the node was expanded.

When an expanded node is provided, the area that must be cleared is directly derived from the bounds of the expanded node. The original paths together with the original, non-expanded (smaller) bounds (expandedNodeOriginalBounds) of the expanded node are helpful to preserve the mental map of the overall drawing by providing knowledge about the previous layout state. Note, however, that only strategies PRESERVE_SHAPES, PRESERVE_SHAPES_UNIFORM and GLOBAL will significantly profit from it.

Carefully observe that the original paths must correspond to the ones that were valid when the expanded node still had its original, non-expanded bounds. Thus, they should only be provided when the original bounds are provided too. Also note that it is recommended that this mapping includes edges that are not adjacent to the expanded node anymore but were adjacent when it was in non-expanded state.

An edge path consists of the location of the source port, followed by the locations of the bends, followed by the location of the target port as returned by pathPoints.
conversionfinal

See Also

Developer's Guide
API
expandedNode, expandedNodeOriginalBounds, EXPANDED_NODE_ORIGINAL_EDGE_PATH_DATA_KEY
Gets or sets the LayoutGrid layout data.
final
Gets or sets the mapping from nodes to their margins.
Node margins allow to reserve space around nodes.
conversionfinal

Examples

The easiest option is to reserve the same space around all nodes, by setting a constant value:

Using constant space around all nodes
layoutData.nodeMargins = new Insets(20)

Handling only certain nodes differently can be done easily by using the mapper property:

Using a mapper to set margins for certain nodes
// node1 only reserves space above and below
layoutData.nodeMargins.mapper.set(node1, new Insets(20, 10, 0, 0))
// node2 has space all around
layoutData.nodeMargins.mapper.set(node2, new Insets(25))
// all other nodes don't get extra space

In cases where the nodeMargins for each node can be determined by looking at the node itself it's often easier to just set a mapperFunction instead of preparing a mapper:

Using a delegate to determine margins for all nodes
// Retrieve the space around the node from its tag property
layoutData.nodeMargins = (node: INode): Insets =>
  new Insets(parseFloat(node.tag))

See Also

API
NODE_MARGIN_DATA_KEY
Gets or sets the sub-data that provides a way of influencing the placement of the ports.

The port placement can be influenced by specifying EdgePortCandidates for the source and target of an edge, as well as by specifying NodePortCandidates at the nodes.

If both EdgePortCandidates and NodePortCandidates are specified, the layout algorithm tries to match them. The exact procedure depends on the specified edgeRouter.

In addition, it is possible to specify that ports should be grouped at the source or target.

The ClearAreaLayout considers port grouping information only during the rerouting of edges using the specified edgeRouter. The applied routing algorithm must support port grouping for port group IDs to have an effect. Furthermore, if edges are not altered by the ClearAreaLayout and not port-grouped in the input layout, then they will not be changed only to satisfy the port grouping.

Port placements constraints have no effect if fixPorts is enabled.
final
Gets or sets a mapping from edges to an object representing their source edge group.

Edges sharing a source group identifier share a common bus near the source or at a common source node.

The ClearAreaLayout considers edge grouping information only during the rerouting of edges using the specified edgeRouter. The applied routing algorithm must support edge grouping for this property to have an effect. Furthermore, if edges are not altered by ClearAreaLayout and not grouped in the input layout, then they will not be changed only to satisfy the edge grouping.

conversionfinal

See Also

API
SOURCE_EDGE_GROUP_ID_DATA_KEY
Gets or sets a mapping from edges to an object representing their target edge group.

Edges sharing a target group identifier share a common bus near the target or at a common target node.

The ClearAreaLayout considers edge grouping information only during the rerouting of edges using the specified edgeRouter. The applied routing algorithm must support edge grouping for this property to have an effect. Furthermore, if edges are not altered by ClearAreaLayout and not grouped in the input layout, then they will not be changed only to satisfy the edge grouping.

conversionfinal

See Also

API
TARGET_EDGE_GROUP_ID_DATA_KEY

Methods

Combines this instance with the given layout data.
This keeps the current instance unmodified and instead returns a new instance that dynamically combines the contents of all involved instances.
final

Parameters

data: LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>
The LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel> to combine this instance with.

Return Value

LayoutData<TNode, TEdge, TNodeLabel, TEdgeLabel>
The combined layout data.

See Also

Developer's Guide
API
CompositeLayoutData, GenericLayoutData