GEOS
3.3.9
|
00001 /********************************************************************** 00002 * $Id: SnapIfNeededOverlayOp.h 3224 2011-02-21 12:03:25Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2009 2011 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 r320 (JTS-1.12) 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> // for enums 00024 00025 #include <memory> // for auto_ptr 00026 00027 // Forward declarations 00028 namespace geos { 00029 namespace geom { 00030 class Geometry; 00031 } 00032 } 00033 00034 namespace geos { 00035 namespace operation { // geos::operation 00036 namespace overlay { // geos::operation::overlay 00037 namespace snap { // geos::operation::overlay::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 // Declare type as noncopyable 00105 SnapIfNeededOverlayOp(const SnapIfNeededOverlayOp& other); 00106 SnapIfNeededOverlayOp& operator=(const SnapIfNeededOverlayOp& rhs); 00107 }; 00108 00109 00110 } // namespace geos::operation::overlay::snap 00111 } // namespace geos::operation::overlay 00112 } // namespace geos::operation 00113 } // namespace geos 00114 00115 #endif // ndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H 00116 00117 /********************************************************************** 00118 * $Log$ 00119 **********************************************************************/ 00120