GEOS 3.4.2

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

- File List

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