Package org.locationtech.jts.simplify
Class TaggedLineStringSimplifier
java.lang.Object
org.locationtech.jts.simplify.TaggedLineStringSimplifier
Simplifies a TaggedLineString, preserving topology
(in the sense that no new intersections are introduced).
Uses the recursive Douglas-Peucker algorithm.
- Version:
- 1.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
private LineSegmentIndex
private LineIntersector
private TaggedLineString
private Coordinate[]
private LineSegmentIndex
-
Constructor Summary
ConstructorsConstructorDescriptionTaggedLineStringSimplifier
(LineSegmentIndex inputIndex, LineSegmentIndex outputIndex) -
Method Summary
Modifier and TypeMethodDescriptionprivate int
findFurthestPoint
(Coordinate[] pts, int i, int j, double[] maxDistance) private LineSegment
flatten
(int start, int end) Flattens a section of the line between indexesstart
andend
, replacing them with a line between the endpoints.private boolean
hasBadInputIntersection
(TaggedLineString parentLine, int[] sectionIndex, LineSegment candidateSeg) private boolean
hasBadIntersection
(TaggedLineString parentLine, int[] sectionIndex, LineSegment candidateSeg) private boolean
hasBadOutputIntersection
(LineSegment candidateSeg) private boolean
hasInteriorIntersection
(LineSegment seg0, LineSegment seg1) private static boolean
isInLineSection
(TaggedLineString line, int[] sectionIndex, TaggedLineSegment seg) Tests whether a segment is in a section of a TaggedLineStringprivate void
remove
(TaggedLineString line, int start, int end) Remove the segs in the section of the linevoid
setDistanceTolerance
(double distanceTolerance) Sets the distance tolerance for the simplification.(package private) void
simplify
(TaggedLineString line) Simplifies the givenTaggedLineString
using the distance tolerance specified.private void
simplifySection
(int i, int j, int depth)
-
Field Details
-
li
-
inputIndex
-
outputIndex
-
line
-
linePts
-
distanceTolerance
private double distanceTolerance
-
-
Constructor Details
-
TaggedLineStringSimplifier
-
-
Method Details
-
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
Simplifies the givenTaggedLineString
using the distance tolerance specified.- Parameters:
line
- the linestring to simplify
-
simplifySection
private void simplifySection(int i, int j, int depth) -
findFurthestPoint
-
flatten
Flattens a section of the line between indexesstart
andend
, 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 sectionend
- the end index of the flattened section- Returns:
- the new segment created
-
hasBadIntersection
private boolean hasBadIntersection(TaggedLineString parentLine, int[] sectionIndex, LineSegment candidateSeg) -
hasBadOutputIntersection
-
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:
-
hasInteriorIntersection
-
remove
Remove the segs in the section of the line- Parameters:
line
-pts
-sectionStartIndex
-sectionEndIndex
-
-