Package | com.yworks.yfiles.layout.router |
Class | public class OrthogonalPatternEdgeRouter |
Inheritance | OrthogonalPatternEdgeRouter AbstractLayoutStage YObject Object |
The edge router will not try to find a perfect route from source to edge like OrthogonalEdgeRouter does, but chooses the best path out of several fixed paths it can choose from. The best path out of these possible paths is determined by its cost. One can take influence on the costs by setting several cost factors. The distance, an edge will have from its source and target node is determined by setMinimumDistance(double).
The edges whose paths are to be routed can be defined using method setSphereOfAction(byte) or binding a data provider to the input graph with key com.yworks.yfiles.layout.router.ChannelEdgeRouter.AFFECTED_EDGES. Note: If the DataProvider is registered on the graph, it will determine all affected edges, regardless of the set sphere of action. So setting a sphere of action has lower priority than adding the specific DataProvider directly.
By default all edges are routed according to their best paths and afterwards overlapping edges will be redistributed. This can be prevented by calling method setDistributeEdgesEnabled(boolean).
ChannelEdgeRouter does also support grid routing setGridRoutingEnabled(boolean).Therefore the user can define the grid origin setGridOrigin(y.geom.YPoint) and the grid width setGridWidth(double).
This edge router will obey strong and weak port constraints. It expects the port constraints to be bound to the input graph by the data provider keys com.yworks.yfiles.layout.PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY and com.yworks.yfiles.layout.PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY . Furthermore, this class supports the more advanced port constraint concept of com.yworks.yfiles.layout.PortCandidate s. It expects collections of port candidates to be bound to the input graph by the data provider keys com.yworks.yfiles.layout.PortCandidate.SOURCE_PCLIST_DPKEY and com.yworks.yfiles.layout.PortCandidate.TARGET_PCLIST_DPKEY.
See also
Property | Defined By | ||
---|---|---|---|
affectedEdgesDpKey : Object
Specifies the DataProvider key, which determines the edges, that shall be routed by the algorithm. | OrthogonalPatternEdgeRouter | ||
bendCost : Number
Specifies the edge cost a bend inside an edge's path will cause. | OrthogonalPatternEdgeRouter | ||
coreLayouter : Layouter
Specifies the core layouter. | AbstractLayoutStage | ||
edgeCrossingCost : Number
Specifies the edge cost an edge crossing will cause. | OrthogonalPatternEdgeRouter | ||
edgeOverlapCost : Number
Specifies the cost an edge overlap will cause. | OrthogonalPatternEdgeRouter | ||
gridOrigin : YPoint
Getter:
Returns the origin of the grid, which is used for grid routing if enabled. | OrthogonalPatternEdgeRouter | ||
gridRoutingEnabled : Boolean
Getter:
Returns whether or not grid routing is enabled. | OrthogonalPatternEdgeRouter | ||
gridWidth : Number
Getter:
Returns the grid width, that defines the space between two grid lines. | OrthogonalPatternEdgeRouter | ||
minimumDistance : Number
Specifies the minimum distance an edge will have to its source and target node. | OrthogonalPatternEdgeRouter | ||
monotonicPathRestriction : int
Getter:
Returns the specified kind of monotonic path restrictions. | OrthogonalPatternEdgeRouter | ||
nodeCrossingCost : Number
Specifies the node cost an edge node overlap will cause. | OrthogonalPatternEdgeRouter |
Method | Defined By | ||
---|---|---|---|
OrthogonalPatternEdgeRouter(init:Boolean = true) | OrthogonalPatternEdgeRouter | ||
canLayout(graph:LayoutGraph):Boolean [override] | OrthogonalPatternEdgeRouter | ||
doLayout(graph:LayoutGraph):void [override] | OrthogonalPatternEdgeRouter | ||
equals(o:Object):Boolean | YObject | ||
getClass():Class [override] | OrthogonalPatternEdgeRouter | ||
hashCode():int | YObject | ||
[static] | OrthogonalPatternEdgeRouter |
Method | Defined By | ||
---|---|---|---|
Calculates the costs for all bends of the given path by simple multiplying all bends with the bend costs (bendCost). | OrthogonalPatternEdgeRouter | ||
Calculates the edge cost of a possible edge path, to determine which path is the best (cheapest). | OrthogonalPatternEdgeRouter | ||
Calculates the overall crossing costs of the given path including edge crossings, edge overlaps and node crossings. | OrthogonalPatternEdgeRouter | ||
Calculates the costs for the length of the given path. | OrthogonalPatternEdgeRouter | ||
Calculates the costs for the chosen ports. | OrthogonalPatternEdgeRouter | ||
calculateSelfLoopSelfSidePenaltyCost(edge:Edge, path:YList, spc:PortCandidate, tpc:PortCandidate):Number
Calculates the extra penalty that is added to the paths cost if the edge is a selfloop and source and target ports have the same direction. | OrthogonalPatternEdgeRouter | ||
canLayoutCore(graph:LayoutGraph):Boolean
Queries the core layouter whether or not the given graph can be laid out. | AbstractLayoutStage | ||
checkGroupNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given group node object is zero. | OrthogonalPatternEdgeRouter | ||
checkNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given node object is zero. | OrthogonalPatternEdgeRouter | ||
doLayoutCore(graph:LayoutGraph):void
Invokes the layout routine of the core layouter. | AbstractLayoutStage | ||
initAbstractLayoutStage1():void | AbstractLayoutStage | ||
initAbstractLayoutStage2(core:Layouter):void | AbstractLayoutStage | ||
Initializes this object. | OrthogonalPatternEdgeRouter |
Constant | Defined By | ||
---|---|---|---|
AFFECTED_EDGES : Object = y.layout.router.OrthogonalPatternEdgeRouter.AFFECTED_EDGES [static]
DataProvider key that can be used to determine which edges the edge router will route. | OrthogonalPatternEdgeRouter | ||
MONOTONIC_BOTH : int = 3 [static]
Constant that specifies monotonic path restrictions for edges. | OrthogonalPatternEdgeRouter | ||
MONOTONIC_HORIZONTAL : int = 2 [static]
Constant that specifies monotonic path restrictions for edges. | OrthogonalPatternEdgeRouter | ||
MONOTONIC_NONE : int = 0 [static]
Constant that specifies monotonic path restrictions for edges. | OrthogonalPatternEdgeRouter | ||
MONOTONIC_VERTICAL : int = 1 [static]
Constant that specifies monotonic path restrictions for edges. | OrthogonalPatternEdgeRouter |
affectedEdgesDpKey | property |
affectedEdgesDpKey:Object
Specifies the DataProvider
key, which determines the edges, that shall be routed by the algorithm.
By default, AFFECTED_EDGES is used.
public function get affectedEdgesDpKey():Object
public function set affectedEdgesDpKey(value:Object):void
See also
bendCost | property |
bendCost:Number
Specifies the edge cost a bend inside an edge's path will cause. Used to find the best path out of the predefined paths the router can choose from. Default value is 1.
public function get bendCost():Number
public function set bendCost(value:Number):void
edgeCrossingCost | property |
edgeCrossingCost:Number
Specifies the edge cost an edge crossing will cause. Used to find the best path out of the predefined paths the router can choose from. Default value is 5.
public function get edgeCrossingCost():Number
public function set edgeCrossingCost(value:Number):void
edgeOverlapCost | property |
edgeOverlapCost:Number
Specifies the cost an edge overlap will cause. By default this edge router is used in conjunction with a segment distribution stage like com.yworks.yfiles.layout.router.OrthogonalSegmentDistributionStage, so edge overlaps are wanted and thus should not cause any costs. Default value is therefore 0. If this edge router is used stand-alone, one can determine a higher cost to prevent edge overlaps.
public function get edgeOverlapCost():Number
public function set edgeOverlapCost(value:Number):void
See also
gridOrigin | property |
gridOrigin:YPoint
Getter: Returns the origin of the grid, which is used for grid routing if enabled. com.yworks.yfiles.layout.router.OrthogonalPatternEdgeRouter.gridRoutingEnabled . Default origin is at x = 0, y = 0
Setter: Sets the origin of the grid. Takes effect if grid routing is enabled com.yworks.yfiles.layout.router.OrthogonalPatternEdgeRouter.gridRoutingEnabled. Note that grid routing has lower priority than the minimum Distance setting minimumDistance. Thus it is possible that edges are not routed on the grid if there is not enough space between two borders. Default origin is at x = 0, y = 0 public function get gridOrigin():YPoint
public function set gridOrigin(value:YPoint):void
See also
gridRoutingEnabled | property |
gridRoutingEnabled:Boolean
Getter: Returns whether or not grid routing is enabled. By default grid routing is not enabled.
Setter: Specifies whether or not to use grid routing. Grid routing means edges are routed on a grid's lines only. The grid can be defined using method gridOrigin and gridWidth . Note that grid routing has lower priority than the minimum Distance setting minimumDistance . Thus it is possible that edges are not routed on the grid if there is not enough space between two borders.Also, the edges source and target ports are not reassigned if they have fixed coordinates. Therefore, the first and last segments of an edge might not be routed on the grid. Use weak ports or assign coordinates that already lie on the grid for these ports, if grid routing is wanted.
By default grid routing is not enabled. public function get gridRoutingEnabled():Boolean
public function set gridRoutingEnabled(value:Boolean):void
See also
gridWidth | property |
gridWidth:Number
Getter: Returns the grid width, that defines the space between two grid lines.
Default value is 10.0
Default value is 10.0
.
public function get gridWidth():Number
public function set gridWidth(value:Number):void
IllegalArgumentException — if the specified grid width is less than 2 .
|
See also
minimumDistance | property |
minimumDistance:Number
Specifies the minimum distance an edge will have to its source and target node. Default value is 10.0.
public function get minimumDistance():Number
public function set minimumDistance(value:Number):void
monotonicPathRestriction | property |
monotonicPathRestriction:int
Getter: Returns the specified kind of monotonic path restrictions.
Setter: Specifies which kind of monotonic path restrictions should be applied. Possible values are MONOTONIC_NONE, MONOTONIC_VERTICAL, MONOTONIC_HORIZONTAL and MONOTONIC_BOTH. public function get monotonicPathRestriction():int
public function set monotonicPathRestriction(value:int):void
See also
nodeCrossingCost | property |
nodeCrossingCost:Number
Specifies the node cost an edge node overlap will cause. Used to find the best path out of the predefined paths the router can choose from. Default value is 50.
public function get nodeCrossingCost():Number
public function set nodeCrossingCost(value:Number):void
OrthogonalPatternEdgeRouter | () | Constructor |
public function OrthogonalPatternEdgeRouter(init:Boolean = true)
Parameters
init:Boolean (default = true ) — An internally used switch to help handle proper instance initialization in inheritance chains where classes can have multiple constructor-like factory methods.
This parameter can safely be ignored/omitted when calling the constructor.
|
calculateBendCost | () | method |
protected function calculateBendCost(edge:Edge, path:YList, spc:PortCandidate, tpc:PortCandidate):Number
Calculates the costs for all bends of the given path by simple multiplying all bends with the bend costs (bendCost).
Note: Only bends are taken into account, not the source and target ports, that are also part of the given path.
Parameters
edge:Edge — the edge the penalty is calculated for.
| |
path:YList — the path this penalty is calculated for.
| |
spc:PortCandidate — the used source PortCandidate for this path.
| |
tpc:PortCandidate — the used target PortCandidate for this path.
|
Number — the costs for all bends of this path
|
See also
calculateCost | () | method |
protected function calculateCost(edge:Edge, path:YList, spc:PortCandidate, tpc:PortCandidate):Number
Calculates the edge cost of a possible edge path, to determine which path is the best (cheapest).
Parameters
edge:Edge — the edge whose cost to calculate.
| |
path:YList — the edge's path.
| |
spc:PortCandidate — the source port candidate chosen for this path.
| |
tpc:PortCandidate — the target port candidate chosen for this path.
|
Number — the sum of all costs for this edge's path
|
calculateCrossingCosts | () | method |
protected function calculateCrossingCosts(edge:Edge, path:YList, spc:PortCandidate, tpc:PortCandidate):Number
Calculates the overall crossing costs of the given path including edge crossings, edge overlaps and node crossings.
Parameters
edge:Edge — the edge the penalty is calculated for.
| |
path:YList — the path this penalty is calculated for.
| |
spc:PortCandidate — the used source PortCandidate for this path.
| |
tpc:PortCandidate — the used target PortCandidate for this path.
|
Number — the overall crossing costs of the given path including edge crossings, edge overlaps and node crossings.
|
calculateEdgeLength | () | method |
protected function calculateEdgeLength(edge:Edge, path:YList, spc:PortCandidate, tpc:PortCandidate):Number
Calculates the costs for the length of the given path. By default this cost is between 0 (short path) and 1 (long path) so this has very little impact on the overall costs.
Parameters
edge:Edge — the edge the penalty is calculated for.
| |
path:YList — the path this penalty is calculated for.
| |
spc:PortCandidate — the used source PortCandidate for this path.
| |
tpc:PortCandidate — the used target PortCandidate for this path.
|
Number — the length costs of the given path between 0 and 1
|
calculatePortCandidateCost | () | method |
protected function calculatePortCandidateCost(edge:Edge, path:YList, spc:PortCandidate, tpc:PortCandidate):Number
Calculates the costs for the chosen ports. By default these costs are determined from set port candidates. If no PortCandidates have been set on the given edge, the cost is 0. If PortConstraints have been set for this edge, the cost is also 0.
Parameters
edge:Edge — the edge the penalty is calculated for.
| |
path:YList — the path this penalty is calculated for.
| |
spc:PortCandidate — the used source PortCandidate for this path.
| |
tpc:PortCandidate — the used target PortCandidate for this path.
|
Number — the costs for all bends of this path
|
calculateSelfLoopSelfSidePenaltyCost | () | method |
protected function calculateSelfLoopSelfSidePenaltyCost(edge:Edge, path:YList, spc:PortCandidate, tpc:PortCandidate):Number
Calculates the extra penalty that is added to the paths cost if the edge is a selfloop and source and target ports have the same direction. By default this penalty is a bit more than adding another bend to the path so that patterns with different source and target directions are cheaper and thus preferred.
Parameters
edge:Edge — the edge the penalty is calculated for.
| |
path:YList — the path this penalty is calculated for.
| |
spc:PortCandidate — the used source PortCandidate for this path.
| |
tpc:PortCandidate — the used target PortCandidate for this path.
|
Number — an extra penalty for paths
|
canLayout | () | method |
override public function canLayout(graph:LayoutGraph):Boolean
Parameters
graph:LayoutGraph |
Boolean |
checkGroupNodeSize | () | method |
protected function checkGroupNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given group node object is zero. It is called by the doLayout() method for each group node object in the input graph.
Parameters
layout:GraphLayout — a graph layout object.
| |
node:Object — the group node object to test.
|
IllegalArgumentException — thrown if the width/height of the group node object is zero.
|
See also
checkNodeSize | () | method |
protected function checkNodeSize(layout:GraphLayout, node:Object):void
This method throws an com.yworks.bridge.util.IllegalArgumentException if the width/height of the given node object is zero. It is called by the doLayout() method for each node object in the input graph.
Parameters
layout:GraphLayout — a graph layout object.
| |
node:Object — the node object to test.
|
IllegalArgumentException — thrown if the width/height of the node object is zero.
|
See also
doLayout | () | method |
getClass | () | method |
override public function getClass():Class
ReturnsClass |
initOrthogonalPatternEdgeRouter | () | method |
protected final function initOrthogonalPatternEdgeRouter():void
Initializes this object. See the documentation of the corresponding factory method newOrthogonalPatternEdgeRouter()
for details.
See also
newOrthogonalPatternEdgeRouter | () | method |
public static function newOrthogonalPatternEdgeRouter():OrthogonalPatternEdgeRouter
ReturnsOrthogonalPatternEdgeRouter |
AFFECTED_EDGES | Constant |
public static const AFFECTED_EDGES:Object = y.layout.router.OrthogonalPatternEdgeRouter.AFFECTED_EDGES
DataProvider key that can be used to determine which edges the edge router will route.
MONOTONIC_BOTH | Constant |
public static const MONOTONIC_BOTH:int = 3
Constant that specifies monotonic path restrictions for edges. This constant specifies restrictions for the horizontal and vertical direction, i.e., each horizontal as well as each vertical edge segment is directed from the source to the target.
See also
MONOTONIC_HORIZONTAL | Constant |
public static const MONOTONIC_HORIZONTAL:int = 2
Constant that specifies monotonic path restrictions for edges. This constant specifies restrictions for the horizontal direction, i.e., each horizontal edge segment is directed from the source to the target. Furthermore, each edge path starts and ends with a horizontal segment.
See also
MONOTONIC_NONE | Constant |
public static const MONOTONIC_NONE:int = 0
Constant that specifies monotonic path restrictions for edges. This constant specifies that there are no restrictions.
See also
MONOTONIC_VERTICAL | Constant |
public static const MONOTONIC_VERTICAL:int = 1
Constant that specifies monotonic path restrictions for edges. This constant specifies restrictions for the vertical direction, i.e., each vertical edge segment is directed from the source to the target. Furthermore, each edge path starts and ends with a vertical segment.
See also