GEOS  3.9.1dev
BufferSubgraph.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2006 Refractions Research Inc.
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: operation/buffer/BufferSubgraph.java r378 (JTS-1.12)
16  *
17  **********************************************************************/
18 
19 #ifndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
20 #define GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
21 
22 #include <geos/export.h>
23 
24 #include <geos/operation/buffer/RightmostEdgeFinder.h> // for composition
25 
26 #include <vector>
27 #include <set>
28 
29 #ifdef _MSC_VER
30 #pragma warning(push)
31 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
32 #endif
33 
34 // Forward declarations
35 namespace geos {
36 namespace geom {
37 class Coordinate;
38 class Envelope;
39 }
40 namespace algorithm {
41 class CGAlgorithms;
42 }
43 namespace geomgraph {
44 class DirectedEdge;
45 class Node;
46 }
47 }
48 
49 namespace geos {
50 namespace operation { // geos.operation
51 namespace buffer { // geos.operation.buffer
52 
62 private:
64 
65  std::vector<geomgraph::DirectedEdge*> dirEdgeList;
66 
67  std::vector<geomgraph::Node*> nodes;
68 
70 
72 
80  void addReachable(geomgraph::Node* startNode);
81 
87  void add(geomgraph::Node* node, std::vector<geomgraph::Node*>* nodeStack);
88 
89  void clearVisitedEdges();
90 
97  // <FIX> MD - use iteration & queue rather than recursion, for speed and robustness
98  void computeDepths(geomgraph::DirectedEdge* startEdge);
99 
100  void computeNodeDepth(geomgraph::Node* n);
101 
102  void copySymDepths(geomgraph::DirectedEdge* de);
103 
104  bool contains(std::set<geomgraph::Node*>& nodes, geomgraph::Node* node);
105 
106 public:
107 
108  friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
109 
110  BufferSubgraph();
111 
112  ~BufferSubgraph();
113 
114  std::vector<geomgraph::DirectedEdge*>* getDirectedEdges();
115 
116  std::vector<geomgraph::Node*>* getNodes();
117 
121  geom::Coordinate* getRightmostCoordinate();
122 
131  void create(geomgraph::Node* node);
132 
133  void computeDepth(int outsideDepth);
134 
146  void findResultEdges();
147 
162  int compareTo(BufferSubgraph*);
163 
170  geom::Envelope* getEnvelope();
171 };
172 
173 std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
174 
175 // INLINES
176 inline geom::Coordinate*
177 BufferSubgraph::getRightmostCoordinate()
178 {
179  return rightMostCoord;
180 }
181 
182 inline std::vector<geomgraph::Node*>*
183 BufferSubgraph::getNodes()
184 {
185  return &nodes;
186 }
187 
188 inline std::vector<geomgraph::DirectedEdge*>*
189 BufferSubgraph::getDirectedEdges()
190 {
191  return &dirEdgeList;
192 }
193 
194 bool BufferSubgraphGT(BufferSubgraph* first, BufferSubgraph* second);
195 
196 } // namespace geos::operation::buffer
197 } // namespace geos::operation
198 } // namespace geos
199 
200 #ifdef _MSC_VER
201 #pragma warning(pop)
202 #endif
203 
204 #endif // ndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
205 
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
bool BufferSubgraphGT(BufferSubgraph *first, BufferSubgraph *second)
std::vector< geomgraph::Node * > nodes
std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
Basic namespace for all GEOS functionalities.
A RightmostEdgeFinder find the geomgraph::DirectedEdge in a list which has the highest coordinate...
The node component of a geometry graph.
A connected subset of the graph of DirectedEdge and geomgraph::Node.
std::vector< geomgraph::DirectedEdge * > dirEdgeList