GEOS 3.2.2
|
00001 /********************************************************************** 00002 * $Id: SnapIfNeededOverlayOp.h 2809 2009-12-06 01:05:24Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2009 Sandro Santilli <strk@keybit.net> 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 *********************************************************************** 00015 * 00016 * Last port: operation/overlay/snap/SnapIfNeededOverlayOp.java rev 1.1 00017 * (JTS-1.10) 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> // for enums 00025 00026 #include <memory> // for auto_ptr 00027 00028 // Forward declarations 00029 namespace geos { 00030 namespace geom { 00031 class Geometry; 00032 } 00033 } 00034 00035 namespace geos { 00036 namespace operation { // geos::operation 00037 namespace overlay { // geos::operation::overlay 00038 namespace snap { // geos::operation::overlay::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 // Declare type as noncopyable 00106 SnapIfNeededOverlayOp(const SnapIfNeededOverlayOp& other); 00107 SnapIfNeededOverlayOp& operator=(const SnapIfNeededOverlayOp& rhs); 00108 }; 00109 00110 00111 } // namespace geos::operation::overlay::snap 00112 } // namespace geos::operation::overlay 00113 } // namespace geos::operation 00114 } // namespace geos 00115 00116 #endif // ndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H 00117 00118 /********************************************************************** 00119 * $Log$ 00120 **********************************************************************/ 00121