Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

Subgraph.h

00001 /**********************************************************************
00002  * $Id: Subgraph.h 2556 2009-06-06 22:22:28Z strk $
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_SUBGRAPH_H
00018 #define GEOS_PLANARGRAPH_SUBGRAPH_H
00019 
00020 #include <geos/export.h>
00021 #include <geos/planargraph/NodeMap.h> // for composition
00022 
00023 #include <vector> 
00024 
00025 // Forward declarations
00026 namespace geos {
00027         namespace planargraph { 
00028                 class PlanarGraph;
00029                 class DirectedEdge;
00030                 class Edge;
00031         }
00032 }
00033 
00034 namespace geos {
00035 namespace planargraph { // geos.planargraph
00036 
00038 //
00049 class GEOS_DLL Subgraph
00050 {
00051 protected:
00052         PlanarGraph &parentGraph;
00053         std::set<Edge*> edges;
00054         std::vector<const DirectedEdge*> dirEdges;
00055         NodeMap nodeMap;
00056 
00057 public:
00063         Subgraph(PlanarGraph &parent)
00064                 :
00065                 parentGraph(parent)
00066                 {}
00067 
00074         PlanarGraph& getParent() const { return parentGraph; }
00075 
00089         std::pair<std::set<Edge*>::iterator, bool> add(Edge *e);
00090 
00099         std::vector<const DirectedEdge*>::iterator getDirEdgeBegin() {
00100                 return dirEdges.begin();
00101         }
00102 
00103         
00112         std::set<Edge*>::iterator edgeBegin() { return edges.begin(); }
00113         std::set<Edge*>::iterator edgeEnd() { return edges.end(); }
00114 
00119         NodeMap::container::iterator nodeBegin() {
00120                 return nodeMap.begin(); 
00121         }
00122         NodeMap::container::const_iterator nodeEnd() const {
00123                 return nodeMap.end(); 
00124         }
00125         NodeMap::container::iterator nodeEnd() {
00126                 return nodeMap.end(); 
00127         }
00128         NodeMap::container::const_iterator nodeBegin() const {
00129                 return nodeMap.begin(); 
00130         }
00131 
00137         bool contains(Edge *e) { return (edges.find(e) != edges.end()); }
00138 
00139         
00140 };
00141 
00142 
00143 } // namespace geos::planargraph
00144 } // namespace geos
00145 
00146 #endif // GEOS_PLANARGRAPH_SUBGRAPH_H
00147 
00148 /**********************************************************************
00149  * $Log$
00150  * Revision 1.1  2006/03/21 21:42:54  strk
00151  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
00152  *
00153  **********************************************************************/
00154 

Generated on Thu Jun 11 06:17:02 2009 for GEOS by  doxygen 1.4.4