Finds all intersections between nodes, edges and labels.
Remarks
It provides means to limit the algorithm to a specific graph subset or to only consider certain item types or specific items.
The IntersectionsResult computed by this algorithm contains pairwise intersections, i.e. each Intersection object is an intersection/overlap between two graph items.
Note that if two elements "touch" in a single coordinate, this is considered as an intersection as well. For example, two nodes directly next to each other where the right border of the left node is on the same coordinate as the left border of the right node. The Intersection, in consequence, contains only two points. Testing for the number of points is a way to manually filter and ignore these kind of intersection results.
Examples
Type Details
- yfiles module
- view-layout-bridge
- yfiles-umd modules
- view-layout-bridge
- Legacy UMD name
- yfiles.analysis.Intersections
See Also
Constructors
Creates a new Intersections instance with default settings.
Parameters
A map of options to pass to the method.
- independentItems - GraphItemTypes
The type of items that are considered independently of their owning element when calculating the IntersectionsResult. This option sets the independentItems property on the created object.
- considerItemGeometry - boolean
Whether the intersections are based on the actual geometry of the items defined by their visualization or by simplified rectangular bounds for nodes, oriented rectangular bounds for labels and line segments for edges. This option sets the considerItemGeometry property on the created object.
- consideredItemTypes - IntersectionItemTypes
The graph item types that are taken into consideration when calculating the intersections. This option sets the consideredItemTypes property on the created object.
- affectedItems - ItemCollection<IModelItem>
The graph items that must be involved in each intersection. This option sets the affectedItems property on the created object.
- subgraphNodes - ItemCollection<INode>
The collection of nodes which define a subset of the graph for the algorithms to work on. This option sets the subgraphNodes property on the created object.
- subgraphEdges - ItemCollection<IEdge>
The collection of edges which define a subset of the graph for the algorithms to work on. This option sets the subgraphEdges property on the created object.
Properties
Gets or sets the graph items that must be involved in each intersection.
Remarks
Examples
See Also
Gets or sets the graph item types that are taken into consideration when calculating the intersections.
Remarks
Internally, port labels are represented as NODE_LABEL, so when looking for intersections with port labels, use either ALL, NODE_LABEL or LABEL.
Default is ALL.
See Also
Gets or sets whether the intersections are based on the actual geometry of the items defined by their visualization or by simplified rectangular bounds for nodes, oriented rectangular bounds for labels and line segments for edges.
Remarks
If enabled, the IShapeGeometry of a nodes and the IPathGeometry of edge paths are queried and it is tested if their outline paths actually intersect. The resulting intersectionPoints are, however, still based on the bounding boxes. Note that by default the edge path is cropped at the node's outline. If the edge has an arrow at this point, the edge is also shortened by the length of the arrow. In this case the algorithm does not find an intersection between the edge and the node.
For labels, in any case an oriented rectangular bound is used to detect intersections.
Default is true
.
See Also
Gets or sets the type of items that are considered independently of their owning element when calculating the IntersectionsResult.
Remarks
The default value is NONE. This means that intersections between depending items are omitted in the IntersectionsResult and only intersections between unrelated items are reported.
Item dependency is defined as follows: Labels depend on their owner, edges depend on their source/target node, and for grouped graphs the node's grouping hierarchy is considered.
Examples
See Also
Gets or sets the collection of edges which define a subset of the graph for the algorithms to work on.
Remarks
If nothing is set, all edges of the graph will be processed.
If only the excludes are set all edges in the graph except those provided in the excludes are processed.
Note that edges which start or end at nodes which are not in the subgraphNodes are automatically not considered by the algorithm.
ItemCollection<T> instances may be shared among algorithm instances and will be (re-)evaluated upon (re-)execution of the algorithm.
Examples
See Also
Gets or sets the collection of nodes which define a subset of the graph for the algorithms to work on.
Remarks
If nothing is set, all nodes of the graph will be processed.
If only the excludes are set all nodes in the graph except those provided in the excludes are processed.
ItemCollection<T> instances may be shared among algorithm instances and will be (re-)evaluated upon (re-)execution of the algorithm.
Examples
See Also
Methods
Calculates intersections between the items for the given graph.
Parameters
A map of options to pass to the method.
- graph - IGraph
- The input graph to run the algorithm on.
Returns
- ↪IntersectionsResult
- A IntersectionsResult containing the intersections.
Throws
- Exception({ name: 'InvalidOperationError' })
- If the algorithm can't create a valid result due to an invalid graph structure or wrongly configured properties.