GEOS  3.8.0dev
SharedPathsOp.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2010 Sandro Santilli <strk@kbt.io>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************
14  *
15  * Last port: original work
16  *
17  * Developed by Sandro Santilli (strk@kbt.io)
18  * for Faunalia (http://www.faunalia.it)
19  * with funding from Regione Toscana - Settore SISTEMA INFORMATIVO
20  * TERRITORIALE ED AMBIENTALE - for the project: "Sviluppo strumenti
21  * software per il trattamento di dati geografici basati su QuantumGIS
22  * e Postgis (CIG 0494241492)"
23  *
24  **********************************************************************/
25 
26 #ifndef GEOS_OPERATION_SHAREDPATHSOP_H
27 #define GEOS_OPERATION_SHAREDPATHSOP_H
28 
29 #include <geos/export.h> // for GEOS_DLL
30 
31 #include <vector>
32 
33 // Forward declarations
34 namespace geos {
35 namespace geom {
36 class LineString;
37 class Geometry;
38 class GeometryFactory;
39 }
40 }
41 
42 
43 namespace geos {
44 namespace operation { // geos.operation
45 namespace sharedpaths { // geos.operation.sharedpaths
46 
64 class GEOS_DLL SharedPathsOp {
65 public:
66 
68  typedef std::vector<geom::LineString*> PathList;
69 
71  //
88  static void sharedPathsOp(const geom::Geometry& g1,
89  const geom::Geometry& g2,
90  PathList& sameDirection,
91  PathList& oppositeDirection);
92 
94  //
101  SharedPathsOp(const geom::Geometry& g1, const geom::Geometry& g2);
102 
104  //
115  void getSharedPaths(PathList& sameDirection, PathList& oppositeDirection);
116 
118  static void clearEdges(PathList& from);
119 
120 private:
121 
123  //
128  void findLinearIntersections(PathList& to);
129 
131  //
134  bool isForward(const geom::LineString& edge,
135  const geom::Geometry& geom);
136 
139  bool
140  isSameDirection(const geom::LineString& edge)
141  {
142  return (isForward(edge, _g1) == isForward(edge, _g2));
143  }
144 
146  void checkLinealInput(const geom::Geometry& g);
147 
148  const geom::Geometry& _g1;
149  const geom::Geometry& _g2;
150  const geom::GeometryFactory& _gf;
151 
152  // Declare type as noncopyable
153  SharedPathsOp(const SharedPathsOp& other) = delete;
154  SharedPathsOp& operator=(const SharedPathsOp& rhs) = delete;
155 
156 };
157 
158 } // namespace geos.operation.sharedpaths
159 } // namespace geos.operation
160 } // namespace geos
161 
162 #endif
163 
std::vector< geom::LineString * > PathList
LineString vector (list of edges)
Definition: SharedPathsOp.h:68
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:188
Find shared paths among two linear Geometry objects.
Definition: SharedPathsOp.h:64
Definition: LineString.h:68
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition: GeometryFactory.h:66
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25