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