GEOS  3.9.1dev
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
geos::operation::overlay::snap::GeometrySnapper Class Reference

Snaps the vertices and segments of a geom::Geometry to another Geometry's vertices. More...

#include <GeometrySnapper.h>

Collaboration diagram for geos::operation::overlay::snap::GeometrySnapper:
[legend]

Public Types

typedef std::unique_ptr< geom::GeometryGeomPtr
 

Public Member Functions

 GeometrySnapper (const geom::Geometry &g)
 
std::unique_ptr< geom::GeometrysnapTo (const geom::Geometry &g, double snapTolerance)
 Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of the given snap geometry with a given snap tolerance. More...
 
std::unique_ptr< geom::GeometrysnapToSelf (double snapTolerance, bool cleanResult)
 Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of itself with a given snap tolerance and optionally cleaning the result. More...
 

Static Public Member Functions

static void snap (const geom::Geometry &g0, const geom::Geometry &g1, double snapTolerance, geom::GeomPtrPair &ret)
 
static GeomPtr snapToSelf (const geom::Geometry &g0, double snapTolerance, bool cleanResult)
 
static double computeOverlaySnapTolerance (const geom::Geometry &g)
 Estimates the snap tolerance for a Geometry, taking into account its precision model. More...
 
static double computeSizeBasedSnapTolerance (const geom::Geometry &g)
 
static double computeOverlaySnapTolerance (const geom::Geometry &g1, const geom::Geometry &g2)
 Computes the snap tolerance based on input geometries;. More...
 

Private Member Functions

std::unique_ptr< geom::Coordinate::ConstVectextractTargetCoordinates (const geom::Geometry &g)
 Extract target (unique) coordinates. More...
 
 GeometrySnapper (const GeometrySnapper &other)=delete
 
GeometrySnapperoperator= (const GeometrySnapper &rhs)=delete
 

Private Attributes

const geom::GeometrysrcGeom
 

Static Private Attributes

static const double snapPrecisionFactor
 

Detailed Description

Snaps the vertices and segments of a geom::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 being 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.

Definition at line 58 of file GeometrySnapper.h.

Member Typedef Documentation

Definition at line 62 of file GeometrySnapper.h.

Constructor & Destructor Documentation

geos::operation::overlay::snap::GeometrySnapper::GeometrySnapper ( const geom::Geometry g)
inline

Creates a new snapper acting on the given geometry

Parameters
gthe geometry to snap

Definition at line 85 of file GeometrySnapper.h.

geos::operation::overlay::snap::GeometrySnapper::GeometrySnapper ( const GeometrySnapper other)
privatedelete

Member Function Documentation

static double geos::operation::overlay::snap::GeometrySnapper::computeOverlaySnapTolerance ( const geom::Geometry g)
static

Estimates the snap tolerance for a Geometry, taking into account its precision model.

Parameters
ga Geometry
Returns
the estimated snap tolerance
static double geos::operation::overlay::snap::GeometrySnapper::computeOverlaySnapTolerance ( const geom::Geometry g1,
const geom::Geometry g2 
)
static

Computes the snap tolerance based on input geometries;.

static double geos::operation::overlay::snap::GeometrySnapper::computeSizeBasedSnapTolerance ( const geom::Geometry g)
static
std::unique_ptr<geom::Coordinate::ConstVect> geos::operation::overlay::snap::GeometrySnapper::extractTargetCoordinates ( const geom::Geometry g)
private

Extract target (unique) coordinates.

GeometrySnapper& geos::operation::overlay::snap::GeometrySnapper::operator= ( const GeometrySnapper rhs)
privatedelete
static void geos::operation::overlay::snap::GeometrySnapper::snap ( const geom::Geometry g0,
const geom::Geometry g1,
double  snapTolerance,
geom::GeomPtrPair ret 
)
static

Snaps two geometries together with a given tolerance.

Parameters
g0a geometry to snap
g1a geometry to snap
snapTolerancethe tolerance to use
retthe snapped geometries as a pair of smart pointers (output parameter)
std::unique_ptr<geom::Geometry> geos::operation::overlay::snap::GeometrySnapper::snapTo ( const geom::Geometry g,
double  snapTolerance 
)

Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of the given snap geometry with a given snap tolerance.

Parameters
ga geometry to snap the source to
snapTolerance
Returns
a new snapped Geometry
static GeomPtr geos::operation::overlay::snap::GeometrySnapper::snapToSelf ( const geom::Geometry g0,
double  snapTolerance,
bool  cleanResult 
)
static
std::unique_ptr<geom::Geometry> geos::operation::overlay::snap::GeometrySnapper::snapToSelf ( double  snapTolerance,
bool  cleanResult 
)

Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of itself with a given snap tolerance and optionally cleaning the result.

Parameters
snapTolerance
cleanResultclean the result
Returns
a new snapped Geometry

Member Data Documentation

const double geos::operation::overlay::snap::GeometrySnapper::snapPrecisionFactor
staticprivate

Definition at line 138 of file GeometrySnapper.h.

const geom::Geometry& geos::operation::overlay::snap::GeometrySnapper::srcGeom
private

Definition at line 140 of file GeometrySnapper.h.


The documentation for this class was generated from the following file: