00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00021 #define GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00022
00023 #include <geos/geom/Coordinate.h>
00024
00025 #include <memory>
00026 #include <vector>
00027
00028
00029 namespace geos {
00030 namespace geom {
00031
00032 class Geometry;
00033 class CoordinateSequence;
00034 struct GeomPtrPair;
00035 }
00036 }
00037
00038 namespace geos {
00039 namespace operation {
00040 namespace overlay {
00041 namespace snap {
00042
00058 class GEOS_DLL GeometrySnapper {
00059
00060 public:
00061
00062 typedef std::auto_ptr<geom::Geometry> GeomPtr;
00063
00073 static void snap(const geom::Geometry& g0,
00074 const geom::Geometry& g1,
00075 double snapTolerance, geom::GeomPtrPair& ret);
00076
00077 static GeomPtr snapToSelf(const geom::Geometry& g0,
00078 double snapTolerance, bool cleanResult);
00079
00085 GeometrySnapper(const geom::Geometry& g)
00086 :
00087 srcGeom(g)
00088 {
00089 }
00090
00100 std::auto_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
00101 double snapTolerance);
00102
00112 std::auto_ptr<geom::Geometry> snapToSelf(double snapTolerance,
00113 bool cleanResult);
00114
00122 static double computeOverlaySnapTolerance(const geom::Geometry& g);
00123
00124 static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
00125
00129 static double computeOverlaySnapTolerance(const geom::Geometry& g1,
00130 const geom::Geometry& g2);
00131
00132
00133 private:
00134
00135
00136
00137
00138 static const double snapPrecisionFactor;
00139
00140 const geom::Geometry& srcGeom;
00141
00143 std::auto_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
00144 const geom::Geometry& g);
00145
00146
00147 GeometrySnapper(const GeometrySnapper& other);
00148 GeometrySnapper& operator=(const GeometrySnapper& rhs);
00149 };
00150
00151
00152 }
00153 }
00154 }
00155 }
00156
00157 #endif // GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00158