SharedPathsOp.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2010      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: original work
00016  *
00017  * Developed by Sandro Santilli (strk@keybit.net)
00018  * for Faunalia (http://www.faunalia.it)
00019  * with funding from Regione Toscana - Settore SISTEMA INFORMATIVO
00020  * TERRITORIALE ED AMBIENTALE - for the project: "Sviluppo strumenti
00021  * software per il trattamento di dati geografici basati su QuantumGIS
00022  * e Postgis (CIG 0494241492)"
00023  *
00024  **********************************************************************/
00025 
00026 #ifndef GEOS_OPERATION_SHAREDPATHSOP_H
00027 #define GEOS_OPERATION_SHAREDPATHSOP_H
00028 
00029 #include <geos/export.h> // for GEOS_DLL
00030 
00031 #include <vector> 
00032 
00033 // Forward declarations
00034 namespace geos {
00035   namespace geom {
00036     class LineString;
00037     class Geometry;
00038     class GeometryFactory;
00039   }
00040 }
00041 
00042 
00043 namespace geos {
00044 namespace operation { // geos.operation
00045 namespace sharedpaths { // geos.operation.sharedpaths
00046 
00064 class GEOS_DLL SharedPathsOp
00065 {
00066 public:
00067 
00069   typedef std::vector<geom::LineString*> PathList;
00070 
00072   //
00089   static void sharedPathsOp(const geom::Geometry& g1,
00090                             const geom::Geometry& g2,
00091                             PathList& sameDirection,
00092                             PathList& oppositeDirection);
00093 
00095   //
00102   SharedPathsOp(const geom::Geometry& g1, const geom::Geometry& g2);
00103 
00105   //
00116   void getSharedPaths(PathList& sameDirection, PathList& oppositeDirection);
00117 
00119   static void clearEdges(PathList& from);
00120 
00121 private:
00122 
00124   //
00129   void findLinearIntersections(PathList& to);
00130 
00132   //
00135   bool isForward(const geom::LineString& edge,
00136                  const geom::Geometry& geom);
00137 
00140   bool isSameDirection(const geom::LineString& edge) {
00141     return (isForward(edge, _g1) == isForward(edge, _g2));
00142   }
00143 
00145   void checkLinealInput(const geom::Geometry& g);
00146 
00147   const geom::Geometry& _g1;
00148   const geom::Geometry& _g2;
00149   const geom::GeometryFactory& _gf;
00150 
00151   // Declare type as noncopyable
00152   SharedPathsOp(const SharedPathsOp& other);
00153   SharedPathsOp& operator=(const SharedPathsOp& rhs);
00154 
00155 };
00156 
00157 } // namespace geos.operation.sharedpaths
00158 } // namespace geos.operation
00159 } // namespace geos
00160 
00161 #endif
00162 

Generated on 23 Sep 2013 for GEOS by  doxygen 1.4.7