Search this API

y.layout.router.polyline
Class Channel

java.lang.Object
  extended by y.layout.router.polyline.Channel

public class Channel
extends Object

A channel is a set of vertical or horizontal edge segments whose locations depend on each other. Channels are used by the ChannelBasedPathRouting to route edges using SegmentInfos describing their path.


Constructor Summary
Channel(SegmentInfo segment)
          Creates a new channel containing the given segment info.
 
Method Summary
 void addSegment(SegmentInfo segment)
          Adds a new segment info to the channel.
 void addSegmentGroup(SegmentGroup group)
          Adds a segment group to this channel.
 YRectangle getBounds()
          Returns the bounds of this channel.
 double getCurrentLocation(SegmentInfo segmentInfo)
          Returns the current location the given SegmentInfo is assigned inside its location range.
 Interval getLengthInterval()
          Returns an interval spanning the union of the segment infos' maximum extension.
 SegmentInfo getSegment(int index)
          Returns the SegmentInfo with the given index in the segments list.
 SegmentGroup getSegmentGroup(int index)
          Returns the segment group with the given index of this channel.
 Interval getWidthInterval()
          Returns an interval spanning the union of the segment infos' location ranges.
 boolean isVertical()
          Determines whether or not the segments in this channel are vertical.
 int segmentCount()
          Returns the number of segment infos in this channel.
 int segmentGroupCount()
          Returns the number of segment groups in this channel.
 void setCurrentLocation(SegmentInfo segmentInfo, double location)
          Sets the current location the given SegmentInfo is assigned inside its location range.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Channel

public Channel(SegmentInfo segment)
Creates a new channel containing the given segment info.

Parameters:
segment - The segment info the channel shall be created for.
Method Detail

addSegment

public void addSegment(SegmentInfo segment)
Adds a new segment info to the channel.

Throws:
IllegalArgumentException - If the given segment has a different orientation then the segments already contained in the channel.
Parameters:
segment - The segment info to add to this channel.

getWidthInterval

public Interval getWidthInterval()
Returns an interval spanning the union of the segment infos' location ranges.

Returns:
An interval spanning the union of the segment infos' location ranges.
See Also:
AbstractSegmentInfo.getLocationRange()

getLengthInterval

public Interval getLengthInterval()
Returns an interval spanning the union of the segment infos' maximum extension.

Returns:
An interval spanning the union of the segment infos' maximum extension.
See Also:
AbstractSegmentInfo.getMaxExtension()

segmentCount

public int segmentCount()
Returns the number of segment infos in this channel.

Returns:
The number of segment infos in this channel.

isVertical

public boolean isVertical()
Determines whether or not the segments in this channel are vertical.

Returns:
true if the segments in this channel are vertical, false otherwise.

getSegment

public SegmentInfo getSegment(int index)
Returns the SegmentInfo with the given index in the segments list.

Parameters:
index - The index of the segment in the list.
Returns:
The SegmentInfo with the given index in the segments list.

segmentGroupCount

public int segmentGroupCount()
Returns the number of segment groups in this channel.

Returns:
the number of segment groups in this channel

addSegmentGroup

public void addSegmentGroup(SegmentGroup group)
Adds a segment group to this channel.

Parameters:
group - segment group to add

getSegmentGroup

public SegmentGroup getSegmentGroup(int index)
Returns the segment group with the given index of this channel.

Parameters:
index - index of the segment group to return
Returns:
the segment group with the given index of this channel

getCurrentLocation

public double getCurrentLocation(SegmentInfo segmentInfo)
Returns the current location the given SegmentInfo is assigned inside its location range.

Parameters:
segmentInfo - The segmentInfo to return the current location for.
Returns:
The current location of the segment info or Double.NaN if no location was set before.

setCurrentLocation

public void setCurrentLocation(SegmentInfo segmentInfo,
                               double location)
Sets the current location the given SegmentInfo is assigned inside its location range.

During the distribution of the segments in the channel, different locations can be assigned and only the last one is finally set at the segment info.

Parameters:
segmentInfo - The segment info to set the current location for.
location - The current location of the segment info in its location range.
See Also:
AbstractSegmentInfo.setLocation(double)

getBounds

public YRectangle getBounds()
Returns the bounds of this channel. These bounds are determined by the channel's width and length.

Returns:
the bounds of this channel
See Also:
getWidthInterval(), getLengthInterval()

toString

public String toString()
Overrides:
toString in class Object

© Copyright 2000-2013,
yWorks GmbH.
All rights reserved.