SnapIfNeededOverlayOp.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2009 2011  Sandro Santilli <strk@keybit.net>
00007  *
00008  * This is free software; you can redistribute and/or modify it under
00009  * the terms of the GNU Lesser General Public Licence as published
00010  * by the Free Software Foundation. 
00011  * See the COPYING file for more information.
00012  *
00013  ***********************************************************************
00014  *
00015  * Last port: operation/overlay/snap/SnapIfNeededOverlayOp.java r320 (JTS-1.12)
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> // for enums 
00023 
00024 #include <memory> // for auto_ptr
00025 
00026 // Forward declarations
00027 namespace geos {
00028         namespace geom {
00029                 class Geometry;
00030         }
00031 }
00032 
00033 namespace geos {
00034 namespace operation { // geos::operation
00035 namespace overlay { // geos::operation::overlay
00036 namespace snap { // geos::operation::overlay::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     // Declare type as noncopyable
00104     SnapIfNeededOverlayOp(const SnapIfNeededOverlayOp& other);
00105     SnapIfNeededOverlayOp& operator=(const SnapIfNeededOverlayOp& rhs);
00106 };
00107  
00108 
00109 } // namespace geos::operation::overlay::snap
00110 } // namespace geos::operation::overlay
00111 } // namespace geos::operation
00112 } // namespace geos
00113 
00114 #endif // ndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H

Generated on 23 Sep 2013 for GEOS by  doxygen 1.4.7