GEOS 3.11.1
planargraph/DirectedEdgeStar.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#pragma once
17
18#include <geos/export.h>
19
20#include <vector>
21
22#ifdef _MSC_VER
23#pragma warning(push)
24#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
25#endif
26
27// Forward declarations
28namespace geos {
29namespace geom {
30class Coordinate;
31}
32namespace planargraph {
33class DirectedEdge;
34class Edge;
35}
36}
37
38namespace geos {
39namespace planargraph { // geos.planargraph
40
42class GEOS_DLL DirectedEdgeStar {
43protected:
44
45private:
49 mutable std::vector<DirectedEdge*> outEdges;
50 mutable bool sorted;
51 void sortEdges() const;
52
53public:
57 DirectedEdgeStar(): sorted(false) {}
58
59 virtual
61
65 void add(DirectedEdge* de);
66
71
76 std::vector<DirectedEdge*>::iterator
78 {
79 return begin();
80 }
82 std::vector<DirectedEdge*>::iterator begin();
83
85 std::vector<DirectedEdge*>::iterator end();
86
88 std::vector<DirectedEdge*>::const_iterator begin() const;
89
91 std::vector<DirectedEdge*>::const_iterator end() const;
92
97 std::size_t
98 getDegree() const
99 {
100 return outEdges.size();
101 }
102
108
113 std::vector<DirectedEdge*>& getEdges();
114
120 int getIndex(const Edge* edge);
121
127 int getIndex(const DirectedEdge* dirEdge);
128
133 unsigned int getIndex(int i) const;
134
141};
142
143} // namespace geos::planargraph
144} // namespace geos
145
146#ifdef _MSC_VER
147#pragma warning(pop)
148#endif
149
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:58
A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
Definition: planargraph/DirectedEdgeStar.h:42
void add(DirectedEdge *de)
Adds a new member to this DirectedEdgeStar.
unsigned int getIndex(int i) const
Returns the remainder when i is divided by the number of edges in this DirectedEdgeStar.
std::vector< DirectedEdge * >::const_iterator begin() const
Returns an const_iterator to first DirectedEdge.
std::vector< DirectedEdge * >::iterator begin()
Returns an iterator to first DirectedEdge.
std::vector< DirectedEdge * >::const_iterator end() const
Returns an const_iterator to one-past last DirectedEdge.
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
DirectedEdge * getNextEdge(DirectedEdge *dirEdge)
Returns the DirectedEdge on the left-hand side of the given DirectedEdge (which must be a member of t...
int getIndex(const Edge *edge)
Returns the zero-based index of the given Edge, after sorting in ascending order by angle with the po...
std::size_t getDegree() const
Returns the number of edges around the Node associated with this DirectedEdgeStar.
Definition: planargraph/DirectedEdgeStar.h:98
DirectedEdgeStar()
Constructs a DirectedEdgeStar with no edges.
Definition: planargraph/DirectedEdgeStar.h:57
std::vector< DirectedEdge * > & getEdges()
Returns the DirectedEdges, in ascending order by angle with the positive x-axis.
geom::Coordinate & getCoordinate() const
Returns the coordinate for the node at wich this star is based.
std::vector< DirectedEdge * >::iterator end()
Returns an iterator to one-past last DirectedEdge.
void remove(DirectedEdge *de)
Drops a member of this DirectedEdgeStar.
int getIndex(const DirectedEdge *dirEdge)
Returns the zero-based index of the given DirectedEdge, after sorting in ascending order by angle wit...
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:45
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54
Basic namespace for all GEOS functionalities.
Definition: geos.h:39