GEOS  3.9.1dev
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
geos::planargraph::PlanarGraph Class Reference

Represents a directed graph which is embeddable in a planar surface. More...

#include <PlanarGraph.h>

Inheritance diagram for geos::planargraph::PlanarGraph:
[legend]
Collaboration diagram for geos::planargraph::PlanarGraph:
[legend]

Public Types

typedef std::vector< Edge * > EdgeContainer
 
typedef EdgeContainer::iterator EdgeIterator
 

Public Member Functions

 PlanarGraph ()
 Constructs a PlanarGraph without any Edges, DirectedEdges, or Nodes. More...
 
virtual ~PlanarGraph ()
 
NodefindNode (const geom::Coordinate &pt)
 Returns the Node at the given location, or null if no Node was there. More...
 
NodeMap::container::iterator nodeIterator ()
 Returns an Iterator over the Nodes in this PlanarGraph. More...
 
NodeMap::container::iterator nodeBegin ()
 
NodeMap::container::const_iterator nodeBegin () const
 
NodeMap::container::iterator nodeEnd ()
 
NodeMap::container::const_iterator nodeEnd () const
 
void getNodes (std::vector< Node * > &nodes)
 Returns the Nodes in this PlanarGraph. More...
 
std::vector< DirectedEdge * >::iterator dirEdgeIterator ()
 Returns an Iterator over the DirectedEdges in this PlanarGraph, in the order in which they were added. More...
 
std::vector< Edge * >::iterator edgeIterator ()
 Alias for edgeBegin() More...
 
std::vector< Edge * >::iterator edgeBegin ()
 Returns an iterator to first Edge in this graph. More...
 
std::vector< Edge * >::iterator edgeEnd ()
 Returns an iterator to one-past last Edge in this graph. More...
 
std::vector< Edge * > * getEdges ()
 
void remove (Edge *edge)
 Removes an Edge and its associated DirectedEdges from their from-Nodes and from this PlanarGraph. More...
 
void remove (DirectedEdge *de)
 Removes DirectedEdge from its from-Node and from this PlanarGraph. More...
 
void remove (Node *node)
 Removes a node from the graph, along with any associated DirectedEdges and Edges. More...
 
std::vector< Node * > * findNodesOfDegree (std::size_t degree)
 Returns all Nodes with the given number of Edges around it. The return value is a newly allocated vector of existing nodes. More...
 
void findNodesOfDegree (std::size_t degree, std::vector< Node * > &to)
 Get all Nodes with the given number of Edges around it. More...
 

Protected Member Functions

void add (Node *node)
 Adds a node to the std::map, replacing any that is already at that location. More...
 
void add (Edge *edge)
 Adds the Edge and its DirectedEdges with this PlanarGraph. More...
 
void add (DirectedEdge *dirEdge)
 Adds the Edge to this PlanarGraph. More...
 

Protected Attributes

std::vector< Edge * > edges
 
std::vector< DirectedEdge * > dirEdges
 
NodeMap nodeMap
 

Detailed Description

Represents a directed graph which is embeddable in a planar surface.

This class and the other classes in this package serve as a framework for building planar graphs for specific algorithms. This class must be subclassed to expose appropriate methods to construct the graph. This allows controlling the types of graph components (DirectedEdge, Edge and Node) which can be added to the graph. An application which uses the graph framework will almost always provide subclasses for one or more graph components, which hold application-specific data and graph algorithms.

Definition at line 60 of file planargraph/PlanarGraph.h.

Member Typedef Documentation

Definition at line 108 of file planargraph/PlanarGraph.h.

typedef EdgeContainer::iterator geos::planargraph::PlanarGraph::EdgeIterator

Definition at line 109 of file planargraph/PlanarGraph.h.

Constructor & Destructor Documentation

geos::planargraph::PlanarGraph::PlanarGraph ( )
inline

Constructs a PlanarGraph without any Edges, DirectedEdges, or Nodes.

Definition at line 116 of file planargraph/PlanarGraph.h.

virtual geos::planargraph::PlanarGraph::~PlanarGraph ( )
inlinevirtual

Definition at line 119 of file planargraph/PlanarGraph.h.

Member Function Documentation

void geos::planargraph::PlanarGraph::add ( Node node)
inlineprotected

Adds a node to the std::map, replacing any that is already at that location.

Only subclasses can add Nodes, to ensure Nodes are of the right type.

Definition at line 77 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::add().

Here is the call graph for this function:

void geos::planargraph::PlanarGraph::add ( Edge edge)
protected

Adds the Edge and its DirectedEdges with this PlanarGraph.

Assumes that the Edge has already been created with its associated DirectEdges. Only subclasses can add Edges, to ensure the edges added are of the right class.

void geos::planargraph::PlanarGraph::add ( DirectedEdge dirEdge)
inlineprotected

Adds the Edge to this PlanarGraph.

Only subclasses can add DirectedEdges, to ensure the edges added are of the right class.

Definition at line 101 of file planargraph/PlanarGraph.h.

std::vector<DirectedEdge*>::iterator geos::planargraph::PlanarGraph::dirEdgeIterator ( )
inline

Returns an Iterator over the DirectedEdges in this PlanarGraph, in the order in which they were added.

See also
add(Edge)
add(DirectedEdge)

Definition at line 187 of file planargraph/PlanarGraph.h.

std::vector<Edge*>::iterator geos::planargraph::PlanarGraph::edgeBegin ( )
inline

Returns an iterator to first Edge in this graph.

Edges are stored in the order they were added.

See also
add(Edge)

Definition at line 205 of file planargraph/PlanarGraph.h.

std::vector<Edge*>::iterator geos::planargraph::PlanarGraph::edgeEnd ( )
inline

Returns an iterator to one-past last Edge in this graph.

Edges are stored in the order they were added.

See also
add(Edge)

Definition at line 216 of file planargraph/PlanarGraph.h.

std::vector<Edge*>::iterator geos::planargraph::PlanarGraph::edgeIterator ( )
inline

Alias for edgeBegin()

Definition at line 194 of file planargraph/PlanarGraph.h.

Node* geos::planargraph::PlanarGraph::findNode ( const geom::Coordinate pt)
inline

Returns the Node at the given location, or null if no Node was there.

Definition at line 127 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::find().

Here is the call graph for this function:

std::vector<Node*>* geos::planargraph::PlanarGraph::findNodesOfDegree ( std::size_t  degree)

Returns all Nodes with the given number of Edges around it. The return value is a newly allocated vector of existing nodes.

void geos::planargraph::PlanarGraph::findNodesOfDegree ( std::size_t  degree,
std::vector< Node * > &  to 
)

Get all Nodes with the given number of Edges around it.

Found nodes are pushed to the given vector

std::vector<Edge*>* geos::planargraph::PlanarGraph::getEdges ( )
inline

Returns the Edges that have been added to this PlanarGraph

See also
PlanarGraph::add(Edge* edge)

Definition at line 226 of file planargraph/PlanarGraph.h.

void geos::planargraph::PlanarGraph::getNodes ( std::vector< Node * > &  nodes)
inline

Returns the Nodes in this PlanarGraph.

Parameters
nodes: the nodes are push_back'ed here

Definition at line 173 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::getNodes().

Here is the call graph for this function:

NodeMap::container::iterator geos::planargraph::PlanarGraph::nodeBegin ( )
inline

Definition at line 143 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::begin().

Here is the call graph for this function:

NodeMap::container::const_iterator geos::planargraph::PlanarGraph::nodeBegin ( ) const
inline

Definition at line 149 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::begin().

Here is the call graph for this function:

NodeMap::container::iterator geos::planargraph::PlanarGraph::nodeEnd ( )
inline

Definition at line 155 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::end().

Here is the call graph for this function:

NodeMap::container::const_iterator geos::planargraph::PlanarGraph::nodeEnd ( ) const
inline

Definition at line 161 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::end().

Here is the call graph for this function:

NodeMap::container::iterator geos::planargraph::PlanarGraph::nodeIterator ( )
inline

Returns an Iterator over the Nodes in this PlanarGraph.

Definition at line 137 of file planargraph/PlanarGraph.h.

References geos::planargraph::NodeMap::begin().

Here is the call graph for this function:

void geos::planargraph::PlanarGraph::remove ( Edge edge)

Removes an Edge and its associated DirectedEdges from their from-Nodes and from this PlanarGraph.

Note: This method does not remove the Nodes associated with the Edge, even if the removal of the Edge reduces the degree of a Node to zero.

void geos::planargraph::PlanarGraph::remove ( DirectedEdge de)

Removes DirectedEdge from its from-Node and from this PlanarGraph.

Note: This method does not remove the Nodes associated with the DirectedEdge, even if the removal of the DirectedEdge reduces the degree of a Node to zero.

void geos::planargraph::PlanarGraph::remove ( Node node)

Removes a node from the graph, along with any associated DirectedEdges and Edges.

Member Data Documentation

std::vector<DirectedEdge*> geos::planargraph::PlanarGraph::dirEdges
protected

Definition at line 65 of file planargraph/PlanarGraph.h.

std::vector<Edge*> geos::planargraph::PlanarGraph::edges
protected

Definition at line 64 of file planargraph/PlanarGraph.h.

NodeMap geos::planargraph::PlanarGraph::nodeMap
protected

Definition at line 66 of file planargraph/PlanarGraph.h.


The documentation for this class was generated from the following file: