Packagecom.yworks.yfiles.layout.router
Classpublic class ChannelRouter
InheritanceChannelRouter Inheritance YObject Inheritance Object

Class that routes edges within a vertical or horizontal channel All edges will then be routed in an orthogonal fashion. This class basically assigns subchannels to each each key (normally edges) so that the overall number of subchannels is small.



Public Properties
 PropertyDefined By
  epsilon : Number
Specifies the current epsilon value.
ChannelRouter
  epsilonChannelIgnored : Boolean
Getter: Returns whether subchannels shorter than epsilon are ignored by this instance.
ChannelRouter
  subChannelCount : int
[read-only] Returns the number of subchannels within this channel.
ChannelRouter
Public Methods
 MethodDefined By
  
ChannelRouter(min:Number, max:Number, init:Boolean = true)
Creates a new instance of ChannelRouter for a horizontal channel.
ChannelRouter
  
addGroupSegment(key:Object, groupId:Object, p1:YPoint, p2:YPoint):void
Adds an edge object that belongs to a group of edges with source and target coordinates to the set of edges that have to be routed within the channel Edges sharing the same groupId will be placed on the same channel.
ChannelRouter
  
addSegment(key:Object, p1:YPoint, p2:YPoint):void
Adds an edge object with source and target coordinates to the set of edges that have to be routed within the channel
ChannelRouter
  
containsGroupKey(groupKey:Object):Boolean
Determines if the given key has been registered as a grouping key with this instance.
ChannelRouter
  
containsKey(key:Object):Boolean
Determines if the given key has been registered already with this instance.
ChannelRouter
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
ChannelRouter
  
getCoord(key:Object):Number
Returns the calculated channel coordinate for an added edge object.
ChannelRouter
  
getGroupSubChannelRank(groupKey:Object):int
Returns the subchannel rank for the group indicated by the groupKey.
ChannelRouter
  
getSubChannelRank(key:Object):int
Returns the subchannel rank of this segment within the channel.
ChannelRouter
 Inherited
hashCode():int
YObject
  
newChannelRouter1(min:Number, max:Number):ChannelRouter
[static] Creates a new instance of ChannelRouter for a horizontal channel.
ChannelRouter
  
newChannelRouter2(min:Number, max:Number, orientation:int):ChannelRouter
[static] Creates a new instance of ChannelRouter.
ChannelRouter
  
route():void
Routes all added edges within the specified channel.
ChannelRouter
  
Returns an iterator over all added segment keys.
ChannelRouter
  
setChannel(min:Number, max:Number, orientation:int):void
Sets the channel bounds and direction.
ChannelRouter
Protected Methods
 MethodDefined By
  
initChannelRouter1(min:Number, max:Number):void
Initializes this object.
ChannelRouter
  
initChannelRouter2(min:Number, max:Number, orientation:int):void
Initializes this object.
ChannelRouter
Public Constants
 ConstantDefined By
  ROUTE_HORIZONTAL : int = 1
[static] Channel orientation specifier.
ChannelRouter
  ROUTE_VERTICAL : int = 0
[static] Channel orientation specifier.
ChannelRouter
Property Detail
epsilonproperty
epsilon:Number

Specifies the current epsilon value. Subchannel lengths smaller than this value will be ignored by this instance if the the epsilonChannelIgnored property is set to true


Implementation
    public function get epsilon():Number
    public function set epsilon(value:Number):void

See also

epsilonChannelIgnoredproperty 
epsilonChannelIgnored:Boolean

Getter: Returns whether subchannels shorter than epsilon are ignored by this instance.

Setter: Determines if subchannel lengths smaller than epsilon should be ignored by the channel router. Default is true with an epsilon value of 0.5d.


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

See also

subChannelCountproperty 
subChannelCount:int  [read-only]

Returns the number of subchannels within this channel. The return value 0 indicates that there are no subchannels present.


Implementation
    public function get subChannelCount():int
Constructor Detail
ChannelRouter()Constructor
public function ChannelRouter(min:Number, max:Number, init:Boolean = true)

Creates a new instance of ChannelRouter for a horizontal channel.

Parameters
min:Number — the smallest assignable coordinate within the channel
 
max:Number — the largest assignable coordinate within the channel
 
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.
Method Detail
addGroupSegment()method
public function addGroupSegment(key:Object, groupId:Object, p1:YPoint, p2:YPoint):void

Adds an edge object that belongs to a group of edges with source and target coordinates to the set of edges that have to be routed within the channel Edges sharing the same groupId will be placed on the same channel.

Parameters

key:Object
 
groupId:Object
 
p1:YPoint
 
p2:YPoint

addSegment()method 
public function addSegment(key:Object, p1:YPoint, p2:YPoint):void

Adds an edge object with source and target coordinates to the set of edges that have to be routed within the channel

Parameters

key:Object
 
p1:YPoint
 
p2:YPoint

containsGroupKey()method 
public function containsGroupKey(groupKey:Object):Boolean

Determines if the given key has been registered as a grouping key with this instance.

Parameters

groupKey:Object — the key which is used in addGroupSegment()

Returns
Boolean

See also

containsKey()method 
public function containsKey(key:Object):Boolean

Determines if the given key has been registered already with this instance.

Parameters

key:Object — the key which is used in addSegment()

Returns
Boolean

See also

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

Returns
Class
getCoord()method 
public function getCoord(key:Object):Number

Returns the calculated channel coordinate for an added edge object. If for example the router was instantiated with the arguments ChannelRouter(100,200,ChannelRouter.ROUTE_HORIZONTAL) then the returned coordinate is an x-coordinate between 100 and 200. This coordinate represents the x-coordinate of two additional bends that are needed to route the edge orthogonally from p1 to p2 (as specified in addSegment).

Parameters

key:Object — an edge object added with addSegment()

Returns
Number

See also

getGroupSubChannelRank()method 
public function getGroupSubChannelRank(groupKey:Object):int

Returns the subchannel rank for the group indicated by the groupKey.

Parameters

groupKey:Object

Returns
int

See also

getSubChannelRank()method 
public function getSubChannelRank(key:Object):int

Returns the subchannel rank of this segment within the channel.

Parameters

key:Object — an edge object added with addSegment()

Returns
int

See also

initChannelRouter1()method 
protected final function initChannelRouter1(min:Number, max:Number):void

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

Parameters

min:Number
 
max:Number

See also

initChannelRouter2()method 
protected final function initChannelRouter2(min:Number, max:Number, orientation:int):void

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

Parameters

min:Number
 
max:Number
 
orientation:int

See also

newChannelRouter1()method 
public static function newChannelRouter1(min:Number, max:Number):ChannelRouter

Creates a new instance of ChannelRouter for a horizontal channel.

Parameters

min:Number — the smallest assignable coordinate within the channel
 
max:Number — the largest assignable coordinate within the channel

Returns
ChannelRouter
newChannelRouter2()method 
public static function newChannelRouter2(min:Number, max:Number, orientation:int):ChannelRouter

Creates a new instance of ChannelRouter.

Parameters

min:Number — the smallest assignable coordinate within the channel
 
max:Number — the largest assignable coordinate within the channel
 
orientation:int — the direction of the channel. One of ROUTE_VERTICAL and ROUTE_HORIZONTAL

Returns
ChannelRouter

See also

route()method 
public function route():void

Routes all added edges within the specified channel. The resulting subchannels can then be queried using the getSubChannelRank() method.

See also

segmentKeys()method 
public function segmentKeys():Iterator

Returns an iterator over all added segment keys. For grouped edges, a com.yworks.yfiles.base.YList instance will be returned.

Returns
Iterator

See also

setChannel()method 
public function setChannel(min:Number, max:Number, orientation:int):void

Sets the channel bounds and direction. A call to this method implies that all previously added segments will be removed.

Parameters

min:Number — the smallest assignable coordinate within the channel
 
max:Number — the largest assignable coordinate within the channel
 
orientation:int — the orientation of the channel. One of ROUTE_VERTICAL and ROUTE_HORIZONTAL

See also

Constant Detail
ROUTE_HORIZONTALConstant
public static const ROUTE_HORIZONTAL:int = 1

Channel orientation specifier. Used to route edges in a horizontal channel.

ROUTE_VERTICALConstant 
public static const ROUTE_VERTICAL:int = 0

Channel orientation specifier. Used to route edges in a vertical channel.