GEOS  3.8.0dev
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
93  {
94  return nodeMap.begin();
95  }
96 
97  container::iterator
98  begin()
99  {
100  return nodeMap.begin();
101  }
102  container::const_iterator
103  begin() const
104  {
105  return nodeMap.begin();
106  }
107 
108  container::iterator
109  end()
110  {
111  return nodeMap.end();
112  }
113  container::const_iterator
114  end() const
115  {
116  return nodeMap.end();
117  }
118 
126  void getNodes(std::vector<Node*>& nodes);
127 };
128 
129 
130 } // namespace geos::planargraph
131 } // namespace geos
132 
133 #ifdef _MSC_VER
134 #pragma warning(pop)
135 #endif
136 
137 #endif // GEOS_PLANARGRAPH_NODEMAP_H
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
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:92
A map of Node, indexed by the coordinate of the node.
Definition: planargraph/NodeMap.h:48