GEOS 3.15.0dev
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#pragma once
21
22#include <geos/geom/Coordinate.h>
23
24#include <memory>
25#include <vector>
26
27#include "geos/util.h"
28
29// Forward declarations
30namespace geos {
31namespace geom {
32//class PrecisionModel;
33class Geometry;
34class CoordinateSequence;
35struct GeomPtrPair;
36}
37}
38
39namespace geos {
40namespace operation { // geos::operation
41namespace overlay { // geos::operation::overlay
42namespace snap { // geos::operation::overlay::snap
43
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
96 std::unique_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
97 double snapTolerance);
98
108 std::unique_ptr<geom::Geometry> snapToSelf(double snapTolerance,
109 bool cleanResult);
110
119
120 static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
121
126 const geom::Geometry& g2);
127
128
129private:
130
131 // eventually this will be determined from the geometry topology
132 //static const double snapTol; // = 0.000001;
133
134 static const double snapPrecisionFactor; // = 10e-10
135
136 const geom::Geometry& srcGeom;
137
139 static std::unique_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
140 const geom::Geometry& g);
141
142 // Declare type as noncopyable
143 GeometrySnapper(const GeometrySnapper& other) = delete;
144 GeometrySnapper& operator=(const GeometrySnapper& rhs) = delete;
145};
146
147
148} // namespace geos::operation::overlay::snap
149} // namespace geos::operation::overlay
150} // namespace geos::operation
151} // namespace geos
152
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
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.
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 geos.h:38