Subgraph.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/planargraph/NodeMap.h> // for composition
#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 PlanarGraph;
class DirectedEdge;
class Edge;
}
}
namespace geos {
namespace planargraph { // geos.planargraph
class GEOS_DLL Subgraph {
public:
Subgraph(PlanarGraph& parent)
:
parentGraph(parent)
{}
PlanarGraph&
getParent() const
{
return parentGraph;
}
std::pair<std::set<Edge*>::iterator, bool> add(Edge* e);
std::vector<const DirectedEdge*>::iterator
getDirEdgeBegin()
{
return dirEdges.begin();
}
std::set<Edge*>::iterator
edgeBegin()
{
return edges.begin();
}
std::set<Edge*>::iterator
edgeEnd()
{
return edges.end();
}
NodeMap::container::iterator
nodeBegin()
{
return nodeMap.begin();
}
NodeMap::container::const_iterator
nodeEnd() const
{
return nodeMap.end();
}
NodeMap::container::iterator
nodeEnd()
{
return nodeMap.end();
}
NodeMap::container::const_iterator
nodeBegin() const
{
return nodeMap.begin();
}
bool
contains(Edge* e)
{
return (edges.find(e) != edges.end());
}
protected:
PlanarGraph& parentGraph;
std::set<Edge*> edges;
std::vector<const DirectedEdge*> dirEdges;
NodeMap nodeMap;
// Declare type as noncopyable
Subgraph(const Subgraph& other) = delete;
Subgraph& operator=(const Subgraph& rhs) = delete;
};
} // namespace geos::planargraph
} // namespace geos
#ifdef _MSC_VER
#pragma warning(pop)
#endif
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
A map of Node, indexed by the coordinate of the node.
Definition planargraph/NodeMap.h:47
geos::planargraph::PlanarGraph
Represents a directed graph which is embeddable in a planar surface.
Definition planargraph/PlanarGraph.h:59
geos::planargraph::Subgraph
A subgraph of a PlanarGraph.
Definition Subgraph.h:52
geos::planargraph::Subgraph::contains
bool contains(Edge *e)
Tests whether an Edge is contained in this subgraph.
Definition Subgraph.h:158
geos::planargraph::Subgraph::add
std::pair< std::set< Edge * >::iterator, bool > add(Edge *e)
Adds an Edge to the subgraph.
geos::planargraph::Subgraph::edgeBegin
std::set< Edge * >::iterator edgeBegin()
Returns an iterator over the Edges in this graph, in the order in which they were added.
Definition Subgraph.h:116
geos::planargraph::Subgraph::getParent
PlanarGraph & getParent() const
Gets the PlanarGraph which this subgraph is part of.
Definition Subgraph.h:71
geos::planargraph::Subgraph::nodeBegin
NodeMap::container::iterator nodeBegin()
Returns a iterators over the planar NodeMap::container in this graph.
Definition Subgraph.h:131
geos::planargraph::Subgraph::getDirEdgeBegin
std::vector< constDirectedEdge * >::iterator getDirEdgeBegin()
Returns an iterator over the DirectedEdge in this graph, in the order in which they were added.
Definition Subgraph.h:101
geos::planargraph::Subgraph::Subgraph
Subgraph(PlanarGraph &parent)
Creates a new subgraph of the given PlanarGraph.
Definition Subgraph.h:59
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