00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
00020 #define GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
00021
00022 #include <geos/operation/overlay/OverlayOp.h>
00023
00024 #include <memory>
00025
00026
00027 namespace geos {
00028 namespace geom {
00029 class Geometry;
00030 }
00031 }
00032
00033 namespace geos {
00034 namespace operation {
00035 namespace overlay {
00036 namespace snap {
00037
00049 class SnapIfNeededOverlayOp
00050 {
00051
00052 public:
00053
00054 static std::auto_ptr<geom::Geometry>
00055 overlayOp(const geom::Geometry& g0, const geom::Geometry& g1,
00056 OverlayOp::OpCode opCode)
00057 {
00058 SnapIfNeededOverlayOp op(g0, g1);
00059 return op.getResultGeometry(opCode);
00060 }
00061
00062 static std::auto_ptr<geom::Geometry>
00063 intersection(const geom::Geometry& g0, const geom::Geometry& g1)
00064 {
00065 return overlayOp(g0, g1, OverlayOp::opINTERSECTION);
00066 }
00067
00068 static std::auto_ptr<geom::Geometry>
00069 Union(const geom::Geometry& g0, const geom::Geometry& g1)
00070 {
00071 return overlayOp(g0, g1, OverlayOp::opUNION);
00072 }
00073
00074 static std::auto_ptr<geom::Geometry>
00075 difference(const geom::Geometry& g0, const geom::Geometry& g1)
00076 {
00077 return overlayOp(g0, g1, OverlayOp::opDIFFERENCE);
00078 }
00079
00080 static std::auto_ptr<geom::Geometry>
00081 symDifference(const geom::Geometry& g0, const geom::Geometry& g1)
00082 {
00083 return overlayOp(g0, g1, OverlayOp::opSYMDIFFERENCE);
00084 }
00085
00086 SnapIfNeededOverlayOp(const geom::Geometry& g1, const geom::Geometry& g2)
00087 :
00088 geom0(g1),
00089 geom1(g2)
00090 {
00091 }
00092
00093
00094 typedef std::auto_ptr<geom::Geometry> GeomPtr;
00095
00096 GeomPtr getResultGeometry(OverlayOp::OpCode opCode);
00097
00098 private:
00099
00100 const geom::Geometry& geom0;
00101 const geom::Geometry& geom1;
00102
00103
00104 SnapIfNeededOverlayOp(const SnapIfNeededOverlayOp& other);
00105 SnapIfNeededOverlayOp& operator=(const SnapIfNeededOverlayOp& rhs);
00106 };
00107
00108
00109 }
00110 }
00111 }
00112 }
00113
00114 #endif // ndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H