Class SubgraphDepthLocater.DepthSegment

java.lang.Object
org.locationtech.jts.operation.buffer.SubgraphDepthLocater.DepthSegment
All Implemented Interfaces:
Comparable
Enclosing class:
SubgraphDepthLocater

static class SubgraphDepthLocater.DepthSegment extends Object implements Comparable
A segment from a directed edge which has been assigned a depth value for its sides.
  • Field Details

    • upwardSeg

      private LineSegment upwardSeg
    • leftDepth

      private int leftDepth
  • Constructor Details

    • DepthSegment

      public DepthSegment(LineSegment seg, int depth)
  • Method Details

    • compareTo

      public int compareTo(Object obj)
      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
      KNOWN BUGS:
      • The logic does not obey the
        invalid reference
        Comparator.compareTo
        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 @link
        {@link Collections.sort()
        }.
      Specified by:
      compareTo in interface Comparable
      Parameters:
      obj - a DepthSegment
      Returns:
      the comparison value
    • compareX

      private int compareX(LineSegment seg0, LineSegment seg1)
      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 compare
      seg1 - a segment to compare
      Returns:
    • toString

      public String toString()
      Overrides:
      toString in class Object