Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | Related Pages

GeometrySnapper.h

00001 /**********************************************************************
00002  * $Id: GeometrySnapper.h 3225 2011-02-21 14:02:37Z strk $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2009-2010  Sandro Santilli <strk@keybit.net>
00008  * Copyright (C) 2006 Refractions Research Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  ***********************************************************************
00016  *
00017  * Last port: operation/overlay/snap/GeometrySnapper.java r320 (JTS-1.12)
00018  *
00019  **********************************************************************/
00020 
00021 #ifndef GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00022 #define GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00023 
00024 #include <geos/geom/Coordinate.h>
00025 
00026 #include <memory>
00027 #include <vector>
00028 
00029 // Forward declarations
00030 namespace geos {
00031         namespace geom { 
00032                 //class PrecisionModel;
00033                 class Geometry;
00034                 class CoordinateSequence;
00035         }
00036 }
00037 
00038 namespace geos {
00039 namespace operation { // geos::operation
00040 namespace overlay { // geos::operation::overlay
00041 namespace snap { // geos::operation::overlay::snap
00042 
00058 class GEOS_DLL GeometrySnapper {
00059 
00060 public:
00061 
00062         typedef std::auto_ptr<geom::Geometry> GeomPtr;
00063         typedef std::pair<GeomPtr, GeomPtr> GeomPtrPair;
00064 
00074         static void snap(const geom::Geometry& g0,
00075                                 const geom::Geometry& g1,
00076                                 double snapTolerance, GeomPtrPair& ret);
00077 
00078         static GeomPtr snapToSelf(const geom::Geometry& g0,
00079                                 double snapTolerance, bool cleanResult);
00080 
00086         GeometrySnapper(const geom::Geometry& g)
00087                 :
00088                 srcGeom(g)
00089         {
00090         }
00091 
00101         std::auto_ptr<geom::Geometry> snapTo(const geom::Geometry& g,
00102                                              double snapTolerance);
00103 
00113         std::auto_ptr<geom::Geometry> snapToSelf(double snapTolerance,
00114                                                  bool cleanResult);
00115 
00123         static double computeOverlaySnapTolerance(const geom::Geometry& g);
00124 
00125         static double computeSizeBasedSnapTolerance(const geom::Geometry& g);
00126 
00130         static double computeOverlaySnapTolerance(const geom::Geometry& g1,
00131                         const geom::Geometry& g2);
00132 
00133 
00134 private:
00135 
00136         // eventually this will be determined from the geometry topology
00137         //static const double snapTol; //  = 0.000001;
00138 
00139         static const double snapPrecisionFactor; //  = 10e-10
00140 
00141         const geom::Geometry& srcGeom;
00142 
00144         std::auto_ptr<geom::Coordinate::ConstVect> extractTargetCoordinates(
00145                         const geom::Geometry& g);
00146 
00147     // Declare type as noncopyable
00148     GeometrySnapper(const GeometrySnapper& other);
00149     GeometrySnapper& operator=(const GeometrySnapper& rhs);
00150 };
00151 
00152 
00153 } // namespace geos::operation::overlay::snap
00154 } // namespace geos::operation::overlay
00155 } // namespace geos::operation
00156 } // namespace geos
00157 
00158 #endif // GEOS_OP_OVERLAY_SNAP_GEOMETRYSNAPPER_H
00159 

Generated on Sun Aug 21 23:21:01 2011 for GEOS by  doxygen 1.3.9.1