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_SNAPIFNEEDEDOVERLAYOP_H
00022 #define GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
00023
00024 #include <geos/operation/overlay/OverlayOp.h>
00025
00026 #include <memory>
00027
00028
00029 namespace geos {
00030 namespace geom {
00031 class Geometry;
00032 }
00033 }
00034
00035 namespace geos {
00036 namespace operation {
00037 namespace overlay {
00038 namespace snap {
00039
00051 class SnapIfNeededOverlayOp
00052 {
00053
00054 public:
00055
00056 static std::auto_ptr<geom::Geometry>
00057 overlayOp(const geom::Geometry& g0, const geom::Geometry& g1,
00058 OverlayOp::OpCode opCode)
00059 {
00060 SnapIfNeededOverlayOp op(g0, g1);
00061 return op.getResultGeometry(opCode);
00062 }
00063
00064 static std::auto_ptr<geom::Geometry>
00065 intersection(const geom::Geometry& g0, const geom::Geometry& g1)
00066 {
00067 return overlayOp(g0, g1, OverlayOp::opINTERSECTION);
00068 }
00069
00070 static std::auto_ptr<geom::Geometry>
00071 Union(const geom::Geometry& g0, const geom::Geometry& g1)
00072 {
00073 return overlayOp(g0, g1, OverlayOp::opUNION);
00074 }
00075
00076 static std::auto_ptr<geom::Geometry>
00077 difference(const geom::Geometry& g0, const geom::Geometry& g1)
00078 {
00079 return overlayOp(g0, g1, OverlayOp::opDIFFERENCE);
00080 }
00081
00082 static std::auto_ptr<geom::Geometry>
00083 symDifference(const geom::Geometry& g0, const geom::Geometry& g1)
00084 {
00085 return overlayOp(g0, g1, OverlayOp::opSYMDIFFERENCE);
00086 }
00087
00088 SnapIfNeededOverlayOp(const geom::Geometry& g1, const geom::Geometry& g2)
00089 :
00090 geom0(g1),
00091 geom1(g2)
00092 {
00093 }
00094
00095
00096 typedef std::auto_ptr<geom::Geometry> GeomPtr;
00097
00098 GeomPtr getResultGeometry(OverlayOp::OpCode opCode);
00099
00100 private:
00101
00102 const geom::Geometry& geom0;
00103 const geom::Geometry& geom1;
00104
00105
00106 SnapIfNeededOverlayOp(const SnapIfNeededOverlayOp& other);
00107 SnapIfNeededOverlayOp& operator=(const SnapIfNeededOverlayOp& rhs);
00108 };
00109
00110
00111 }
00112 }
00113 }
00114 }
00115
00116 #endif // ndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
00117
00118
00119
00120
00121