Class SubgraphDepthLocater.DepthSegment
java.lang.Object
org.locationtech.jts.operation.buffer.SubgraphDepthLocater.DepthSegment
- All Implemented Interfaces:
Comparable
- Enclosing class:
SubgraphDepthLocater
A segment from a directed edge which has been assigned a depth value
for its sides.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintDefines a comparison operation on DepthSegments which orders them left to right.private intcompareX(LineSegment seg0, LineSegment seg1) Compare two collinear segments for left-most ordering.toString()
-
Field Details
-
upwardSeg
-
leftDepth
private int leftDepth
-
-
Constructor Details
-
DepthSegment
-
-
Method Details
-
compareTo
Defines a comparison operation on DepthSegments which orders them left to right. Assumes the segments are normalized.The definition of the ordering is:
- -1 : if DS1.seg is left of or below DS2.seg (DS1 invalid input: '<' DS2)
- 1 : if DS1.seg is right of or above DS2.seg (DS1 > DS2)
- 0 : if the segments are identical
- The logic does not obey the
contract. This is acceptable for the intended usage, but may cause problems if used with some utilities in the Java standard library (e.g.
invalid reference
Comparator.compareTo}.invalid @link
{@link Collections.sort()
- Specified by:
compareToin interfaceComparable- Parameters:
obj- a DepthSegment- Returns:
- the comparison value
-
compareX
Compare two collinear segments for left-most ordering. If segs are vertical, use vertical ordering for comparison. If segs are equal, return 0. Segments are assumed to be directed so that the second coordinate is >= to the first (e.g. up and to the right).- Parameters:
seg0- a segment to compareseg1- a segment to compare- Returns:
-
toString
-