public abstract class AbstractSegmentInfo extends Object
Most notably, AbstractSegmentInfo
stores the direction
to which the segment points and
the interval
describing possible locations and extensions of a segment.
Modifier | Constructor and Description |
---|---|
protected |
AbstractSegmentInfo(Edge edge,
int segmentIndex,
Direction direction,
Interval locationRange,
Interval minExtension,
Interval maxExtension)
Creates a new instance of
AbstractSegmentInfo . |
protected |
AbstractSegmentInfo(Edge edge,
int segmentIndex,
LineSegment segment)
Creates a new instance of
AbstractSegmentInfo using a line segment to describe the edge segment. |
Modifier and Type | Method and Description |
---|---|
Direction |
getDirection()
Gets the
Direction to which the segment of this info points. |
Edge |
getEdge()
Gets the edge to which the segment of this info belongs.
|
double |
getLocation()
Gets the
fixed location within the location range for this segment info. |
Interval |
getLocationRange()
Gets the range, i.e., the interval within which the segment should be placed.
|
Interval |
getMaxExtension()
Gets the maximum extension that this segment can span.
|
Interval |
getMinExtension()
Gets the minimum known extension of the segment, i.e., the minimum interval that this segment will cover in any case.
|
Alignment |
getPreferredAlignment()
Gets the preferred placement of this segment within its location range.
|
SegmentGroup |
getSegmentGroup()
Gets the segment group to which this segment info belongs.
|
int |
getSegmentIndex()
Gets the index of the segment of this info.
|
boolean |
isFixed()
Gets whether or not this segment info is fixed, i.e., a
fixed location has been determined
within its location range . |
boolean |
isVertical()
Gets whether or not the associated segment is vertical.
|
void |
setLocation(double value)
Sets the
fixed location within the location range for this segment info. |
void |
setPreferredAlignment(Alignment value)
Sets the preferred placement of this segment within its location range.
|
void |
setSegmentGroup(SegmentGroup value)
Sets the segment group to which this segment info belongs.
|
String |
toString()
Returns a string representation of this
AbstractSegmentInfo object. |
protected AbstractSegmentInfo(Edge edge, int segmentIndex, Direction direction, Interval locationRange, Interval minExtension, Interval maxExtension)
AbstractSegmentInfo
.edge
- the edge to which the segment of this info belongssegmentIndex
- the index of the segment to which this info belongsdirection
- the direction to which the segment of this info pointslocationRange
- the range within which the common location of this segment has to lieminExtension
- the minimum interval in extension direction this segment is known to intersectmaxExtension
- the maximum interval in extension direction this segment will spanprotected AbstractSegmentInfo(Edge edge, int segmentIndex, LineSegment segment)
AbstractSegmentInfo
using a line segment to describe the edge segment.
This constructor is meant to be used for fixed orthogonal edge segments.
edge
- the edge to which this segment info belongssegmentIndex
- the index of the segment to which this info belongssegment
- a line segment describing the edge segmentpublic Direction getDirection()
Direction
to which the segment of this info points.public Edge getEdge()
public double getLocation()
fixed
location within the location range
for this segment info.
For horizontal segments, this is the vertical location; for vertical segments, this is the horizontal location.
IllegalStateException
- if the segment info already has a fixed locationIllegalArgumentException
- if the given location does not lie within the location range0
if no fixed location has been setisFixed()
,
getLocationRange()
,
setLocation(double)
public Interval getLocationRange()
For horizontal segments, this is the range containing the vertical location; for vertical segments, this is the range containing the horizontal location.
public Interval getMaxExtension()
For horizontal intervals, this is the maximum horizontal extension; for vertical intervals, this is the maximum vertical extension.
public Interval getMinExtension()
For horizontal intervals, this is the minimum horizontal extension; for vertical intervals, this is the minimum vertical extension.
null
if no minimum extension can be determinedpublic Alignment getPreferredAlignment()
IllegalArgumentException
- if an unknown alignment is givenAlignment.ANY
. The segment can be placed anywhere within its location range.setPreferredAlignment(Alignment)
public SegmentGroup getSegmentGroup()
When defining the segment group, the location range
will be adjusted to use the common
interval of the segment group.
null
if no segment group is assignedSegmentGroup.getCommonLocationRange()
,
setSegmentGroup(SegmentGroup)
public int getSegmentIndex()
public boolean isFixed()
fixed location
has been determined
within its location range
.true
if this segment info has a fixed location assigned to it, false
otherwisepublic boolean isVertical()
true
if the segment of this segment info is vertical, false
if it is horizontalpublic void setLocation(double value)
fixed
location within the location range
for this segment info.
For horizontal segments, this is the vertical location; for vertical segments, this is the horizontal location.
IllegalStateException
- if the segment info already has a fixed locationIllegalArgumentException
- if the given location does not lie within the location rangevalue
- the fixed location that has been set before or 0
if no fixed location has been setisFixed()
,
getLocationRange()
,
getLocation()
public void setPreferredAlignment(Alignment value)
IllegalArgumentException
- if an unknown alignment is givenAlignment.ANY
. The segment can be placed anywhere within its location range.value
- one of the predefined alignmentsgetPreferredAlignment()
public void setSegmentGroup(SegmentGroup value)
When defining the segment group, the location range
will be adjusted to use the common
interval of the segment group.
value
- the segment group to which this segment info belongs or null
if no segment group is assignedSegmentGroup.getCommonLocationRange()
,
getSegmentGroup()
public String toString()
AbstractSegmentInfo
object.toString
in class Object
AbstractSegmentInfo
object