GEOS 3.9.1
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
31namespace geos {
32namespace planargraph {
33class DirectedEdgeStar;
34class DirectedEdge;
35class Edge;
36class Node;
37}
38}
39
40namespace geos {
41namespace planargraph { // geos.planargraph
42
48class GEOS_DLL NodeMap {
49public:
50 typedef std::map<geom::Coordinate, Node*, geom::CoordinateLessThen> container;
51private:
52 container nodeMap;
53public:
58
59 container& getNodeMap();
60
61 virtual ~NodeMap() = default;
62
70
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
A map of Node, indexed by the coordinate of the node.
Definition planargraph/NodeMap.h:48
Node * find(const geom::Coordinate &coord)
Returns the Node at the given location, or null if no Node was there.
void getNodes(std::vector< Node * > &nodes)
Returns the Nodes in this NodeMap, sorted in ascending order by angle with the positive x-axis.
NodeMap()
Constructs a NodeMap without any Nodes.
Node * add(Node *n)
Adds a node to the std::map, replacing any that is already at that location.
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
Node * remove(geom::Coordinate &pt)
Removes the Node at the given location, and returns it (or null if no Node was there).
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition planargraph/Node.h:45
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:26