C

EdgeRouterScopeData<TNode, TEdge, TNodeLabel, TEdgeLabel>

This custom data provides several ways to modify the scope of the EdgeRouter with regard to the routed edges.
Inheritance Hierarchy

Remarks

The routed edges can be specified using the ItemCollection properties edges and incidentNodes. Any edges, or edges incident to the nodes in those collections, are considered to be in scope by the EdgeRouter. The Item Mapping properties edgeMapping and incidentNodeMapping can be used to specify a more differentiated EdgeRouterScope for (incident) edges.

When multiple scope properties are specified for the same edge, the most permissive property is prioritized, meaning PATH is always prioritized over PATH_AS_NEEDED, which is more permissive than SEGMENTS_AS_NEEDED. IGNORE is assigned to an edge if and only if no other property is specified.

This class cannot be instantiated

Type Parameters

TNode

TEdge

TNodeLabel

TEdgeLabel

See Also

Developer's Guide

Members

Show:

Properties

Gets or sets a mapping from edges to a value describing the edges' behavior with respect to the scope.
conversionfinal

Examples

Specifying a constant scope policy for all edges is the simplest option:

Setting a constant scope policy
scopeData.edgeMapping = EdgeRouterScope.PATH_AS_NEEDED

Additionally, specifying different policies for affected edges can be accomplished by using the mapper property to set an existing mapping from edges to policies:

Using a mapper to set different scope policies
scopeData.edgeMapping = scopePolicyMapper

Finally, in cases where the scope policy can be determined by looking at the edge itself it's often easier to set a delegate instead of preparing a mapper:

Using a delegate to set different scope policies
scopeData.edgeMapping = (edge) => {
  if (edge === edge1) {
    //edge1 is always routed
    return EdgeRouterScope.PATH
  }
  if (edge === edge2) {
    //edge2 is only routed if necessary
    return EdgeRouterScope.PATH_AS_NEEDED
  }
  if (edge === edge3) {
    //only segments of edge3 are routed if necessary
    return EdgeRouterScope.SEGMENTS_AS_NEEDED
  }
  //other edges are not affected
  return EdgeRouterScope.IGNORE
}

See Also

Developer's Guide
A collection of edges that should be considered to be in scope, that is, routed by EdgeRouter.
conversionfinal

Examples

The affected edges can be specified using the items property when only a few known edges should be affected:

Setting edges as affected individually
scopeData.edges.items.add(edge1)
scopeData.edges.items.add(edge2)

It's also possible to pass an existing collection of affected edges:

Setting a collection of affected edges
scopeData.edges = graphComponent.selection.edges

In cases where looking at the edge itself is sufficient to determine whether an edge is in scope, it's often easier to just set a delegate instead:

Using a delegate to set edges as affected
// We assume here that all edges have a CustomData instance as their tag,
// which then has a boolean property 'IncludeInLayout'.
scopeData.edges = (edge) => (edge.tag as CustomData).includeInLayout

See Also

Developer's Guide
Gets or sets a mapping from nodes to a value describing their incident edges with respect to the scope.
conversionfinal

Examples

Specifying a constant scope policy for all edges is the simplest option:

Using a constant scope policy
scopeData.incidentNodeMapping = EdgeRouterScope.PATH_AS_NEEDED

Additionally, specifying different policies for edges incident to affected nodes can be accomplished by using the mapper property to set an existing mapping from nodes to policies:

Using a mapper to set different scope policies
scopeData.incidentNodeMapping = scopePolicyMapper

Finally, in cases where the scope policy can be determined by looking at the node itself it's often easier to set a delegate instead of preparing a mapper:

Using a delegate to set different scope policies
scopeData.incidentNodeMapping = (node: INode) => {
  if (node == node1) {
    //edges incident to node1 are always routed
    return EdgeRouterScope.PATH
  }
  if (node == node2) {
    //edges incident to node2 are only routed if necessary
    return EdgeRouterScope.PATH_AS_NEEDED
  }
  if (node == node3) {
    //only segments of edges incident to node3 are routed if necessary
    return EdgeRouterScope.SEGMENTS_AS_NEEDED
  }
  //edges incident to other nodes are not affected
  return EdgeRouterScope.IGNORE
}

See Also

Developer's Guide
A collection of nodes whose incident edges should be considered in scope, that is, routed by EdgeRouter.
conversionfinal

Examples

The incident nodes can be specified using the items property when only the edges of a few known nodes should be affected:

Setting incident nodes as affected individually
scopeData.incidentNodes.items.add(node1)
scopeData.incidentNodes.items.add(node2)

It's also possible to pass an existing collection of incident nodes:

Setting a collection of incident nodes
scopeData.incidentNodes = graphComponent.selection.nodes

In cases where looking at the node itself is sufficient to determine whether its incident edges are in scope, it's often easier to just set a delegate instead:

Using a delegate to set incident nodes as affected
// We assume here that all nodes have a CustomData instance as their tag,
// which then has a boolean property 'IncludeInLayout'.
scopeData.incidentNodes = (node) =>
  (node.tag as CustomData).includeInLayout

See Also

Developer's Guide

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