public class GeometrySnapper extends Object
Geometry to another Geometry's vertices. A snap distance tolerance is used to control where snapping is performed. Snapping one geometry to another can improve robustness for overlay operations by eliminating nearly-coincident edges (which cause problems during noding and intersection calculation). Too much snapping can result in invalid topology beging created, so the number and location of snapped vertices is decided using heuristics to determine when it is safe to snap. This can result in some potential snaps being omitted, however.
| Constructor and Description |
|---|
GeometrySnapper(Geometry
Creates a new snapper acting on the given geometry
|
| Modifier and Type | Method and Description |
|---|---|
static double |
computeOverlaySnapTolerance(Geometry
Estimates the snap tolerance for a Geometry, taking into account its precision model.
|
static double |
computeOverlaySnapTolerance(Geometry
|
static double |
computeSizeBasedSnapTolerance(Geometry
|
Coordinate |
extractTargetCoordinates(Geometry
|
static Geometry |
snap(Geometry
Snaps two geometries together with a given tolerance.
|
Geometry |
snapTo(Geometry
Snaps the vertices in the component
LineStrings of the source geometry to the vertices of the given snap geometry.
|
Geometry |
snapToSelf(double snapTolerance, boolean cleanResult)
Snaps the vertices in the component
LineStrings of the source geometry to the vertices of the given snap geometry.
|
static Geometry |
snapToSelf(Geometry
|
public GeometrySnapper(GeometrysrcGeom)
srcGeom - the geometry to snap
public static double computeOverlaySnapTolerance(Geometryg)
g - a Geometry
public static double computeSizeBasedSnapTolerance(Geometryg)
public static double computeOverlaySnapTolerance(Geometryg0, Geometry g1)
public static Geometry[] snap(Geometry g0, Geometry g1, double snapTolerance)
g0 - a geometry to snap
g1 - a geometry to snap
snapTolerance - the tolerance to use
public GeometrysnapTo(Geometry snapGeom, double snapTolerance)
LineStrings of the source geometry to the vertices of the given snap geometry.
snapGeom - a geometry to snap the source to
public GeometrysnapToSelf(double snapTolerance, boolean cleanResult)
LineStrings of the source geometry to the vertices of the given snap geometry.
snapTolerance - the snapping tolerance
cleanResult - whether the result should be made valid
public Coordinate[] extractTargetCoordinates(Geometry g)