GEOS 3.6.2
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#ifndef GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
17#define GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
18
19#include <geos/export.h>
20
21#include <vector>
22
23#ifdef _MSC_VER
24#pragma warning(push)
25#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
26#endif
27
28// Forward declarations
29namespace geos {
30 namespace geom {
31 class Coordinate;
32 }
33 namespace planargraph {
34 class DirectedEdge;
35 class Edge;
36 }
37}
38
39namespace geos {
40namespace planargraph { // geos.planargraph
41
43class GEOS_DLL DirectedEdgeStar {
44protected:
45
46private:
50 mutable std::vector<DirectedEdge*> outEdges;
51 mutable bool sorted;
52 void sortEdges() const;
53
54public:
58 DirectedEdgeStar(): sorted(false) {}
59
60 virtual ~DirectedEdgeStar() {}
61
65 void add(DirectedEdge *de);
66
71
76 std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
78 std::vector<DirectedEdge*>::iterator begin();
79
81 std::vector<DirectedEdge*>::iterator end();
82
84 std::vector<DirectedEdge*>::const_iterator begin() const;
85
87 std::vector<DirectedEdge*>::const_iterator end() const;
88
93 std::size_t getDegree() const { return outEdges.size(); }
94
100
105 std::vector<DirectedEdge*>& getEdges();
106
112 int getIndex(const Edge *edge);
113
119 int getIndex(const DirectedEdge *dirEdge);
120
125 int getIndex(int i) const;
126
133};
134
135} // namespace geos::planargraph
136} // namespace geos
137
138#ifdef _MSC_VER
139#pragma warning(pop)
140#endif
141
142#endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
Definition planargraph/DirectedEdgeStar.h:43
void add(DirectedEdge *de)
Adds a new member to 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:76
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:93
DirectedEdgeStar()
Constructs a DirectedEdgeStar with no edges.
Definition planargraph/DirectedEdgeStar.h:58
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.
int getIndex(int i) const
Returns the remainder when i is divided by the number of edges in this DirectedEdgeStar.
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:46
Represents an undirected edge of a PlanarGraph.
Definition planargraph/Edge.h:54
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Contains classes to implement a planar graph data structure.
Definition LineMergeDirectedEdge.h:32
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25