00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00022 #define GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00023
00024 #include <geos/geom/Coordinate.h>
00025
00026 #include <memory>
00027 #include <vector>
00028
00029
00030 namespace geos {
00031 namespace geom {
00032
00033 class Geometry;
00034 class CoordinateSequence;
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 typedef std::pair<GeomPtr, GeomPtr> GeomPtrPair;
00064
00074 static void snap(const geom::Geometry& g0,
00075 const geom::Geometry& g1,
00076 double snapTolerance, GeomPtrPair& ret);
00077
00078 static GeomPtr snapToSelf(const geom::Geometry& g0,
00079 double snapTolerance, bool cleanResult);
00080
00086 GeometrySnapper(const geom::Geometry& g)
00087 :
00088 srcGeom(g)
00089 {
00090 }
00091
00101 std::auto_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
00102 double snapTolerance);
00103
00113 std::auto_ptr<geom::Geometry> snapToSelf(double snapTolerance,
00114 bool cleanResult);
00115
00123 static double computeOverlaySnapTolerance(const geom::Geometry& g);
00124
00125 static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
00126
00130 static double computeOverlaySnapTolerance(const geom::Geometry& g1,
00131 const geom::Geometry& g2);
00132
00133
00134 private:
00135
00136
00137
00138
00139 static const double snapPrecisionFactor;
00140
00141 const geom::Geometry& srcGeom;
00142
00144 std::auto_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
00145 const geom::Geometry& g);
00146
00147
00148 GeometrySnapper(const GeometrySnapper& other);
00149 GeometrySnapper& operator=(const GeometrySnapper& rhs);
00150 };
00151
00152
00153 }
00154 }
00155 }
00156 }
00157
00158 #endif // GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00159