GEOS 3.9.1
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
35namespace geos {
36namespace geom {
37class Coordinate;
38class Envelope;
39}
40namespace algorithm {
41class CGAlgorithms;
42}
43namespace geomgraph {
44class DirectedEdge;
45class Node;
46}
47}
48
49namespace geos {
50namespace operation { // geos.operation
51namespace buffer { // geos.operation.buffer
52
61class GEOS_DLL BufferSubgraph {
62private:
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
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
106public:
107
108 friend std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
109
111
113
114 std::vector<geomgraph::DirectedEdge*>* getDirectedEdges();
115
116 std::vector<geomgraph::Node*>* getNodes();
117
121 geom::Coordinate* getRightmostCoordinate();
122
132
133 void computeDepth(int outsideDepth);
134
147
163
171};
172
173std::ostream& operator<< (std::ostream& os, const BufferSubgraph& bs);
174
175// INLINES
176inline geom::Coordinate*
178{
179 return rightMostCoord;
180}
181
182inline std::vector<geomgraph::Node*>*
183BufferSubgraph::getNodes()
184{
185 return &nodes;
186}
187
188inline std::vector<geomgraph::DirectedEdge*>*
189BufferSubgraph::getDirectedEdges()
190{
191 return &dirEdgeList;
192}
193
194bool 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
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
An Envelope defines a rectangulare region of the 2D coordinate plane.
Definition: Envelope.h:58
A directed EdgeEnd.
Definition: geomgraph/DirectedEdge.h:45
The node component of a geometry graph.
Definition: geomgraph/Node.h:62
A connected subset of the graph of DirectedEdge and geomgraph::Node.
Definition: BufferSubgraph.h:61
geom::Envelope * getEnvelope()
Computes the envelope of the edges in the subgraph. The envelope is cached after being computed.
void findResultEdges()
Find all edges whose depths indicates that they are in the result area(s).
int compareTo(BufferSubgraph *)
BufferSubgraphs are compared on the x-value of their rightmost Coordinate.
void create(geomgraph::Node *node)
Creates the subgraph consisting of all edges reachable from this node.
geom::Coordinate * getRightmostCoordinate()
Gets the rightmost coordinate in the edges of the subgraph.
Definition: BufferSubgraph.h:177
A RightmostEdgeFinder find the geomgraph::DirectedEdge in a list which has the highest coordinate,...
Definition: RightmostEdgeFinder.h:47
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26