GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 **********************************************************************/ 00015 00016 #ifndef GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H 00017 #define GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H 00018 00019 #include <geos/export.h> 00020 #include <geos/planargraph/PlanarGraph.h> // for inlines 00021 00022 #include <stack> 00023 #include <vector> 00024 00025 // Forward declarations 00026 namespace geos { 00027 namespace planargraph { 00028 class PlanarGraph; 00029 class Subgraph; 00030 class Node; 00031 } 00032 } 00033 00034 namespace geos { 00035 namespace planargraph { // geos::planargraph 00036 namespace algorithm { // geos::planargraph::algorithm 00037 00043 class GEOS_DLL ConnectedSubgraphFinder 00044 { 00045 public: 00046 00047 ConnectedSubgraphFinder(PlanarGraph& newGraph) 00048 : 00049 graph(newGraph) 00050 {} 00051 00060 void getConnectedSubgraphs(std::vector<Subgraph *>& dest); 00061 00062 private: 00063 00064 PlanarGraph& graph; 00065 00067 Subgraph* findSubgraph(Node* node); 00068 00069 00076 void addReachable(Node* node, Subgraph* subgraph); 00077 00083 void addEdges(Node* node, std::stack<Node *>& nodeStack, 00084 Subgraph* subgraph); 00085 00086 // Declare type as noncopyable 00087 ConnectedSubgraphFinder(const ConnectedSubgraphFinder& other); 00088 ConnectedSubgraphFinder& operator=(const ConnectedSubgraphFinder& rhs); 00089 }; 00090 00091 } // namespace geos::planargraph::algorithm 00092 } // namespace geos::planargraph 00093 } // namespace geos 00094 00095 #endif // GEOS_PLANARGRAPH_ALGO_CONNECTEDSUBGRAPHFINDER_H 00096