GEOS
3.9.1dev
|
Snaps the vertices and segments of a LineString to a set of target snap vertices. More...
#include <LineStringSnapper.h>
Public Member Functions | |
LineStringSnapper (const geom::Coordinate::Vect &nSrcPts, double nSnapTol) | |
std::unique_ptr< geom::Coordinate::Vect > | snapTo (const geom::Coordinate::ConstVect &snapPts) |
void | setAllowSnappingToSourceVertices (bool allow) |
Private Member Functions | |
void | snapVertices (geom::CoordinateList &srcCoords, const geom::Coordinate::ConstVect &snapPts) |
geom::Coordinate::ConstVect::const_iterator | findSnapForVertex (const geom::Coordinate &pt, const geom::Coordinate::ConstVect &snapPts) |
void | snapSegments (geom::CoordinateList &srcCoords, const geom::Coordinate::ConstVect &snapPts) |
Snap segments of the source to nearby snap vertices. More... | |
geom::CoordinateList::iterator | findSegmentToSnap (const geom::Coordinate &snapPt, geom::CoordinateList::iterator from, geom::CoordinateList::iterator too_far) |
Finds a src segment which snaps to (is close to) the given snap point. More... | |
geom::CoordinateList::iterator | findVertexToSnap (const geom::Coordinate &snapPt, geom::CoordinateList::iterator from, geom::CoordinateList::iterator too_far) |
LineStringSnapper (const LineStringSnapper &other)=delete | |
LineStringSnapper & | operator= (const LineStringSnapper &rhs)=delete |
Private Attributes | |
const geom::Coordinate::Vect & | srcPts |
double | snapTolerance |
bool | allowSnappingToSourceVertices |
bool | isClosed |
Snaps the vertices and segments of a LineString to a set of target snap vertices.
A snapping distance tolerance is used to control where snapping is performed.
Definition at line 51 of file LineStringSnapper.h.
|
inline |
Creates a new snapper using the given points as source points to be snapped.
nSrcPts | the points to snap |
nSnapTol | the snap tolerance to use |
Definition at line 62 of file LineStringSnapper.h.
|
privatedelete |
|
private |
Finds a src segment which snaps to (is close to) the given snap point.
Only a single segment is selected for snapping. This prevents multiple segments snapping to the same snap vertex, which would almost certainly cause invalid geometry to be created. (The heuristic approach to snapping used here is really only appropriate when snap pts snap to a unique spot on the src geometry.)
Also, if the snap vertex occurs as a vertex in the src coordinate list, no snapping is performed (may be changed using setAllowSnappingToSourceVertices).
from | an iterator to first point of first segment to be checked |
too_far | an iterator to last point of last segment to be checked |
|
private |
|
private |
|
privatedelete |
|
inline |
Definition at line 77 of file LineStringSnapper.h.
|
private |
Snap segments of the source to nearby snap vertices.
Source segments are "cracked" at a snap vertex. A single input segment may be snapped several times to different snap vertices.
For each distinct snap vertex, at most one source segment is snapped to. This prevents "cracking" multiple segments at the same point, which would likely cause topology collapse when being used on polygonal linework.
srcCoords | the coordinates of the source linestring to be snapped the object will be modified (coords snapped) |
snapPts | the target snap vertices |
std::unique_ptr<geom::Coordinate::Vect> geos::operation::overlay::snap::LineStringSnapper::snapTo | ( | const geom::Coordinate::ConstVect & | snapPts | ) |
|
private |
|
private |
Definition at line 88 of file LineStringSnapper.h.
|
private |
Definition at line 89 of file LineStringSnapper.h.
|
private |
Definition at line 86 of file LineStringSnapper.h.
|
private |
Definition at line 84 of file LineStringSnapper.h.