GEOS  3.3.3
planargraph/NodeMap.h
1 /**********************************************************************
2  * $Id: NodeMap.h 2958 2010-03-29 11:29:40Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  * Copyright (C) 2005-2006 Refractions Research Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************/
16 
17 #ifndef GEOS_PLANARGRAPH_NODEMAP_H
18 #define GEOS_PLANARGRAPH_NODEMAP_H
19 
20 #include <geos/export.h>
21 #include <geos/geom/Coordinate.h> // for use in container
22 
23 #include <map>
24 #include <vector>
25 
26 #ifdef _MSC_VER
27 #pragma warning(push)
28 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
29 #endif
30 
31 // Forward declarations
32 namespace geos {
33  namespace planargraph {
34  class DirectedEdgeStar;
35  class DirectedEdge;
36  class Edge;
37  class Node;
38  }
39 }
40 
41 namespace geos {
42 namespace planargraph { // geos.planargraph
43 
49 class GEOS_DLL NodeMap {
50 public:
51  typedef std::map<geom::Coordinate, Node*, geom::CoordinateLessThen> container;
52 private:
53  container nodeMap;
54 public:
58  NodeMap();
59 
60  container& getNodeMap();
61 
62  virtual ~NodeMap();
63 
70  Node* add(Node *n);
71 
77  Node* remove(geom::Coordinate& pt);
78 
84  Node* find(const geom::Coordinate& coord);
85 
92  container::iterator iterator() {
93  return nodeMap.begin();
94  }
95 
96  container::iterator begin() {
97  return nodeMap.begin();
98  }
99  container::const_iterator begin() const {
100  return nodeMap.begin();
101  }
102 
103  container::iterator end() {
104  return nodeMap.end();
105  }
106  container::const_iterator end() const {
107  return nodeMap.end();
108  }
109 
117  void getNodes(std::vector<Node*>& nodes);
118 };
119 
120 
121 } // namespace geos::planargraph
122 } // namespace geos
123 
124 #ifdef _MSC_VER
125 #pragma warning(pop)
126 #endif
127 
128 #endif // GEOS_PLANARGRAPH_NODEMAP_H
129 
130 /**********************************************************************
131  * $Log$
132  * Revision 1.1 2006/03/21 21:42:54 strk
133  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
134  *
135  **********************************************************************/
136