GEOS  3.4.2
planargraph/NodeMap.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_NODEMAP_H
17 #define GEOS_PLANARGRAPH_NODEMAP_H
18 
19 #include <geos/export.h>
20 #include <geos/geom/Coordinate.h> // for use in container
21 
22 #include <map>
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 DirectedEdgeStar;
34  class DirectedEdge;
35  class Edge;
36  class Node;
37  }
38 }
39 
40 namespace geos {
41 namespace planargraph { // geos.planargraph
42 
48 class GEOS_DLL NodeMap {
49 public:
50  typedef std::map<geom::Coordinate, Node*, geom::CoordinateLessThen> container;
51 private:
52  container nodeMap;
53 public:
57  NodeMap();
58 
59  container& getNodeMap();
60 
61  virtual ~NodeMap();
62 
69  Node* add(Node *n);
70 
76  Node* remove(geom::Coordinate& pt);
77 
83  Node* find(const geom::Coordinate& coord);
84 
91  container::iterator iterator() {
92  return nodeMap.begin();
93  }
94 
95  container::iterator begin() {
96  return nodeMap.begin();
97  }
98  container::const_iterator begin() const {
99  return nodeMap.begin();
100  }
101 
102  container::iterator end() {
103  return nodeMap.end();
104  }
105  container::const_iterator end() const {
106  return nodeMap.end();
107  }
108 
116  void getNodes(std::vector<Node*>& nodes);
117 };
118 
119 
120 } // namespace geos::planargraph
121 } // namespace geos
122 
123 #ifdef _MSC_VER
124 #pragma warning(pop)
125 #endif
126 
127 #endif // GEOS_PLANARGRAPH_NODEMAP_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition: planargraph/Node.h:45
container::iterator iterator()
Returns an Iterator over the Nodes in this NodeMap, sorted in ascending order by angle with the posit...
Definition: planargraph/NodeMap.h:91
A map of Node, indexed by the coordinate of the node.
Definition: planargraph/NodeMap.h:48