Class LineStringSnapper
java.lang.Object
org.locationtech.jts.operation.overlay.snap.LineStringSnapper
Snaps the vertices and segments of a
LineString
to a set of target snap vertices.
A snap distance tolerance is used to control where snapping is performed.
The implementation handles empty geometry and empty snap vertex sets.
- Version:
- 1.7
- Author:
- Martin Davis
-
Constructor Summary
ConstructorsConstructorDescriptionLineStringSnapper
(Coordinate[] srcPts, double snapTolerance) Creates a new snapper using the given points as source points to be snapped.LineStringSnapper
(LineString srcLine, double snapTolerance) Creates a new snapper using the points in the givenLineString
as source snap points. -
Method Summary
Modifier and TypeMethodDescriptionvoid
setAllowSnappingToSourceVertices
(boolean allowSnappingToSourceVertices) snapTo
(Coordinate[] snapPts) Snaps the vertices and segments of the source LineString to the given set of snap vertices.
-
Constructor Details
-
LineStringSnapper
Creates a new snapper using the points in the givenLineString
as source snap points.- Parameters:
srcLine
- a LineString to snap (may be empty)snapTolerance
- the snap tolerance to use
-
LineStringSnapper
Creates a new snapper using the given points as source points to be snapped.- Parameters:
srcPts
- the points to snapsnapTolerance
- the snap tolerance to use
-
-
Method Details
-
setAllowSnappingToSourceVertices
public void setAllowSnappingToSourceVertices(boolean allowSnappingToSourceVertices) -
snapTo
Snaps the vertices and segments of the source LineString to the given set of snap vertices.- Parameters:
snapPts
- the vertices to snap to- Returns:
- a list of the snapped points
-