GEOS: Subgraph.h Source File

GEOS 3.5.0

- 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
geos::planargraph::Subgraph::Subgraph
Subgraph(PlanarGraph &parent)
Definition: Subgraph.h:61
geos::planargraph::Subgraph::edgeBegin
std::set< Edge * >::iterator edgeBegin()
Definition: Subgraph.h:110
geos::planargraph::Subgraph::getParent
PlanarGraph & getParent() const
Definition: Subgraph.h:72
geos::planargraph::Subgraph::nodeBegin
NodeMap::container::iterator nodeBegin()
Definition: Subgraph.h:117
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::planargraph::Subgraph::contains
bool contains(Edge *e)
Definition: Subgraph.h:135
geos::planargraph::Edge
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54
geos::planargraph::Subgraph::getDirEdgeBegin
std::vector< const DirectedEdge * >::iterator getDirEdgeBegin()
Definition: Subgraph.h:97
geos::planargraph::Subgraph
A subgraph of a PlanarGraph.
Definition: Subgraph.h:53
geos::planargraph::NodeMap
A map of Node, indexed by the coordinate of the node.
Definition: planargraph/NodeMap.h:48
geos::planargraph::PlanarGraph
Represents a directed graph which is embeddable in a planar surface.
Definition: planargraph/PlanarGraph.h:60