GEOS: BufferSubgraph.h Source File

GEOS 3.5.0

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

- File List

BufferSubgraph.h
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
61 class GEOS_DLL BufferSubgraph {
62 private:
63 RightmostEdgeFinder finder;
64
65 std::vector<geomgraph::DirectedEdge*> dirEdgeList;
66
67 std::vector<geomgraph::Node*> nodes;
68
69 geom::Coordinate *rightMostCoord;
70
71 geom::Envelope *env;
72
80 void addReachable(geomgraph::Node *startNode);
81
83 //
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() {return rightMostCoord;}
178
179 inline std::vector<geomgraph::Node*>*
180 BufferSubgraph::getNodes() { return &nodes; }
181
182 inline std::vector<geomgraph::DirectedEdge*>*
183 BufferSubgraph::getDirectedEdges() {
184 return &dirEdgeList;
185 }
186
187 bool BufferSubgraphGT(BufferSubgraph *first, BufferSubgraph *second);
188
189 } // namespace geos::operation::buffer
190 } // namespace geos::operation
191 } // namespace geos
192
193 #ifdef _MSC_VER
194 #pragma warning(pop)
195 #endif
196
197 #endif // ndef GEOS_OP_BUFFER_BUFFERSUBGRAPH_H
198
geos::geom::Envelope
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:53
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
geos::geom::operator<<
GEOS_DLL std::ostream & operator<<(std::ostream &os, const Coordinate &c)
Output function.
geos::geomgraph::DirectedEdge
A directed EdgeEnd.
Definition: geomgraph/DirectedEdge.h:44
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::operation::buffer::RightmostEdgeFinder
A RightmostEdgeFinder find the geomgraph::DirectedEdge in a list which has the highest coordinate...
Definition: RightmostEdgeFinder.h:47
geos::geomgraph::Node
Definition: geomgraph/Node.h:62
geos::operation::buffer::BufferSubgraph
A connected subset of the graph of DirectedEdge and geomgraph::Node.
Definition: BufferSubgraph.h:61