- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# SharedPathsOp.h

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