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

planargraph/PlanarGraph.h

00001 /**********************************************************************
00002  * $Id: PlanarGraph.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) 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_PLANARGRAPH_H
00017 #define GEOS_PLANARGRAPH_PLANARGRAPH_H
00018 
00019 #include <geos/export.h>
00020 #include <geos/planargraph/NodeMap.h> // for composition
00021 
00022 #include <vector> // for typedefs
00023 
00024 // Forward declarations
00025 namespace geos {
00026         namespace geom { 
00027                 class Coordinate;
00028         }
00029         namespace planargraph { 
00030                 class DirectedEdge;
00031                 class Edge;
00032                 class Node;
00033         }
00034 }
00035 
00036 namespace geos {
00037 namespace planargraph { // geos.planargraph
00038 
00052 class GEOS_DLL PlanarGraph {
00053 
00054 protected:
00055 
00056         std::vector<Edge*> edges;
00057         std::vector<DirectedEdge*> dirEdges;
00058         NodeMap nodeMap;
00059 
00069         void add(Node *node) {
00070                 nodeMap.add(node);
00071         }
00072 
00082         void add(Edge *edge);
00083 
00091         void add(DirectedEdge *dirEdge) {
00092                 dirEdges.push_back(dirEdge);
00093         }
00094 
00095 public:
00096 
00097         typedef std::vector<Edge *> EdgeContainer;
00098         typedef EdgeContainer::iterator EdgeIterator;
00099 
00100 
00105         PlanarGraph() {}
00106 
00107         virtual ~PlanarGraph() {}
00108 
00114         Node* findNode(const geom::Coordinate& pt) {
00115                 return nodeMap.find(pt);
00116         }
00117 
00122         NodeMap::container::iterator nodeIterator() {
00123                 return nodeMap.begin();
00124         }
00125 
00126         NodeMap::container::iterator nodeBegin() {
00127                 return nodeMap.begin();
00128         }
00129 
00130         NodeMap::container::const_iterator nodeBegin() const {
00131                 return nodeMap.begin();
00132         }
00133 
00134         NodeMap::container::iterator nodeEnd() {
00135                 return nodeMap.end();
00136         }
00137 
00138         NodeMap::container::const_iterator nodeEnd() const {
00139                 return nodeMap.end();
00140         }
00141 
00146         std::vector<Node*>* getNodes() { return nodeMap.getNodes(); }
00147 
00156         std::vector<DirectedEdge*>::iterator dirEdgeIterator() {
00157                 return dirEdges.begin();
00158         }
00159 
00161         std::vector<Edge*>::iterator edgeIterator() {
00162                 return edges.begin();
00163         }
00164 
00166         //
00170         std::vector<Edge*>::iterator edgeBegin() {
00171                 return edges.begin();
00172         }
00173 
00175         //
00179         std::vector<Edge*>::iterator edgeEnd() {
00180                 return edges.end();
00181         }
00182 
00188         std::vector<Edge*>* getEdges() {
00189                 return &edges;
00190         }
00191 
00201         void remove(Edge *edge);
00202 
00212         void remove(DirectedEdge *de);
00213 
00219         void remove(Node *node);
00220 
00226         std::vector<Node*>* findNodesOfDegree(size_t degree);
00227 };
00228 
00229 } // namespace geos::planargraph
00230 } // namespace geos
00231 
00232 #endif // GEOS_PLANARGRAPH_PLANARGRAPH_H
00233 
00234 /**********************************************************************
00235  * $Log$
00236  * Revision 1.2  2006/06/12 10:49:43  strk
00237  * unsigned int => size_t
00238  *
00239  * Revision 1.1  2006/03/21 21:42:54  strk
00240  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
00241  *
00242  **********************************************************************/
00243 

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