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
00047 class GEOS_DLL GeometrySnapper {
00048
00049 public:
00050
00051 typedef std::auto_ptr<geom::Geometry> GeomPtr;
00052 typedef std::pair<GeomPtr, GeomPtr> GeomPtrPair;
00053
00063 static void snap(const geom::Geometry& g0,
00064 const geom::Geometry& g1,
00065 double snapTolerance, GeomPtrPair& ret);
00066
00072 GeometrySnapper(const geom::Geometry& g)
00073 :
00074 srcGeom(g)
00075 {
00076 }
00077
00087 std::auto_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
00088 double snapTolerance);
00089
00097 static double computeOverlaySnapTolerance(const geom::Geometry& g);
00098
00099 static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
00100
00104 static double computeOverlaySnapTolerance(const geom::Geometry& g1,
00105 const geom::Geometry& g2);
00106
00107
00108 private:
00109
00110
00111
00112
00113 static const double snapPrecisionFactor;
00114
00115 const geom::Geometry& srcGeom;
00116
00118 std::auto_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
00119 const geom::Geometry& g);
00120
00121
00122 GeometrySnapper(const GeometrySnapper& other);
00123 GeometrySnapper& operator=(const GeometrySnapper& rhs);
00124 };
00125
00126
00127 }
00128 }
00129 }
00130 }
00131
00132 #endif // GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00133