GEOS  3.6.1
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 
44 {
45 public:
46 
48  :
49  graph(newGraph)
50  {}
51 
60  void getConnectedSubgraphs(std::vector<Subgraph *>& dest);
61 
62 private:
63 
64  PlanarGraph& graph;
65 
67  Subgraph* findSubgraph(Node* node);
68 
69 
76  void addReachable(Node* node, Subgraph* subgraph);
77 
83  void addEdges(Node* node, std::stack<Node *>& nodeStack,
84  Subgraph* subgraph);
85 
86  // Declare type as noncopyable
88  ConnectedSubgraphFinder& operator=(const ConnectedSubgraphFinder& rhs);
89 };
90 
91 } // namespace geos::planargraph::algorithm
92 } // namespace geos::planargraph
93 } // namespace geos
94 
95 #endif // GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H
96 
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