GEOS 3.9.1
GeometrySnapper.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009-2010 Sandro Santilli <strk@kbt.io>
7 * Copyright (C) 2006 Refractions Research Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 ***********************************************************************
15 *
16 * Last port: operation/overlay/snap/GeometrySnapper.java r320 (JTS-1.12)
17 *
18 **********************************************************************/
19
20#ifndef GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
21#define GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
22
23#include <geos/geom/Coordinate.h>
24
25#include <memory>
26#include <vector>
27
28// Forward declarations
29namespace geos {
30namespace geom {
31//class PrecisionModel;
32class Geometry;
33class CoordinateSequence;
34struct GeomPtrPair;
35}
36}
37
38namespace geos {
39namespace operation { // geos::operation
40namespace overlay { // geos::operation::overlay
41namespace snap { // geos::operation::overlay::snap
42
58class GEOS_DLL GeometrySnapper {
59
60public:
61
62 typedef std::unique_ptr<geom::Geometry> GeomPtr;
63
73 static void snap(const geom::Geometry& g0,
74 const geom::Geometry& g1,
75 double snapTolerance, geom::GeomPtrPair& ret);
76
77 static GeomPtr snapToSelf(const geom::Geometry& g0,
78 double snapTolerance, bool cleanResult);
79
86 :
87 srcGeom(g)
88 {
89 }
90
100 std::unique_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
101 double snapTolerance);
102
112 std::unique_ptr<geom::Geometry> snapToSelf(double snapTolerance,
113 bool cleanResult);
114
123
124 static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
125
130 const geom::Geometry& g2);
131
132
133private:
134
135 // eventually this will be determined from the geometry topology
136 //static const double snapTol; // = 0.000001;
137
138 static const double snapPrecisionFactor; // = 10e-10
139
140 const geom::Geometry& srcGeom;
141
143 std::unique_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
144 const geom::Geometry& g);
145
146 // Declare type as noncopyable
147 GeometrySnapper(const GeometrySnapper& other) = delete;
148 GeometrySnapper& operator=(const GeometrySnapper& rhs) = delete;
149};
150
151
152} // namespace geos::operation::overlay::snap
153} // namespace geos::operation::overlay
154} // namespace geos::operation
155} // namespace geos
156
157#endif // GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
158
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:188
Snaps the vertices and segments of a geom::Geometry to another Geometry's vertices.
Definition GeometrySnapper.h:58
static void snap(const geom::Geometry &g0, const geom::Geometry &g1, double snapTolerance, geom::GeomPtrPair &ret)
static double computeOverlaySnapTolerance(const geom::Geometry &g1, const geom::Geometry &g2)
Computes the snap tolerance based on input geometries;.
static double computeOverlaySnapTolerance(const geom::Geometry &g)
Estimates the snap tolerance for a Geometry, taking into account its precision model.
GeometrySnapper(const geom::Geometry &g)
Definition GeometrySnapper.h:85
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...
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...
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26