GEOS: Subgraph.h Source File

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# Subgraph.h

    00001 /**********************************************************************
    00002  * $Id: Subgraph.h 3255 2011-03-01 17:56:10Z 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 #ifdef _MSC_VER
    00026 #pragma warning(push)
    00027 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
    00028 #endif
    00029
    00030 // Forward declarations
    00031 namespace geos {
    00032         namespace planargraph {
    00033                 class PlanarGraph;
    00034                 class DirectedEdge;
    00035                 class Edge;
    00036         }
    00037 }
    00038
    00039 namespace geos {
    00040 namespace planargraph { // geos.planargraph
    00041
    00043 //
    00054 class GEOS_DLL Subgraph
    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 protected:
    00139
    00140         PlanarGraph &parentGraph;
    00141         std::set<Edge*> edges;
    00142         std::vector<const DirectedEdge*> dirEdges;
    00143         NodeMap nodeMap;
    00144
    00145     // Declare type as noncopyable
    00146     Subgraph(const Subgraph& other);
    00147     Subgraph& operator=(const Subgraph& rhs);
    00148 };
    00149
    00150 } // namespace geos::planargraph
    00151 } // namespace geos
    00152
    00153 #ifdef _MSC_VER
    00154 #pragma warning(pop)
    00155 #endif
    00156
    00157 #endif // GEOS_PLANARGRAPH_SUBGRAPH_H
    00158
    00159 /**********************************************************************
    00160  * $Log$
    00161  * Revision 1.1  2006/03/21 21:42:54  strk
    00162  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
    00163  *
    00164  **********************************************************************/
    00165