OrthogonalPatternEdgeRouter routes edges orthogonally such that the resulting layout of the edges consists only of vertical and horizontal segments.
Remarks
Note that the location and size of the nodes in a diagram remains unchanged.
The edge router will not try to find a perfect route from source to edge (unlike to what EdgeRouter does) but chooses the best path out of a set of fixed paths. The best path out of these possible paths is determined by its cost. The costs may be influenced by setting several cost factors. The distance that an edge will have from its source and target node is determined by minimumDistance.
The edges whose paths have to be routed can be defined registering a IDataProvider with key DEFAULT_AFFECTED_EDGES_DP_KEY.
Default Values of Properties
affectedEdgesDpKey | DEFAULT_AFFECTED_EDGES_DP_KEY
| |
bendCost | 1 | |
edgeCrossingCost | 5 | |
edgeOverlapCost | 0 | |
gridRouting | false | Edges are not routed on a grid. |
gridSpacing | 10.0 | |
minimumDistance | 10.0 | |
monotonicPathRestriction | NONE
| |
nodeCrossingCost | 50 |
Type Details
- yfiles module
- router-other
- yfiles-umd modules
- layout-familytree, layout-multipage, layout-orthogonal-compact, layout, router-bus, router-other
- Legacy UMD name
- yfiles.router.OrthogonalPatternEdgeRouter
See Also
Constructors
Creates a new instance of OrthogonalPatternEdgeRouter with default settings.
Parameters
A map of options to pass to the method.
- monotonicPathRestriction - MonotonicPathRestriction
The monotonic path restriction that should be applied. This option sets the monotonicPathRestriction property on the created object.
- affectedEdgesDpKey - Object
The key to register a IDataProvider which determines the edges that shall be routed by this algorithm. This option sets the affectedEdgesDpKey property on the created object.
- minimumDistance - number
The minimum distance that an edge will maintain from its source and target node. This option sets the minimumDistance property on the created object.
- gridSpacing - number
The spacing of the grid on which edges are routed. This option sets the gridSpacing property on the created object.
- gridOrigin - YPoint
The origin of the grid. This option sets the gridOrigin property on the created object.
- gridRouting - boolean
Whether or not to route the edges on a grid. This option sets the gridRouting property on the created object.
- edgeCrossingCost - number
The costs for a crossing between two edges. This option sets the edgeCrossingCost property on the created object.
- nodeCrossingCost - number
The costs for edges that cross nodes. This option sets the nodeCrossingCost property on the created object.
- bendCost - number
The costs for creating a bend on the edge's path. This option sets the bendCost property on the created object.
- edgeOverlapCost - number
The costs for overlapping edge paths. This option sets the edgeOverlapCost property on the created object.
- coreLayout - ILayoutAlgorithm
The core layout algorithm that is wrapped by this stage. This option sets the coreLayout property on the created object.
Properties
Gets or sets the key to register a IDataProvider which determines the edges that shall be routed by this algorithm.
Default Value
DEFAULT_AFFECTED_EDGES_DP_KEY.Throws
- Exception({ name: 'ArgumentError' })
- if the specified
key is null
Gets or sets the costs for creating a bend on the edge's path.
Remarks
These costs are used for finding the best path out of the predefined paths from which the router can choose.
The costs need to be non-negative.
Default Value
1
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified costs are negative
Gets or sets the core layout algorithm that is wrapped by this stage.
Gets or sets the costs for a crossing between two edges.
Remarks
These costs are used for finding the best path out of the predefined paths from which the router can choose.
The costs need to be non-negative.
Default Value
5
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified costs are negative
See Also
Gets or sets the costs for overlapping edge paths.
Remarks
These costs are used for finding the best path out of the predefined paths from which the router can choose.
The costs need to be non-negative.
Default Value
0
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified costs are negative
See Also
Gets or sets the origin of the grid.
Default Value
ORIGIN.Throws
- Exception({ name: 'ArgumentError' })
- if the specified point is
null
See Also
Gets or sets whether or not to route the edges on a grid.
Remarks
Default Value
false
.Edges are not routed on a grid.
See Also
Gets or sets the spacing of the grid on which edges are routed.
Remarks
2
.Default Value
10.0
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified grid spacing is less than
2
See Also
Gets or sets the minimum distance that an edge will maintain from its source and target node.
Remarks
Default Value
10.0
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified distance is negative
Gets or sets the costs for edges that cross nodes.
Remarks
These costs are used for finding the best path out of the predefined paths from which the router can choose.
The costs need to be non-negative.
Default Value
50
.Throws
- Exception({ name: 'ArgumentError' })
- if the specified costs are negative
See Also
Methods
Routes the edges of the given graph orthogonally.
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Implements
Invokes the layout process of the core layout algorithm.
Remarks
Parameters
A map of options to pass to the method.
- graph - LayoutGraph
- the input graph
See Also
Defined in
Calculates the costs for all bends of the given path.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge for which the costs are calculated
- path - YList
- the path of the given edge
- spc - PortCandidate
- the source PortCandidate for this edge
- tpc - PortCandidate
- the target PortCandidate for this edge
Returns
- ↪number
- the costs for the bends of this path
Calculates the edge cost of a possible edge path, in order to determine which path is the best, i.e., the cheapest.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge whose costs to calculate
- path - YList
- the edge's path
- spc - PortCandidate
- the source PortCandidate for this edge
- tpc - PortCandidate
- the target PortCandidate for this edge
Returns
- ↪number
- the sum of all costs for this edge's path
Calculates the overall crossing costs of the given path, including edge crossings, edge overlaps and node crossings.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge for which the costs are calculated
- path - YList
- the path of the given edge
- spc - PortCandidate
- the source PortCandidate for this edge
- tpc - PortCandidate
- the target PortCandidate for this edge
Returns
- ↪number
- the overall crossing costs of the given path, including edge crossings, edge overlaps and node crossings
Calculates the costs for the length of the given path.
Remarks
0
for short paths and 1
for long paths. Hence, it has relatively little impact on the overall costs. The method may be overridden to introduce a different weighting of the edge length.Parameters
A map of options to pass to the method.
- edge - Edge
- the edge for which the costs are calculated
- path - YList
- the path of the given edge
- spc - PortCandidate
- the source PortCandidate for this edge
- tpc - PortCandidate
- the target PortCandidate for this edge
Returns
- ↪number
- the costs for the length of the given path
calculatePortCandidateCost
(edge: Edge, path: YList, spc: PortCandidate, tpc: PortCandidate) : numberCalculates the costs for the chosen PortCandidates.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge for which the costs are calculated
- path - YList
- the path of the given edge
- spc - PortCandidate
- the source PortCandidate for this edge
- tpc - PortCandidate
- the target PortCandidate for this edge
Returns
- ↪number
- the costs for the PortCandidates
calculateSelfLoopSelfSidePenaltyCost
(edge: Edge, path: YList, spc: PortCandidate, tpc: PortCandidate) : numberCalculates the extra penalty that is added to the path's cost if the edge is a self-loop and source and target ports have the same direction.
Remarks
Parameters
A map of options to pass to the method.
- edge - Edge
- the edge for which the costs are calculated
- path - YList
- the path of the given edge
- spc - PortCandidate
- the source PortCandidate for this edge
- tpc - PortCandidate
- the target PortCandidate for this edge
Returns
- ↪number
- an extra penalty for specific self-loop paths
Checks the sizes of the nodes to be non-zero.
Constants
A data provider key for determining which edges are routed.