Packagecom.yworks.yfiles.layout.router
Classpublic class OrthogonalEdgeRouter
InheritanceOrthogonalEdgeRouter Inheritance AbstractLayoutStage Inheritance YObject Inheritance Object
Subclasses ChannelEdgeRouter_OrthogonalShortestPathPathFinder

This class represents an orthogonal edge router. An orthogonal edge router is a layout algorithm that changes the coordinates of the edge paths in a way that the resulting layout of the edges is made up of vertical and horizontal segments only. The router does not change the location or the size of the nodes in a diagram in any way.

Several LayoutStages can be used to enhance performance and/or functionality of this class, e.g. com.yworks.yfiles.layout.router.EdgeGroupRouterStage, com.yworks.yfiles.layout.router.GroupNodeRouterStage, com.yworks.yfiles.layout.router.ReducedSphereOfActionStage or com.yworks.yfiles.layout.router.PatchRouterStage.

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.

The router often finds ideal routes in difficult situations like the one depicted below.

See also

com.yworks.yfiles.layout.router.EdgeGroupRouterStage
com.yworks.yfiles.layout.router.GroupNodeRouterStage
com.yworks.yfiles.layout.router.ReducedSphereOfActionStage
com.yworks.yfiles.layout.router.PatchRouterStage
com.yworks.yfiles.layout.PortConstraintKeys.SOURCE_PORT_CONSTRAINT_KEY
com.yworks.yfiles.layout.PortConstraintKeys.TARGET_PORT_CONSTRAINT_KEY
com.yworks.yfiles.layout.PortCandidate
com.yworks.yfiles.layout.PortCandidate.SOURCE_PCLIST_DPKEY
com.yworks.yfiles.layout.PortCandidate.TARGET_PCLIST_DPKEY


Public Properties
 PropertyDefined By
  badOrthogonal : Boolean
Getter: Returns whether bad edges should be drawn in an orthogonal fashion.
OrthogonalEdgeRouter
  centerToSpaceRatio : Number
Getter: Returns the currently set ratio between the two complementary weighting strategies center driven and space driven.
OrthogonalEdgeRouter
  considerNodeLabels : Boolean
Specifies whether or not node labels are taken into account when calculating edge paths (thereby preventing possible edge/node label overlaps).
OrthogonalEdgeRouter
 InheritedcoreLayouter : Layouter
Specifies the core layouter.
AbstractLayoutStage
  coupledDistances : Boolean
Getter: Returns whether the minimum distances are coupled.
OrthogonalEdgeRouter
  crossingCost : Number
Specifies the cost for each edge crossing of a routed path.
OrthogonalEdgeRouter
  customBorderCapacity : int
Getter: Returns the currently set custom value for the capacity of the routing border around the graph's bounding box.
OrthogonalEdgeRouter
  enforceMonotonicPathRestrictions : Boolean
Getter: Returns whether monotonic path restrictions (set with monotonicPathRestriction) should be enforced.
OrthogonalEdgeRouter
  gridOrigin : YPoint
[read-only] Returns a grid point coordinate used when grid routing is enabled.
OrthogonalEdgeRouter
  gridRouting : Boolean
Specifies whether or not to route edge segments on grid lines.
OrthogonalEdgeRouter
  gridSpacing : int
Specifies the grid spacing that is used when grid routing is enabled.
OrthogonalEdgeRouter
  innerPorts : Boolean
Specifies whether edge ports (that do not have a strong port constraint set) should lie inside the node's bounding box or on the node's border.
OrthogonalEdgeRouter
  localCrossingMinimization : Boolean
Getter: Returns whether the local crossing minimization strategy is enabled.
OrthogonalEdgeRouter
  minimumDistance : int
Specifies the minimum distance between edge segments.
OrthogonalEdgeRouter
  minimumDistanceToNode : int
Specifies the minimum distance between edge segments and nodes.
OrthogonalEdgeRouter
  monotonicPathRestriction : int
Getter: Returns the specified kind of monotonic path restrictions.
OrthogonalEdgeRouter
  rerouting : Boolean
Getter: Returns whether rerouting bad edges is enabled.
OrthogonalEdgeRouter
  routingStyle : int
Getter: Returns the currently set routing style.
OrthogonalEdgeRouter
  selectedEdgesDpKey : Object
Specifies the DataProvider key to mark edges as selected.
OrthogonalEdgeRouter
  selectedNodesDpKey : Object
Specifies the DataProvider key to mark nodes as selected.
OrthogonalEdgeRouter
  sphereOfAction : int
Getter: Returns the currently set sphere of action specifier.
OrthogonalEdgeRouter
  useCustomBorderCapacity : Boolean
Getter: Returns whether a custom value for the capacity of the routing border is used.
OrthogonalEdgeRouter
Public Methods
 MethodDefined By
  
OrthogonalEdgeRouter(init:Boolean = true)
Creates a new instance of the Orthogonal Edge Router.
OrthogonalEdgeRouter
  
canLayout(graph:LayoutGraph):Boolean
[override] Returns true if the specified core layouter does, and also when there is no core layouter.
OrthogonalEdgeRouter
  
doLayout(graph:LayoutGraph):void
[override] Main entrance to orthogonal edge routing.
OrthogonalEdgeRouter
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
OrthogonalEdgeRouter
 Inherited
hashCode():int
YObject
  
[static] Creates a new instance of the Orthogonal Edge Router.
OrthogonalEdgeRouter
  
[static] Convenience constructor to simultaneously set a core layout algorithm which will run before the orthogonal edge router.
OrthogonalEdgeRouter
  
setGridOrigin(x:int, y:int):void
Sets a grid point coordinate used when grid routing is enabled.
OrthogonalEdgeRouter
Protected Methods
 MethodDefined By
 Inherited
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.
OrthogonalEdgeRouter
  
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.
OrthogonalEdgeRouter
 Inherited
Invokes the layout routine of the core layouter.
AbstractLayoutStage
 Inherited
AbstractLayoutStage
 Inherited
AbstractLayoutStage
  
Initializes this object.
OrthogonalEdgeRouter
  
Initializes this object.
OrthogonalEdgeRouter
Public Constants
 ConstantDefined By
  MONOTONIC_BOTH : int = 3
[static] Constant that specifies monotonic path restrictions for edges.
OrthogonalEdgeRouter
  MONOTONIC_HORIZONTAL : int = 2
[static] Constant that specifies monotonic path restrictions for edges.
OrthogonalEdgeRouter
  MONOTONIC_NONE : int = 0
[static] Constant that specifies monotonic path restrictions for edges.
OrthogonalEdgeRouter
  MONOTONIC_VERTICAL : int = 1
[static] Constant that specifies monotonic path restrictions for edges.
OrthogonalEdgeRouter
  ROUTE_ALL_EDGES : int = 0
[static] Sphere of action specifier.
OrthogonalEdgeRouter
  ROUTE_EDGES_AT_SELECTED_NODES : int = 4
[static] Sphere of action specifier.
OrthogonalEdgeRouter
  ROUTE_SELECTED_EDGES : int = 2
[static] Sphere of action specifier.
OrthogonalEdgeRouter
  STYLE_ADHOC : int
[static] Routing style specifier.
OrthogonalEdgeRouter
  STYLE_BALANCED : int
[static] Routing style specifier.
OrthogonalEdgeRouter
  STYLE_PREFERMIDDLE : int
[static] Routing style specifier.
OrthogonalEdgeRouter
  STYLE_SHORTPATH : int
[static] Routing style specifier.
OrthogonalEdgeRouter
Property Detail
badOrthogonalproperty
badOrthogonal:Boolean

Getter: Returns whether bad edges should be drawn in an orthogonal fashion.

Setter: Determines the way that edges which cannot be routed should be drawn. If set, edge paths are drawn in an orthogonal fashion. Otherwise the edge path is drawn as a straight line.

Default setting is true.


Implementation
    public function get badOrthogonal():Boolean
    public function set badOrthogonal(value:Boolean):void
centerToSpaceRatioproperty 
centerToSpaceRatio:Number

Getter: Returns the currently set ratio between the two complementary weighting strategies center driven and space driven.

Setter: Determines the ratio between two complementary weighting strategies, namely center driven and space driven weighting, when looking for an edge path.


Implementation
    public function get centerToSpaceRatio():Number
    public function set centerToSpaceRatio(value:Number):void
considerNodeLabelsproperty 
considerNodeLabels:Boolean

Specifies whether or not node labels are taken into account when calculating edge paths (thereby preventing possible edge/node label overlaps). The default is false.


Implementation
    public function get considerNodeLabels():Boolean
    public function set considerNodeLabels(value:Boolean):void
coupledDistancesproperty 
coupledDistances:Boolean

Getter: Returns whether the minimum distances are coupled.

Setter: Specifies whether or not the minimum distances should be coupled. I.e., whether half the value set for the minimum distance between edge segments should automatically be used as the minimum distance between edge segments and nodes, or a custom value should be used instead.

By default the minimum distances are coupled.


Implementation
    public function get coupledDistances():Boolean
    public function set coupledDistances(value:Boolean):void

See also

crossingCostproperty 
crossingCost:Number

Specifies the cost for each edge crossing of a routed path. A cost of n means that a path rather changes direction n times than crossing the path of an edge. By default the cost is set to 0 and therefore no global crossing optimization is performed. Setting a higher value will activate global crossing minimization. A good trade-off between the number of direction changes and few crossings of a path is achieved by values between 1 and 3.


Implementation
    public function get crossingCost():Number
    public function set crossingCost(value:Number):void
customBorderCapacityproperty 
customBorderCapacity:int

Getter: Returns the currently set custom value for the capacity of the routing border around the graph's bounding box.

Setter: Determines the custom value for the capacity of the routing border around the graph's bounding box. The routing border means the space left of the leftmost node, right of the rightmost node, above the topmost node, and below the bottommost node. By default this value is set to 5, i.e., the routing border accommodates up to 5 parallel edge paths left of the leftmost node, right of the rightmost node, etc.


Implementation
    public function get customBorderCapacity():int
    public function set customBorderCapacity(value:int):void
enforceMonotonicPathRestrictionsproperty 
enforceMonotonicPathRestrictions:Boolean

Getter: Returns whether monotonic path restrictions (set with monotonicPathRestriction) should be enforced.

Setter: Whether or not monotonic path restrictions (set with monotonicPathRestriction) should be enforced. Enabling this option guarantees monotonic edge paths even if this results in additional overlaps between edges and nodes.


Implementation
    public function get enforceMonotonicPathRestrictions():Boolean
    public function set enforceMonotonicPathRestrictions(value:Boolean):void

See also

gridOriginproperty 
gridOrigin:YPoint  [read-only]

Returns a grid point coordinate used when grid routing is enabled.


Implementation
    public function get gridOrigin():YPoint

See also

gridRoutingproperty 
gridRouting:Boolean

Specifies whether or not to route edge segments on grid lines. By default this feature is disabled, i.e., "free" routing is enabled.


Implementation
    public function get gridRouting():Boolean
    public function set gridRouting(value:Boolean):void

See also

gridSpacingproperty 
gridSpacing:int

Specifies the grid spacing that is used when grid routing is enabled. By default a spacing of 2 is set, which is also the minimum allowed spacing.


Implementation
    public function get gridSpacing():int
    public function set gridSpacing(value:int):void

See also

innerPortsproperty 
innerPorts:Boolean

Specifies whether edge ports (that do not have a strong port constraint set) should lie inside the node's bounding box or on the node's border. More specifically, "inside" means on the node's meridian for edges connecting to the left and right, and on the node's equator for edges connecting to the upper and lower side.

Default setting is false.


Implementation
    public function get innerPorts():Boolean
    public function set innerPorts(value:Boolean):void
localCrossingMinimizationproperty 
localCrossingMinimization:Boolean

Getter: Returns whether the local crossing minimization strategy is enabled.

Setter: Specifies whether or not a local crossing minimization strategy should be applied. By default this feature is enabled.


Implementation
    public function get localCrossingMinimization():Boolean
    public function set localCrossingMinimization(value:Boolean):void
minimumDistanceproperty 
minimumDistance:int

Specifies the minimum distance between edge segments. By default a distance of 4 is set, which is also the minimum allowed distance.


Implementation
    public function get minimumDistance():int
    public function set minimumDistance(value:int):void

See also

minimumDistanceToNodeproperty 
minimumDistanceToNode:int

Specifies the minimum distance between edge segments and nodes.


Implementation
    public function get minimumDistanceToNode():int
    public function set minimumDistanceToNode(value:int):void

See also

monotonicPathRestrictionproperty 
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.


Implementation
    public function get monotonicPathRestriction():int
    public function set monotonicPathRestriction(value:int):void

See also

reroutingproperty 
rerouting:Boolean

Getter: Returns whether rerouting bad edges is enabled.

Setter: Specifies whether or not to enable a further crossing minimization optimization based on rerouting edges that cross many edges. By default this feature is not enabled. Activating this feature only makes sense if the global crossing cost is set to a value greater an 0.


Implementation
    public function get rerouting():Boolean
    public function set rerouting(value:Boolean):void

See also

routingStyleproperty 
routingStyle:int

Getter: Returns the currently set routing style.

Setter: Sets the preferred routing style for the edges to be routed. The default setting is STYLE_BALANCED.


Implementation
    public function get routingStyle():int
    public function set routingStyle(value:int):void

See also

selectedEdgesDpKeyproperty 
selectedEdgesDpKey:Object

Specifies the DataProvider key to mark edges as selected.

By default, com.yworks.yfiles.layout.LayouterKeys.SELECTED_EDGES is used.


Implementation
    public function get selectedEdgesDpKey():Object
    public function set selectedEdgesDpKey(value:Object):void

Throws
IllegalArgumentException — if the specified key is null.

See also

selectedNodesDpKeyproperty 
selectedNodesDpKey:Object

Specifies the DataProvider key to mark nodes as selected.

By default, com.yworks.yfiles.layout.LayouterKeys.SELECTED_NODES is used.


Implementation
    public function get selectedNodesDpKey():Object
    public function set selectedNodesDpKey(value:Object):void

Throws
IllegalArgumentException — if the specified key is null.

See also

sphereOfActionproperty 
sphereOfAction:int

Getter: Returns the currently set sphere of action specifier.

Setter: Sets the edge (sub-)set to be routed. Default setting is ROUTE_ALL_EDGES.


Implementation
    public function get sphereOfAction():int
    public function set sphereOfAction(value:int):void

See also

useCustomBorderCapacityproperty 
useCustomBorderCapacity:Boolean

Getter: Returns whether a custom value for the capacity of the routing border is used.

Setter: Specifies whether or not a custom value for the capacity of the routing border around the graph's bounding box should be applied.

Default setting is false.


Implementation
    public function get useCustomBorderCapacity():Boolean
    public function set useCustomBorderCapacity(value:Boolean):void

See also

Constructor Detail
OrthogonalEdgeRouter()Constructor
public function OrthogonalEdgeRouter(init:Boolean = true)

Creates a new instance of the Orthogonal Edge Router. The initial settings (the default values) make up an instance that:

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.

See also

Method Detail
canLayout()method
override public function canLayout(graph:LayoutGraph):Boolean

Returns true if the specified core layouter does, and also when there is no core layouter.

Parameters

graph:LayoutGraph

Returns
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.


Throws
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.


Throws
IllegalArgumentException — thrown if the width/height of the node object is zero.

See also

doLayout()method 
override public function doLayout(graph:LayoutGraph):void

Main entrance to orthogonal edge routing. Routes the edges of the given graph.

Parameters

graph:LayoutGraph

getClass()method 
override public function getClass():Class

Returns
Class
initOrthogonalEdgeRouter1()method 
protected final function initOrthogonalEdgeRouter1():void

Initializes this object. See the documentation of the corresponding factory method newOrthogonalEdgeRouter1() for details.

See also

initOrthogonalEdgeRouter2()method 
protected final function initOrthogonalEdgeRouter2(core:Layouter):void

Initializes this object. See the documentation of the corresponding factory method newOrthogonalEdgeRouter2() for details.

Parameters

core:Layouter

See also

newOrthogonalEdgeRouter1()method 
public static function newOrthogonalEdgeRouter1():OrthogonalEdgeRouter

Creates a new instance of the Orthogonal Edge Router. The initial settings (the default values) make up an instance that:

Returns
OrthogonalEdgeRouter

See also

newOrthogonalEdgeRouter2()method 
public static function newOrthogonalEdgeRouter2(core:Layouter):OrthogonalEdgeRouter

Convenience constructor to simultaneously set a core layout algorithm which will run before the orthogonal edge router.

Parameters

core:Layouter

Returns
OrthogonalEdgeRouter

See also

setGridOrigin()method 
public function setGridOrigin(x:int, y:int):void

Sets a grid point coordinate used when grid routing is enabled. By default (0, 0) is set.

Parameters

x:int
 
y:int

See also

Constant Detail
MONOTONIC_BOTHConstant
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_HORIZONTALConstant 
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_NONEConstant 
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_VERTICALConstant 
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

ROUTE_ALL_EDGESConstant 
public static const ROUTE_ALL_EDGES:int = 0

Sphere of action specifier. Route all edges of the input graph.

See also

ROUTE_EDGES_AT_SELECTED_NODESConstant 
public static const ROUTE_EDGES_AT_SELECTED_NODES:int = 4

Sphere of action specifier. Route only edges connected to selected nodes. The selection state of a node is determined by a boolean value returned by the data provider associated with the data provider key selectedNodesDpKey.

See also

ROUTE_SELECTED_EDGESConstant 
public static const ROUTE_SELECTED_EDGES:int = 2

Sphere of action specifier. Route only selected edges of the input graph. The selection state of an edge is determined by a boolean value returned by the data provider associated with the data provider key selectedEdgesDpKey.

See also

STYLE_ADHOCConstant 
public static const STYLE_ADHOC:int

Routing style specifier. Edge segments are drawn ad hoc, i.e., rather crude.

See also

STYLE_BALANCEDConstant 
public static const STYLE_BALANCED:int

Routing style specifier. Similar to STYLE_PREFERMIDDLE for the two end segments and segments between bends of different directions. Segments between bends of the same direction (u-shaped turns) are drawn the short way. This style achieves a well-balanced routing and is used by default.

See also

STYLE_PREFERMIDDLEConstant 
public static const STYLE_PREFERMIDDLE:int

Routing style specifier. Edge segments are drawn with the most distance to already known obstacles such as nodes or other edge segments.

See also

STYLE_SHORTPATHConstant 
public static const STYLE_SHORTPATH:int

Routing style specifier. Edge segments are drawn the short way, i.e., with the global way of the edge in mind.

See also