This layout stage replaces edges by a path of split-edges with a specified length before it calls a core layout algorithm.
Remarks
Concept
Each edge segment (or only segments that belong to a particular subset of edges) in the input graph will be split up into several segments such that all segments have a maximum length defined by the specified split segment length. If an edge segment is already shorter than the split segment length, then it will not be split up.
At each split location, a dummy node (the so-called split-node) will be inserted. Split-nodes inserted for the same original edge and the actual source and target node of the original edge will be connected by so called split-edges. In consequence, the original source and target node are not connected by a single edge but by a path consisting of split-edges. Furthermore, all edges are simple straight lines.
After this replacement step, the core layout algorithm will be invoked.
When the core layout algorithm has finished, the split-nodes will be removed from the graph and the original edge will be restored. The coordinates of the bends will be the center-coordinates of the corresponding split-node.
Features
The IDataProvider registered with key splitNodesDpKey can be used by the core layout algorithm to determine whether or not a certain node is a split-node that was created by this stage. This information may be useful when providing a custom core layout algorithm which should handle split-nodes in a different way than normal nodes. If no IDataProvider is registered with this key, this information is dropped.
By registering a IDataProvider with key affectedEdgesDpKey, the subset of edges that should be split by this layout stage can be specified. If no IDataProvider with this key is registered, all edges of the input graph will be split by the layout stage.
The amount of split-nodes replacing a single original edge can be controlled via the split segment length. The smaller the value, the more split-nodes this stage will insert.
Default Values of Properties
affectedEdgesDpKey | AFFECTED_EDGES_DP_KEY
| |
splitNodesDpKey | AFFECTED_NODES_DP_KEY
| |
splitNodeSize | 1.0 | |
splitSegmentLength | 100 |
Type Details
- yfiles module
- layout-organic
- yfiles-umd modules
- layout-multipage, layout-organic, layout
- Legacy UMD name
- yfiles.organic.SplitEdgeStage
Constructors
Creates a new SplitEdgeStage with default settings.
Parameters
A map of options to pass to the method.
- affectedEdgesDpKey - Object
The IDataProvider key to determine which edges are to be split by this layout stage. This option sets the affectedEdgesDpKey property on the created object.
- splitNodesDpKey - Object
The IDataProvider key for marking the nodes that were created by splitting edges, i.e., the split-nodes. This option sets the splitNodesDpKey property on the created object.
- splitSegmentLength - number
The maximum length for a split-edge. This option sets the splitSegmentLength property on the created object.
- splitNodeSize - number
The size of the split-nodes that are inserted when splitting edges. This option sets the splitNodeSize property on the created object.
- coreLayout - ILayoutAlgorithm
The core layout algorithm. This option sets the coreLayout property on the created object.
Properties
Gets or sets the IDataProvider key to determine which edges are to be split by this layout stage.
Remarks
Default Value
AFFECTED_EDGES_DP_KEY.Throws
- Exception({ name: 'ArgumentError' })
- if the specified key is
null
Gets or sets the core layout algorithm.
Remarks
See Also
Implements
Gets or sets the IDataProvider key for marking the nodes that were created by splitting edges, i.e., the split-nodes.
Remarks
Default Value
AFFECTED_NODES_DP_KEY.Throws
- Exception({ name: 'ArgumentError' })
- if the specified key is
null
Gets or sets the size of the split-nodes that are inserted when splitting edges.
Remarks
Default Value
1.0
.Throws
- Exception({ name: 'ArgumentError' })
- if the given size is negative
Gets or sets the maximum length for a split-edge.
Remarks
The length of the original edge path divided by the given split segment length yields the number of nodes on the new path.
The split segment length must be a strictly positive value.
Default Value
100
.Throws
- Exception({ name: 'ArgumentError' })
- if the given split segment length is smaller than or equal to zero
Methods
Replaces the edges of the given graph by a path of split-edges, executes the core layout algorithm and restores the original edges, introducing bends at the locations of the split-nodes.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph