planargraph/DirectedEdgeStar.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 <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 geom {
class Coordinate;
}
namespace planargraph {
class DirectedEdge;
class Edge;
}
}
namespace geos {
namespace planargraph { // geos.planargraph
class GEOS_DLL DirectedEdgeStar {
protected:
private:
mutable std::vector<DirectedEdge*> outEdges;
mutable bool sorted;
void sortEdges() const;
public:
DirectedEdgeStar(): sorted(false) {}
virtual
~DirectedEdgeStar() {}
void add(DirectedEdge* de);
void remove(DirectedEdge* de);
std::vector<DirectedEdge*>::iterator
iterator()
{
return begin();
}
std::vector<DirectedEdge*>::iterator begin();
std::vector<DirectedEdge*>::iterator end();
std::vector<DirectedEdge*>::const_iterator begin() const;
std::vector<DirectedEdge*>::const_iterator end() const;
std::size_t
getDegree() const
{
return outEdges.size();
}
geom::Coordinate& getCoordinate() const;
std::vector<DirectedEdge*>& getEdges();
int getIndex(const Edge* edge);
int getIndex(const DirectedEdge* dirEdge);
unsigned int getIndex(int i) const;
DirectedEdge* getNextEdge(DirectedEdge* dirEdge);
};
} // 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::DirectedEdgeStar::add
void add(DirectedEdge *de)
Adds a new member to this DirectedEdgeStar.
geos::planargraph::DirectedEdgeStar::getIndex
unsigned int getIndex(int i) const
Returns the remainder when i is divided by the number of edges in this DirectedEdgeStar.
geos::planargraph::DirectedEdgeStar::begin
std::vector< DirectedEdge * >::const_iterator begin() const
Returns an const_iterator to first DirectedEdge.
geos::planargraph::DirectedEdgeStar::begin
std::vector< DirectedEdge * >::iterator begin()
Returns an iterator to first DirectedEdge.
geos::planargraph::DirectedEdgeStar::end
std::vector< DirectedEdge * >::const_iterator end() const
Returns an const_iterator to one-past last DirectedEdge.
geos::planargraph::DirectedEdgeStar::iterator
std::vector< DirectedEdge * >::iterator iterator()
Returns an Iterator over the DirectedEdges, in ascending order by angle with the positive x-axis.
Definition planargraph/DirectedEdgeStar.h:77
geos::planargraph::DirectedEdgeStar::getNextEdge
DirectedEdge * getNextEdge(DirectedEdge *dirEdge)
Returns the DirectedEdge on the left-hand side of the given DirectedEdge (which must be a member of t...
geos::planargraph::DirectedEdgeStar::getIndex
int getIndex(const Edge *edge)
Returns the zero-based index of the given Edge, after sorting in ascending order by angle with the po...
geos::planargraph::DirectedEdgeStar::getDegree
std::size_t getDegree() const
Returns the number of edges around the Node associated with this DirectedEdgeStar.
Definition planargraph/DirectedEdgeStar.h:98
geos::planargraph::DirectedEdgeStar::DirectedEdgeStar
DirectedEdgeStar()
Constructs a DirectedEdgeStar with no edges.
Definition planargraph/DirectedEdgeStar.h:57
geos::planargraph::DirectedEdgeStar::getEdges
std::vector< DirectedEdge * > & getEdges()
Returns the DirectedEdges, in ascending order by angle with the positive x-axis.
geos::planargraph::DirectedEdgeStar::getCoordinate
geom::Coordinate & getCoordinate() const
Returns the coordinate for the node at which this star is based.
geos::planargraph::DirectedEdgeStar::end
std::vector< DirectedEdge * >::iterator end()
Returns an iterator to one-past last DirectedEdge.
geos::planargraph::DirectedEdgeStar::remove
void remove(DirectedEdge *de)
Drops a member of this DirectedEdgeStar.
geos::planargraph::DirectedEdgeStar::getIndex
int getIndex(const DirectedEdge *dirEdge)
Returns the zero-based index of the given DirectedEdge, after sorting in ascending order by angle wit...
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::geom
Definition Angle.h:26
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