GEOS  3.9.1dev
Subgraph.h
Go to the documentation of this file.
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 
54 public:
61  :
62  parentGraph(parent)
63  {}
64 
72  getParent() const
73  {
74  return parentGraph;
75  }
76 
91  std::pair<std::set<Edge*>::iterator, bool> add(Edge* e);
92 
101  std::vector<const DirectedEdge*>::iterator
103  {
104  return dirEdges.begin();
105  }
106 
107 
116  std::set<Edge*>::iterator
118  {
119  return edges.begin();
120  }
121  std::set<Edge*>::iterator
123  {
124  return edges.end();
125  }
126 
131  NodeMap::container::iterator
133  {
134  return nodeMap.begin();
135  }
136  NodeMap::container::const_iterator
137  nodeEnd() const
138  {
139  return nodeMap.end();
140  }
141  NodeMap::container::iterator
143  {
144  return nodeMap.end();
145  }
146  NodeMap::container::const_iterator
147  nodeBegin() const
148  {
149  return nodeMap.begin();
150  }
151 
158  bool
160  {
161  return (edges.find(e) != edges.end());
162  }
163 
164 protected:
165 
167  std::set<Edge*> edges;
168  std::vector<const DirectedEdge*> dirEdges;
170 
171  // Declare type as noncopyable
172  Subgraph(const Subgraph& other) = delete;
173  Subgraph& operator=(const Subgraph& rhs) = delete;
174 };
175 
176 } // namespace geos::planargraph
177 } // namespace geos
178 
179 #ifdef _MSC_VER
180 #pragma warning(pop)
181 #endif
182 
183 #endif // GEOS_PLANARGRAPH_SUBGRAPH_H
Subgraph(PlanarGraph &parent)
Creates a new subgraph of the given PlanarGraph.
Definition: Subgraph.h:60
std::set< Edge * >::iterator edgeBegin()
Returns an iterator over the Edges in this graph, in the order in which they were added...
Definition: Subgraph.h:117
#define GEOS_DLL
Definition: export.h:28
std::vector< const DirectedEdge * > dirEdges
Definition: Subgraph.h:168
NodeMap::container::const_iterator nodeEnd() const
Definition: Subgraph.h:137
NodeMap::container::const_iterator nodeBegin() const
Definition: Subgraph.h:147
NodeMap::container::iterator nodeEnd()
Definition: Subgraph.h:142
std::set< Edge * >::iterator edgeEnd()
Definition: Subgraph.h:122
PlanarGraph & getParent() const
Gets the PlanarGraph which this subgraph is part of.
Definition: Subgraph.h:72
NodeMap::container::iterator nodeBegin()
Returns a iterators over the planar NodeMap::container in this graph.
Definition: Subgraph.h:132
PlanarGraph & parentGraph
Definition: Subgraph.h:166
std::set< Edge * > edges
Definition: Subgraph.h:167
Basic namespace for all GEOS functionalities.
bool contains(Edge *e)
Tests whether an Edge is contained in this subgraph.
Definition: Subgraph.h:159
Represents an undirected edge of a PlanarGraph.
std::vector< const DirectedEdge * >::iterator getDirEdgeBegin()
Returns an iterator over the DirectedEdge in this graph, in the order in which they were added...
Definition: Subgraph.h:102
A subgraph of a PlanarGraph.
Definition: Subgraph.h:53
A map of Node, indexed by the coordinate of the node.
Represents a directed graph which is embeddable in a planar surface.