planargraph/NodeMap.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2001-2002 Vivid Solutions Inc.
* Copyright (C) 2005-2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/Coordinate.h> // for use in container
#include <map>
#include <vector>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
#endif
// Forward declarations
namespace geos {
namespace planargraph {
class DirectedEdgeStar;
class DirectedEdge;
class Edge;
class Node;
}
}
namespace geos {
namespace planargraph { // geos.planargraph
class GEOS_DLL NodeMap {
public:
typedef std::map<geom::Coordinate, Node*, geom::CoordinateLessThan> container;
private:
container nodeMap;
public:
NodeMap();
container& getNodeMap();
virtual ~NodeMap() = default;
Node* add(Node* n);
Node* remove(geom::Coordinate& pt);
Node* find(const geom::Coordinate& coord);
container::iterator
iterator()
{
return nodeMap.begin();
}
container::iterator
begin()
{
return nodeMap.begin();
}
container::const_iterator
begin() const
{
return nodeMap.begin();
}
container::iterator
end()
{
return nodeMap.end();
}
container::const_iterator
end() const
{
return nodeMap.end();
}
void getNodes(std::vector<Node*>& nodes);
};
} // namespace geos::planargraph
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
geos::geom::Coordinate
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:217
geos::planargraph::DirectedEdgeStar
A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
Definition planargraph/DirectedEdgeStar.h:42
geos::planargraph::DirectedEdge
Represents a directed edge in a PlanarGraph.
Definition planargraph/DirectedEdge.h:45
geos::planargraph::Edge
Represents an undirected edge of a PlanarGraph.
Definition planargraph/Edge.h:54
geos::planargraph::NodeMap::find
Node * find(const geom::Coordinate &coord)
Returns the Node at the given location, or null if no Node was there.
geos::planargraph::NodeMap::getNodes
void getNodes(std::vector< Node * > &nodes)
Returns the Nodes in this NodeMap, sorted in ascending order by angle with the positive x-axis.
geos::planargraph::NodeMap::NodeMap
NodeMap()
Constructs a NodeMap without any Nodes.
geos::planargraph::NodeMap::add
Node * add(Node *n)
Adds a node to the std::map, replacing any that is already at that location.
geos::planargraph::NodeMap::iterator
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
geos::planargraph::NodeMap::remove
Node * remove(geom::Coordinate &pt)
Removes the Node at the given location, and returns it (or null if no Node was there).
geos::planargraph::Node
A node in a PlanarGraph is a location where 0 or more Edge meet.
Definition planargraph/Node.h:44
geos::planargraph
Contains classes to implement a planar graph data structure.
Definition namespaces.h:293
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38