This custom data provides two item collections to specify the scope of layout algorithms with regard to edges.
Remarks
The two collections can be used in combination with each other. In this case they are combined permissively, that is if e.g. an edge is not contained in the collection edges but one of its incident nodes is contained in the collection incidentNodes, the edge is considered to be in scope.
This class cannot be instantiated
Type Parameters
- TNode
- TEdge
- TNodeLabel
- TEdgeLabel
- TEdgeScope
Type Details
- yFiles module
- algorithms
Properties
A collection of edges that should be considered to be in scope by layout algorithms that allow restricting the edges affected by them.
Examples
The affected edges can be specified using the items property when only a few known edges should be affected:
scopeData.edges.items.add(edge1)
scopeData.edges.items.add(edge2)
It's also possible to pass an existing 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:
// 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
A collection of nodes whose incident edges should be considered to be in scope by layout algorithms that allow restricting the edges affected by them.
Examples
The incident nodes can be specified using the items property when only the edges of a few known nodes should be affected:
scopeData.incidentNodes.items.add(node1)
scopeData.incidentNodes.items.add(node2)
It's also possible to pass an existing 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:
// 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
Methods
combineWith
(data: LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel>…) : LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel>Combines this instance with the given layout data.
Remarks
Parameters
A map of options to pass to the method.
- data - LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel>
- The LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel> to combine this instance with.
Returns
- ↪LayoutData<TNode,TEdge,TNodeLabel,TEdgeLabel>
- The combined layout data.