GEOS 3.6.2
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
30namespace geos {
31 namespace planargraph {
32 class PlanarGraph;
33 class DirectedEdge;
34 class Edge;
35 }
36}
37
38namespace geos {
39namespace planargraph { // geos.planargraph
40
42//
53class GEOS_DLL Subgraph
54{
55public:
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
137protected:
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
Represents a directed edge in a PlanarGraph.
Definition planargraph/DirectedEdge.h:46
Represents an undirected edge of a PlanarGraph.
Definition planargraph/Edge.h:54
A map of Node, indexed by the coordinate of the node.
Definition planargraph/NodeMap.h:48
Represents a directed graph which is embeddable in a planar surface.
Definition planargraph/PlanarGraph.h:60
A subgraph of a PlanarGraph.
Definition Subgraph.h:54
bool contains(Edge *e)
Definition Subgraph.h:135
std::pair< std::set< Edge * >::iterator, bool > add(Edge *e)
std::set< Edge * >::iterator edgeBegin()
Definition Subgraph.h:110
PlanarGraph & getParent() const
Definition Subgraph.h:72
NodeMap::container::iterator nodeBegin()
Definition Subgraph.h:117
std::vector< constDirectedEdge * >::iterator getDirEdgeBegin()
Definition Subgraph.h:97
Subgraph(PlanarGraph &parent)
Definition Subgraph.h:61
Contains classes to implement a planar graph data structure.
Definition LineMergeDirectedEdge.h:32
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25