Subgraph.h

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_SUBGRAPH_H
00017 #define GEOS_PLANARGRAPH_SUBGRAPH_H
00018 
00019 #include <geos/export.h>
00020 #include <geos/planargraph/NodeMap.h> // for composition
00021 
00022 #include <vector> 
00023 
00024 #ifdef _MSC_VER
00025 #pragma warning(push)
00026 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00027 #endif
00028 
00029 // Forward declarations
00030 namespace geos {
00031         namespace planargraph { 
00032                 class PlanarGraph;
00033                 class DirectedEdge;
00034                 class Edge;
00035         }
00036 }
00037 
00038 namespace geos {
00039 namespace planargraph { // geos.planargraph
00040 
00042 //
00053 class GEOS_DLL Subgraph
00054 {
00055 public:
00061         Subgraph(PlanarGraph &parent)
00062                 :
00063                 parentGraph(parent)
00064                 {}
00065 
00072         PlanarGraph& getParent() const { return parentGraph; }
00073 
00087         std::pair<std::set<Edge*>::iterator, bool> add(Edge *e);
00088 
00097         std::vector<const DirectedEdge*>::iterator getDirEdgeBegin() {
00098                 return dirEdges.begin();
00099         }
00100 
00101         
00110         std::set<Edge*>::iterator edgeBegin() { return edges.begin(); }
00111         std::set<Edge*>::iterator edgeEnd() { return edges.end(); }
00112 
00117         NodeMap::container::iterator nodeBegin() {
00118                 return nodeMap.begin(); 
00119         }
00120         NodeMap::container::const_iterator nodeEnd() const {
00121                 return nodeMap.end(); 
00122         }
00123         NodeMap::container::iterator nodeEnd() {
00124                 return nodeMap.end(); 
00125         }
00126         NodeMap::container::const_iterator nodeBegin() const {
00127                 return nodeMap.begin(); 
00128         }
00129 
00135         bool contains(Edge *e) { return (edges.find(e) != edges.end()); }
00136 
00137 protected:
00138 
00139         PlanarGraph &parentGraph;
00140         std::set<Edge*> edges;
00141         std::vector<const DirectedEdge*> dirEdges;
00142         NodeMap nodeMap;
00143     
00144     // Declare type as noncopyable
00145     Subgraph(const Subgraph& other);
00146     Subgraph& operator=(const Subgraph& rhs);
00147 };
00148 
00149 } // namespace geos::planargraph
00150 } // namespace geos
00151 
00152 #ifdef _MSC_VER
00153 #pragma warning(pop)
00154 #endif
00155 
00156 #endif // GEOS_PLANARGRAPH_SUBGRAPH_H

Generated on 15 May 2014 for GEOS by  doxygen 1.4.7