Class TaggedLineStringSimplifier


  • public class TaggedLineStringSimplifier
    extends java.lang.Object
    Simplifies a TaggedLineString, preserving topology (in the sense that no new intersections are introduced). Uses the recursive Douglas-Peucker algorithm.
    Version:
    1.7
    • Method Detail

      • setDistanceTolerance

        public void setDistanceTolerance​(double distanceTolerance)
        Sets the distance tolerance for the simplification. All vertices in the simplified geometry will be within this distance of the original geometry.
        Parameters:
        distanceTolerance - the approximation tolerance to use
      • simplify

        void simplify​(TaggedLineString line)
        Simplifies the given TaggedLineString using the distance tolerance specified.
        Parameters:
        line - the linestring to simplify
      • simplifySection

        private void simplifySection​(int i,
                                     int j,
                                     int depth)
      • findFurthestPoint

        private int findFurthestPoint​(Coordinate[] pts,
                                      int i,
                                      int j,
                                      double[] maxDistance)
      • flatten

        private LineSegment flatten​(int start,
                                    int end)
        Flattens a section of the line between indexes start and end, replacing them with a line between the endpoints. The input and output indexes are updated to reflect this.
        Parameters:
        start - the start index of the flattened section
        end - the end index of the flattened section
        Returns:
        the new segment created
      • hasBadIntersection

        private boolean hasBadIntersection​(TaggedLineString parentLine,
                                           int[] sectionIndex,
                                           LineSegment candidateSeg)
      • hasBadOutputIntersection

        private boolean hasBadOutputIntersection​(LineSegment candidateSeg)
      • hasBadInputIntersection

        private boolean hasBadInputIntersection​(TaggedLineString parentLine,
                                                int[] sectionIndex,
                                                LineSegment candidateSeg)
      • isInLineSection

        private static boolean isInLineSection​(TaggedLineString line,
                                               int[] sectionIndex,
                                               TaggedLineSegment seg)
        Tests whether a segment is in a section of a TaggedLineString
        Parameters:
        line -
        sectionIndex -
        seg -
        Returns:
      • remove

        private void remove​(TaggedLineString line,
                            int start,
                            int end)
        Remove the segs in the section of the line
        Parameters:
        line -
        pts -
        sectionStartIndex -
        sectionEndIndex -