Class LineStringSnapper

Hierarchy: Object , LineStringSnapper
public class 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.

Authors:
Martin Davis

Other

  • version: 1.7
public LineStringSnapper(LineString srcLine, double snapTolerance)
Creates a new snapper using the points in the given LineString as source snap points.
Parameters:
srcLine - srcLine a LineString to snap (may be empty)
snapTolerance - snapTolerance the snap tolerance to use
public LineStringSnapper(Coordinate[] srcPts, double snapTolerance)
Creates a new snapper using the given points as source points to be snapped.
Parameters:
srcPts - srcPts the points to snap
snapTolerance - snapTolerance the snap tolerance to use
public void setAllowSnappingToSourceVertices(boolean allowSnappingToSourceVertices)
public Coordinate[] snapTo(Coordinate[] snapPts)
Snaps the vertices and segments of the source LineString to the given set of snap vertices.
Parameters:
snapPts - snapPts the vertices to snap to
Returns:
a list of the snapped points