GEOS: Subgraph.h Source File

GEOS 3.3.8

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

- File List

Subgraph.h
1 /**********************************************************************
2 * $Id: Subgraph.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 * Copyright (C) 2005-2006 Refractions Research Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************/
16
17 #ifndef GEOS_PLANARGRAPH_SUBGRAPH_H
18 #define GEOS_PLANARGRAPH_SUBGRAPH_H
19
20 #include <geos/export.h>
21 #include <geos/planargraph/NodeMap.h> // for composition
22
23 #include <vector>
24
25 #ifdef _MSC_VER
26 #pragma warning(push)
27 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
28 #endif
29
30 // Forward declarations
31 namespace geos {
32 namespace planargraph {
33 class PlanarGraph;
34 class DirectedEdge;
35 class Edge;
36 }
37 }
38
39 namespace geos {
40 namespace planargraph { // geos.planargraph
41
43 //
54 class GEOS_DLL Subgraph
55 {
56 public:
62 Subgraph(PlanarGraph &parent)
63 :
64 parentGraph(parent)
65 {}
66
73 PlanarGraph& getParent() const { return parentGraph; }
74
88 std::pair<std::set<Edge*>::iterator, bool> add(Edge *e);
89
98 std::vector<const DirectedEdge*>::iterator getDirEdgeBegin() {
99 return dirEdges.begin();
100 }
101
102
111 std::set<Edge*>::iterator edgeBegin() { return edges.begin(); }
112 std::set<Edge*>::iterator edgeEnd() { return edges.end(); }
113
118 NodeMap::container::iterator nodeBegin() {
119 return nodeMap.begin();
120 }
121 NodeMap::container::const_iterator nodeEnd() const {
122 return nodeMap.end();
123 }
124 NodeMap::container::iterator nodeEnd() {
125 return nodeMap.end();
126 }
127 NodeMap::container::const_iterator nodeBegin() const {
128 return nodeMap.begin();
129 }
130
136 bool contains(Edge *e) { return (edges.find(e) != edges.end()); }
137
138 protected:
139
140 PlanarGraph &parentGraph;
141 std::set<Edge*> edges;
142 std::vector<const DirectedEdge*> dirEdges;
143 NodeMap nodeMap;
144
145 // Declare type as noncopyable
146 Subgraph(const Subgraph& other);
147 Subgraph& operator=(const Subgraph& rhs);
148 };
149
150 } // namespace geos::planargraph
151 } // namespace geos
152
153 #ifdef _MSC_VER
154 #pragma warning(pop)
155 #endif
156
157 #endif // GEOS_PLANARGRAPH_SUBGRAPH_H
158
159 /**********************************************************************
160 * $Log$
161 * Revision 1.1 2006/03/21 21:42:54 strk
162 * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
163 *
164 **********************************************************************/
165