# Subgraph.h

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