GEOS  3.9.1dev
GeometrySnapper.h
Go to the documentation of this file.
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
29 namespace geos {
30 namespace geom {
31 //class PrecisionModel;
32 class Geometry;
33 class CoordinateSequence;
34 struct GeomPtrPair;
35 }
36 }
37 
38 namespace geos {
39 namespace operation { // geos::operation
40 namespace overlay { // geos::operation::overlay
41 namespace snap { // geos::operation::overlay::snap
42 
59 
60 public:
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 
122  static double computeOverlaySnapTolerance(const geom::Geometry& g);
123 
124  static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
125 
129  static double computeOverlaySnapTolerance(const geom::Geometry& g1,
130  const geom::Geometry& g2);
131 
132 
133 private:
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 
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 
#define GEOS_DLL
Definition: export.h:28
std::unique_ptr< geom::Geometry > GeomPtr
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Basic namespace for all GEOS functionalities.
Snaps the vertices and segments of a geom::Geometry to another Geometry&#39;s vertices.