GEOS 3.4.2

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

GeometrySnapper.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009-2010 Sandro Santilli <strk@keybit.net>
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
58 class GEOS_DLL GeometrySnapper {
59
60 public:
61
62 typedef std::auto_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
85 GeometrySnapper(const geom::Geometry& g)
86 :
87 srcGeom(g)
88 {
89 }
90
100 std::auto_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
101 double snapTolerance);
102
112 std::auto_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
140 const geom::Geometry& srcGeom;
141
143 std::auto_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
144 const geom::Geometry& g);
145
146 // Declare type as noncopyable
147 GeometrySnapper(const GeometrySnapper& other);
148 GeometrySnapper& operator=(const GeometrySnapper& rhs);
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