GeometrySnapper.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2009-2010 Sandro Santilli <strk@kbt.io>
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
***********************************************************************
*
* Last port: operation/overlay/snap/GeometrySnapper.java r320 (JTS-1.12)
*
**********************************************************************/
#pragma once
#include <geos/geom/Coordinate.h>
#include <memory>
#include <vector>
// Forward declarations
namespace geos {
namespace geom {
//class PrecisionModel;
class Geometry;
class CoordinateSequence;
struct GeomPtrPair;
}
}
namespace geos {
namespace operation { // geos::operation
namespace overlay { // geos::operation::overlay
namespace snap { // geos::operation::overlay::snap
class GEOS_DLL GeometrySnapper {
public:
typedef std::unique_ptr<geom::Geometry> GeomPtr;
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);
GeometrySnapper(const geom::Geometry& g)
:
srcGeom(g)
{
}
std::unique_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
double snapTolerance);
std::unique_ptr<geom::Geometry> snapToSelf(double snapTolerance,
bool cleanResult);
static double computeOverlaySnapTolerance(const geom::Geometry& g);
static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
static double computeOverlaySnapTolerance(const geom::Geometry& g1,
const geom::Geometry& g2);
private:
// eventually this will be determined from the geometry topology
//static const double snapTol; // = 0.000001;
static const double snapPrecisionFactor; // = 10e-10
const geom::Geometry& srcGeom;
std::unique_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
const geom::Geometry& g);
// Declare type as noncopyable
GeometrySnapper(const GeometrySnapper& other) = delete;
GeometrySnapper& operator=(const GeometrySnapper& rhs) = delete;
};
} // namespace geos::operation::overlay::snap
} // namespace geos::operation::overlay
} // namespace geos::operation
} // namespace geos
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::operation::overlay::snap::GeometrySnapper::snap
static void snap(const geom::Geometry &g0, const geom::Geometry &g1, double snapTolerance, geom::GeomPtrPair &ret)
geos::operation::overlay::snap::GeometrySnapper::computeOverlaySnapTolerance
static double computeOverlaySnapTolerance(const geom::Geometry &g1, const geom::Geometry &g2)
Computes the snap tolerance based on input geometries;.
geos::operation::overlay::snap::GeometrySnapper::computeOverlaySnapTolerance
static double computeOverlaySnapTolerance(const geom::Geometry &g)
Estimates the snap tolerance for a Geometry, taking into account its precision model.
geos::operation::overlay::snap::GeometrySnapper::GeometrySnapper
GeometrySnapper(const geom::Geometry &g)
Definition GeometrySnapper.h:83
geos::operation::overlay::snap::GeometrySnapper::snapTo
std::unique_ptr< geom::Geometry > snapTo(const geom::Geometry &g, double snapTolerance)
Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of the g...
geos::operation::overlay::snap::GeometrySnapper::snapToSelf
std::unique_ptr< geom::Geometry > snapToSelf(double snapTolerance, bool cleanResult)
Snaps the vertices in the component geom::LineStrings of the source geometry to the vertices of itsel...
geos::geom
Definition Angle.h:26
geos::operation::overlay
Contains classes that perform a topological overlay to compute boolean spatial functions.
Definition namespaces.h:229
geos::operation
Provides classes for implementing operations on geometries.
Definition CleanCoverage.h:34
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38