|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.layout.router.polyline.ChannelBasedPathRouting
public class ChannelBasedPathRouting
Routes edges using their pre-calculated Path
information.
Initialize
must be called before the edges can be
route
d.
The basic approach of this router is to bundle edge segment
s into so-called Channel
s
and route each channel individually.
EdgeInfo.getSegmentInfo(int)
,
LayoutGraph.setPath(y.base.Edge, y.base.YList)
Constructor Summary | |
---|---|
ChannelBasedPathRouting()
|
Method Summary | |
---|---|
protected void |
adjustSegmentLocations(Channel channel)
Tries to adjust the location set for a segment info in the channel to consider the preferred alignment of the segment. |
protected void |
calculateSegmentLocations(Channel channel)
Calculates locations for the segment infos in the given channel. |
void |
cleanup()
Resets all channel information and the reference to the PathSearchConfiguration. |
protected Comparator |
createSegmentInfoComparator(YList channels,
PathSearchResult pathSearchResult,
PathSearchConfiguration configuration)
Creates a comparator for SegmentInfo s that can be used to sort the segment infos in a Channel from
left to right (for vertical segments) or top to bottom (for horizontal segments), respectively. |
protected PathSearchConfiguration |
getConfiguration()
Returns the configuration this class was initialized with. |
void |
initialize(PathSearchConfiguration configuration)
Initializes this class for routing paths that were found with the given configuration . |
protected void |
optimizeSegmentOrder(Channel channel)
Optimizes the order of the segments in the given channel. |
void |
route(EdgeList edges,
PathSearchResult pathSearchResult)
Routes the given edges. |
protected void |
sortSegmentInfos(List segmentInfos,
Comparator segmentInfoComparator)
Sorts the given list of SegmentInfos using the given comparator. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChannelBasedPathRouting()
Method Detail |
---|
public void initialize(PathSearchConfiguration configuration)
configuration
. Must be called
before route(y.base.EdgeList, PathSearchResult)
.
configuration
- The configuration to use for the following path routings.route(y.base.EdgeList, PathSearchResult)
public void cleanup()
ChannelBasedPathRouting
is ready to calculate paths for a new layout.
protected PathSearchConfiguration getConfiguration()
initialize(PathSearchConfiguration)
public void route(EdgeList edges, PathSearchResult pathSearchResult)
initialize(PathSearchConfiguration)
must be called first.
As a first step, the SegmentInfo
s of all edge paths are distributed to Channel
s.
After that, the segments in each of these Channel
s are sorted and locations are assigned respecting
the segment's location ranges by calling the subsequent methods:
optimizeSegmentOrder(y.layout.router.polyline.Channel)
calculateSegmentLocations(y.layout.router.polyline.Channel)
adjustSegmentLocations(y.layout.router.polyline.Channel)
Finally the control points for the paths are calculated.
IllegalStateException
- If the locations are not inside of the segment's location range.edges
- The edges to route.pathSearchResult
- The path search results containing the Path
objects for the edges.PathSearchResult.getPath(y.base.Edge)
,
AbstractSegmentInfo.getLocationRange()
,
AbstractSegmentInfo.setLocation(double)
protected Comparator createSegmentInfoComparator(YList channels, PathSearchResult pathSearchResult, PathSearchConfiguration configuration)
SegmentInfo
s that can be used to sort the segment infos in a Channel
from
left to right (for vertical segments) or top to bottom (for horizontal segments), respectively.
channels
- The channels this comparator will be used for later.pathSearchResult
- The path search result containing the EdgeInfo
s with the SegmentInfo
s
this comparator that will be used for later.configuration
- The configuration used during this path search.
SegmentInfo
s that can be used to sort the segment infos in a
Channel
.protected void sortSegmentInfos(List segmentInfos, Comparator segmentInfoComparator)
segmentInfos
- The list of SegmentInfos to sort.segmentInfoComparator
- The comparator to use for the sorting.protected void optimizeSegmentOrder(Channel channel)
After the segments in the channel have been sorted using the
segment info comparator
,
segment infos having a common SegmentGroup
are replaced by their common
representative segment info
.
location calculation
is able to respect the segment infos
location ranges
and if possible the
minimal edge to edge distances and possible grid constraints for the segments.
channel
- The channel to optimize the segment info order for.protected void calculateSegmentLocations(Channel channel)
Precondition: The locations of the segments are stored
in the Channel. They should respect minimal edge to edge distances and grid constraints and must lie in the
respective location range
s.
channel
- The channel to calculate locations for the segment infos for.Channel.setCurrentLocation(SegmentInfo, double)
protected void adjustSegmentLocations(Channel channel)
channel
- The channel of the segment infos to consider the alignments for.Channel.getCurrentLocation(SegmentInfo)
,
AbstractSegmentInfo.getPreferredAlignment()
|
© Copyright 2000-2013, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |