GEOS 3.3.4

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

- File List

GeometrySnapper.h
1 /**********************************************************************
2 * $Id: GeometrySnapper.h 3538 2011-12-09 10:44:54Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2009-2010 Sandro Santilli <strk@keybit.net>
8 * Copyright (C) 2006 Refractions Research Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 ***********************************************************************
16 *
17 * Last port: operation/overlay/snap/GeometrySnapper.java r320 (JTS-1.12)
18 *
19 **********************************************************************/
20
21 #ifndef GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
22 #define GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
23
24 #include <geos/geom/Coordinate.h>
25
26 #include <memory>
27 #include <vector>
28
29 // Forward declarations
30 namespace geos {
31 namespace geom {
32 //class PrecisionModel;
33 class Geometry;
34 class CoordinateSequence;
35 struct GeomPtrPair;
36 }
37 }
38
39 namespace geos {
40 namespace operation { // geos::operation
41 namespace overlay { // geos::operation::overlay
42 namespace snap { // geos::operation::overlay::snap
43
59 class GEOS_DLL GeometrySnapper {
60
61 public:
62
63 typedef std::auto_ptr<geom::Geometry> GeomPtr;
64
74 static void snap(const geom::Geometry& g0,
75 const geom::Geometry& g1,
76 double snapTolerance, geom::GeomPtrPair& ret);
77
78 static GeomPtr snapToSelf(const geom::Geometry& g0,
79 double snapTolerance, bool cleanResult);
80
86 GeometrySnapper(const geom::Geometry& g)
87 :
88 srcGeom(g)
89 {
90 }
91
101 std::auto_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
102 double snapTolerance);
103
113 std::auto_ptr<geom::Geometry> snapToSelf(double snapTolerance,
114 bool cleanResult);
115
123 static double computeOverlaySnapTolerance(const geom::Geometry& g);
124
125 static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
126
130 static double computeOverlaySnapTolerance(const geom::Geometry& g1,
131 const geom::Geometry& g2);
132
133
134 private:
135
136 // eventually this will be determined from the geometry topology
137 //static const double snapTol; // = 0.000001;
138
139 static const double snapPrecisionFactor; // = 10e-10
140
141 const geom::Geometry& srcGeom;
142
144 std::auto_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
145 const geom::Geometry& g);
146
147 // Declare type as noncopyable
148 GeometrySnapper(const GeometrySnapper& other);
149 GeometrySnapper& operator=(const GeometrySnapper& rhs);
150 };
151
152
153 } // namespace geos::operation::overlay::snap
154 } // namespace geos::operation::overlay
155 } // namespace geos::operation
156 } // namespace geos
157
158 #endif // GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
159