GEOS  3.6.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 #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
29 namespace geos {
30  namespace geom {
31  class Coordinate;
32  }
33  namespace planargraph {
34  class DirectedEdge;
35  class Edge;
36  }
37 }
38 
39 namespace geos {
40 namespace planargraph { // geos.planargraph
41 
43 class GEOS_DLL DirectedEdgeStar {
44 protected:
45 
46 private:
50  mutable std::vector<DirectedEdge*> outEdges;
51  mutable bool sorted;
52  void sortEdges() const;
53 
54 public:
58  DirectedEdgeStar(): sorted(false) {}
59 
60  virtual ~DirectedEdgeStar() {}
61 
65  void add(DirectedEdge *de);
66 
70  void remove(DirectedEdge *de);
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 
99  geom::Coordinate& getCoordinate() const;
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 
132  DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
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
DirectedEdgeStar()
Constructs a DirectedEdgeStar with no edges.
Definition: planargraph/DirectedEdgeStar.h:58
A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
Definition: planargraph/DirectedEdgeStar.h:43
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Represents a directed edge in a PlanarGraph.
Definition: planargraph/DirectedEdge.h:46
std::size_t getDegree() const
Returns the number of edges around the Node associated with this DirectedEdgeStar.
Definition: planargraph/DirectedEdgeStar.h:93
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
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54