GEOS  3.8.0dev
ConnectedSubgraphFinder.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2001-2002 Vivid Solutions Inc.
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************/
15 
16 #ifndef GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H
17 #define GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H
18 
19 #include <geos/export.h>
20 #include <geos/planargraph/PlanarGraph.h> // for inlines
21 
22 #include <stack>
23 #include <vector>
24 
25 // Forward declarations
26 namespace geos {
27 namespace planargraph {
28 class PlanarGraph;
29 class Subgraph;
30 class Node;
31 }
32 }
33 
34 namespace geos {
35 namespace planargraph { // geos::planargraph
36 namespace algorithm { // geos::planargraph::algorithm
37 
43 class GEOS_DLL ConnectedSubgraphFinder {
44 public:
45 
47  :
48  graph(newGraph)
49  {}
50 
59  void getConnectedSubgraphs(std::vector<Subgraph*>& dest);
60 
61 private:
62 
63  PlanarGraph& graph;
64 
66  Subgraph* findSubgraph(Node* node);
67 
68 
75  void addReachable(Node* node, Subgraph* subgraph);
76 
82  void addEdges(Node* node, std::stack<Node*>& nodeStack,
83  Subgraph* subgraph);
84 
85  // Declare type as noncopyable
86  ConnectedSubgraphFinder(const ConnectedSubgraphFinder& other) = delete;
87  ConnectedSubgraphFinder& operator=(const ConnectedSubgraphFinder& rhs) = delete;
88 };
89 
90 } // namespace geos::planargraph::algorithm
91 } // namespace geos::planargraph
92 } // namespace geos
93 
94 #endif // GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H
95 
Finds all connected Subgraphs of a PlanarGraph.
Definition: ConnectedSubgraphFinder.h:43
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition: planargraph/Node.h:45
A subgraph of a PlanarGraph.
Definition: Subgraph.h:53
Represents a directed graph which is embeddable in a planar surface.
Definition: planargraph/PlanarGraph.h:60