|
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
This class routes edges using their pre-calculated Path
information.
The concept of this algorithm is to bundle edge segment
s into so-called Channel
s
and route each Channel
individually.
This class is initialized using initialize(PathSearchConfiguration)
which must have been called
before the edges are routed
.
After a ChannelBasedPathRouting
instance is no longer in use, the Channel
information and the
reference to the configuration
must be reset using method cleanup()
.
EdgeInfo.getSegmentInfo(int)
,
LayoutGraph.setPath(Edge, YList)
Constructor Summary | |
---|---|
ChannelBasedPathRouting()
Creates a new instance of ChannelBasedPathRouting . |
Method Summary | |
---|---|
protected void |
adjustSegmentLocations(Channel channel)
Adjusts the location assigned to a segment info in the channel considering
the preferred alignment of the segment. |
protected void |
calculateSegmentLocations(Channel channel)
Calculates the locations of the segment infos in the given channel . |
void |
cleanup()
Resets all channel information and the reference to the configuration . |
protected java.util.Comparator |
createSegmentInfoComparator(YList channels,
PathSearchResult pathSearchResult,
PathSearchConfiguration configuration)
Creates a comparator for sorting the SegmentInfo s in a Channel from
left to right (for vertical segments) or top to bottom (for horizontal segments), respectively. |
protected PathSearchConfiguration |
getConfiguration()
Returns the path search configuration with which the
ChannelBasedPathRouting has been initialized . |
void |
initialize(PathSearchConfiguration configuration)
Initializes this ChannelBasedPathRouting instance for routing paths that have been 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(java.util.List segmentInfos,
java.util.Comparator segmentInfoComparator)
Sorts the given list of SegmentInfo s 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()
ChannelBasedPathRouting
.
Method Detail |
---|
public void initialize(PathSearchConfiguration configuration)
ChannelBasedPathRouting
instance for routing paths that have been found with the given
configuration
.
This method must be called before the edges are routed
.
configuration
- the configuration
used for the following path routingroute(EdgeList, PathSearchResult)
public void cleanup()
channel
information and the reference to the configuration
.
Afterwards, ChannelBasedPathRouting
is ready to calculate paths for a new layout.
protected PathSearchConfiguration getConfiguration()
path search configuration
with which the
ChannelBasedPathRouting
has been initialized
.
configuration
of this ChannelBasedPathRouting
instanceinitialize(PathSearchConfiguration)
public void route(EdgeList edges, PathSearchResult pathSearchResult)
Before calling this method, method initialize(PathSearchConfiguration)
must have been called.
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 segments' location ranges by calling the subsequent methods:
Finally, the control points for the paths are calculated.
edges
- the list of edges
to be routedpathSearchResult
- the path search result
containing the Path
objects for
the edges
java.lang.IllegalStateException
- if the locations are not within the segment's location rangePathSearchResult.getPath(Edge)
,
AbstractSegmentInfo.getLocationRange()
,
AbstractSegmentInfo.setLocation(double)
protected java.util.Comparator createSegmentInfoComparator(YList channels, PathSearchResult pathSearchResult, PathSearchConfiguration configuration)
comparator
for sorting the SegmentInfo
s in a Channel
from
left to right (for vertical segments) or top to bottom (for horizontal segments), respectively.
This method is called in route(EdgeList, PathSearchResult)
before edge segments are distributed within
the channels.
channels
- the channels whose segments will be sorted by the comparator
pathSearchResult
- the path search result
containing the EdgeInfo
s with the
SegmentInfo
s for which the comparator will be usedconfiguration
- the configuration
used during this path search
comparator
used for sorting the SegmentInfo
s in a channel
protected void sortSegmentInfos(java.util.List segmentInfos, java.util.Comparator segmentInfoComparator)
SegmentInfo
s using the given comparator
.
This method is called in route(EdgeList, PathSearchResult)
when the edge segments are distributed within
the channels.
segmentInfos
- the list of SegmentInfo
s to be sortedsegmentInfoComparator
- the comparator used for sorting the list of SegmentInfo
sprotected void optimizeSegmentOrder(Channel channel)
segments
in the given channel
.
After the segments in the channel have been sorted using the comparator created by method
createSegmentInfoComparator(YList, PathSearchResult, PathSearchConfiguration)
,
segments having a common SegmentGroup
are replaced by their common
representative segment info
.
This method further improves the order of the resulting segment info list to make sure that the subsequent
location calculation
is able to respect the
location ranges
of the SegmentInfo
s and,
if possible, the minimum edge to edge distances and possible grid constraints for the segments.
channel
- the channel for which the order of the SegmentInfo
s is optimizedprotected void calculateSegmentLocations(Channel channel)
segment infos
in the given channel
.
This method is called after the order of the segment infos
within a channel has been
optimized
.
stored
in the channel
. They should respect minimum edge to edge distances and grid constraints
and must lie in the respective location range
s.channel
- the channel that contains the segment infos for which the locations will be calculatedChannel.setCurrentLocation(SegmentInfo, double)
protected void adjustSegmentLocations(Channel channel)
segment info
in the channel
considering
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 info
s.
channel
- the channel that contains the segment infos for which the alignment should be consideredChannel.getCurrentLocation(SegmentInfo)
,
AbstractSegmentInfo.getPreferredAlignment()
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |