GEOS 3.6.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
31namespace geos {
32 namespace planargraph {
33 class DirectedEdgeStar;
34 class DirectedEdge;
35 class Edge;
36 class 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();
62
70
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 sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
Definition planargraph/DirectedEdgeStar.h:43
Represents a directed edge in a PlanarGraph.
Definition planargraph/DirectedEdge.h:46
Represents an undirected edge of a PlanarGraph.
Definition planargraph/Edge.h:54
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:91
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
Contains classes to implement a planar graph data structure.
Definition LineMergeDirectedEdge.h:32
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25