Packagecom.yworks.yfiles.layout.router.polyline
Classpublic class ChannelBasedPathRouting
InheritanceChannelBasedPathRouting Inheritance YObject Inheritance Object

Routes edges using their pre-calculated com.yworks.yfiles.layout.router.polyline.Path information.

Initialize (initialize()) must be called before the edges can be route (route()) d.

The basic approach of this router is to bundle edge segment (com.yworks.yfiles.layout.router.polyline.SegmentInfo) s into so-called com.yworks.yfiles.layout.router.polyline.Channel s and route each channel individually.

See also

com.yworks.yfiles.layout.router.polyline.EdgeInfo.getSegmentInfo()
com.yworks.yfiles.layout.LayoutGraph.setPath()
com.yworks.yfiles.layout.router.polyline.Path
Initialize
route
segment
com.yworks.yfiles.layout.router.polyline.Channel


Protected Properties
 PropertyDefined By
  configuration : PathSearchConfiguration
[read-only] Returns the configuration this class was initialized with.
ChannelBasedPathRouting
Public Methods
 MethodDefined By
  
ChannelBasedPathRouting(init:Boolean = true)
ChannelBasedPathRouting
  
cleanup():void
Resets all channel information and the reference to the PathSearchConfiguration.
ChannelBasedPathRouting
 Inherited
equals(o:Object):Boolean
YObject
  
getClass():Class
[override]
ChannelBasedPathRouting
 Inherited
hashCode():int
YObject
  
Initializes this class for routing paths that were found with the given configuration.
ChannelBasedPathRouting
  
[static]
ChannelBasedPathRouting
  
route(edges:EdgeList, pathSearchResult:PathSearchResult):void
Routes the given edges.
ChannelBasedPathRouting
Protected Methods
 MethodDefined By
  
Tries to adjust the location set for a segment info in the channel to consider the preferred alignment of the segment.
ChannelBasedPathRouting
  
Calculates locations for the segment infos in the given channel.
ChannelBasedPathRouting
  
Creates a comparator for com.yworks.yfiles.layout.router.polyline.SegmentInfo s that can be used to sort the segment infos in a com.yworks.yfiles.layout.router.polyline.Channel from left to right (for vertical segments) or top to bottom (for horizontal segments), respectively.
ChannelBasedPathRouting
  
ChannelBasedPathRouting
  
Optimizes the order of the segments in the given channel.
ChannelBasedPathRouting
  
sortSegmentInfos(segmentInfos:List, segmentInfoComparator:Comparator):void
Sorts the given list of SegmentInfos using the given comparator.
ChannelBasedPathRouting
Property Detail
configurationproperty
configuration:PathSearchConfiguration  [read-only]

Returns the configuration this class was initialized with.


Implementation
    protected function get configuration():PathSearchConfiguration

See also

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



Parameters
init:Boolean (default = true)
Method Detail
adjustSegmentLocations()method
protected function adjustSegmentLocations(channel:Channel):void

Tries to adjust the location set for a segment info in the channel to consider the preferred alignment of the segment. This method is called after the segments have been distributed in the channel but before the final locations of the segments are assigned to the segment infos.

Parameters

channel:Channel — The channel of the segment infos to consider the alignments for.

See also

calculateSegmentLocations()method 
protected function calculateSegmentLocations(channel:Channel):void

Calculates locations for the segment infos in the given channel.

Precondition: The locations of the segments are stored (com.yworks.yfiles.layout.router.polyline.Channel.setCurrentLocation()) in the Channel. They should respect minimal edge to edge distances and grid constraints and must lie in the respective location range (com.yworks.yfiles.layout.router.polyline.SegmentInfo.locationRange) s.

Parameters

channel:Channel — The channel to calculate locations for the segment infos for.

See also

cleanup()method 
public function cleanup():void

Resets all channel information and the reference to the PathSearchConfiguration. So, ChannelBasedPathRouting is ready to calculate paths for a new layout.

createSegmentInfoComparator()method 
protected function createSegmentInfoComparator(channels:YList, pathSearchResult:PathSearchResult, configuration:PathSearchConfiguration):Comparator

Creates a comparator for com.yworks.yfiles.layout.router.polyline.SegmentInfo s that can be used to sort the segment infos in a com.yworks.yfiles.layout.router.polyline.Channel from left to right (for vertical segments) or top to bottom (for horizontal segments), respectively.

Parameters

channels:YList — The channels this comparator will be used for later.
 
pathSearchResult:PathSearchResult — The path search result containing the com.yworks.yfiles.layout.router.polyline.EdgeInfo s with the SegmentInfos this comparator that will be used for later.
 
configuration:PathSearchConfiguration — The configuration used during this path search.

Returns
Comparator — A comparator for SegmentInfos that can be used to sort the segment infos in a Channel.

See also

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

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

initialize()method 
public function initialize(configuration:PathSearchConfiguration):void

Initializes this class for routing paths that were found with the given configuration. Must be called before route().

Parameters

configuration:PathSearchConfiguration — The configuration to use for the following path routings.

See also

newChannelBasedPathRouting()method 
public static function newChannelBasedPathRouting():ChannelBasedPathRouting

Returns
ChannelBasedPathRouting
optimizeSegmentOrder()method 
protected function optimizeSegmentOrder(channel:Channel):void

Optimizes the order of the segments in the given channel.

After the segments in the channel have been sorted using the segment info comparator (createSegmentInfoComparator()), segment infos having a common com.yworks.yfiles.layout.router.polyline.SegmentGroup are replaced by their common representative segment info (com.yworks.yfiles.layout.router.polyline.SegmentGroup.commonSegmentInfo).

This method further improves the order of the resulting segment info list is to make sure that the subsequent location calculation (calculateSegmentLocations()) is able to respect the segment infos location ranges (com.yworks.yfiles.layout.router.polyline.SegmentInfo.locationRange) and if possible the minimal edge to edge distances and possible grid constraints for the segments.

Parameters

channel:Channel — The channel to optimize the segment info order for.

See also

route()method 
public function route(edges:EdgeList, pathSearchResult:PathSearchResult):void

Routes the given edges. initialize() must be called first.

As a first step, the com.yworks.yfiles.layout.router.polyline.SegmentInfo s of all edge paths are distributed to com.yworks.yfiles.layout.router.polyline.Channel s. After that, the segments in each of these Channels are sorted and locations are assigned respecting the segment's location ranges by calling the subsequent methods:

  1. optimizeSegmentOrder()
  2. calculateSegmentLocations()
  3. adjustSegmentLocations()

Finally the control points for the paths are calculated.

Parameters

edges:EdgeList — The edges to route.
 
pathSearchResult:PathSearchResult — The path search results containing the Path objects for the edges.


Throws
Error — If the locations are not inside of the segment's location range.

See also

sortSegmentInfos()method 
protected function sortSegmentInfos(segmentInfos:List, segmentInfoComparator:Comparator):void

Sorts the given list of SegmentInfos using the given comparator.

Parameters

segmentInfos:List — The list of SegmentInfos to sort.
 
segmentInfoComparator:Comparator — The comparator to use for the sorting.