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