• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

Subgraph.h

00001 /**********************************************************************
00002  * $Id: Subgraph.h 2784 2009-12-03 19:52:22Z 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_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 public:
00057         Subgraph(PlanarGraph &parent)
00058                 :
00059                 parentGraph(parent)
00060                 {}
00061 
00068         PlanarGraph& getParent() const { return parentGraph; }
00069 
00083         std::pair<std::set<Edge*>::iterator, bool> add(Edge *e);
00084 
00093         std::vector<const DirectedEdge*>::iterator getDirEdgeBegin() {
00094                 return dirEdges.begin();
00095         }
00096 
00097         
00106         std::set<Edge*>::iterator edgeBegin() { return edges.begin(); }
00107         std::set<Edge*>::iterator edgeEnd() { return edges.end(); }
00108 
00113         NodeMap::container::iterator nodeBegin() {
00114                 return nodeMap.begin(); 
00115         }
00116         NodeMap::container::const_iterator nodeEnd() const {
00117                 return nodeMap.end(); 
00118         }
00119         NodeMap::container::iterator nodeEnd() {
00120                 return nodeMap.end(); 
00121         }
00122         NodeMap::container::const_iterator nodeBegin() const {
00123                 return nodeMap.begin(); 
00124         }
00125 
00131         bool contains(Edge *e) { return (edges.find(e) != edges.end()); }
00132 
00133 protected:
00134 
00135         PlanarGraph &parentGraph;
00136         std::set<Edge*> edges;
00137         std::vector<const DirectedEdge*> dirEdges;
00138         NodeMap nodeMap;
00139     
00140     // Declare type as noncopyable
00141     Subgraph(const Subgraph& other);
00142     Subgraph& operator=(const Subgraph& rhs);
00143 };
00144 
00145 
00146 } // namespace geos::planargraph
00147 } // namespace geos
00148 
00149 #endif // GEOS_PLANARGRAPH_SUBGRAPH_H
00150 
00151 /**********************************************************************
00152  * $Log$
00153  * Revision 1.1  2006/03/21 21:42:54  strk
00154  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
00155  *
00156  **********************************************************************/
00157 

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1