GEOS  3.4.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 #include <cstddef>
23 
24 #ifdef _MSC_VER
25 #pragma warning(push)
26 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
27 #endif
28 
29 // Forward declarations
30 namespace geos {
31  namespace geom {
32  class Coordinate;
33  }
34  namespace planargraph {
35  class DirectedEdge;
36  class Edge;
37  }
38 }
39 
40 namespace geos {
41 namespace planargraph { // geos.planargraph
42 
43 using namespace std;
44 
46 class GEOS_DLL DirectedEdgeStar {
47 protected:
48 
49 private:
53  mutable std::vector<DirectedEdge*> outEdges;
54  mutable bool sorted;
55  void sortEdges() const;
56 
57 public:
61  DirectedEdgeStar(): sorted(false) {}
62 
63  virtual ~DirectedEdgeStar() {}
64 
68  void add(DirectedEdge *de);
69 
73  void remove(DirectedEdge *de);
74 
79  std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
81  std::vector<DirectedEdge*>::iterator begin();
82 
84  std::vector<DirectedEdge*>::iterator end();
85 
87  std::vector<DirectedEdge*>::const_iterator begin() const;
88 
90  std::vector<DirectedEdge*>::const_iterator end() const;
91 
96  std::size_t getDegree() const { return outEdges.size(); }
97 
102  geom::Coordinate& getCoordinate() const;
103 
108  std::vector<DirectedEdge*>& getEdges();
109 
115  int getIndex(const Edge *edge);
116 
122  int getIndex(const DirectedEdge *dirEdge);
123 
128  int getIndex(int i) const;
129 
135  DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
136 };
137 
138 } // namespace geos::planargraph
139 } // namespace geos
140 
141 #ifdef _MSC_VER
142 #pragma warning(pop)
143 #endif
144 
145 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
DirectedEdgeStar()
Constructs a DirectedEdgeStar with no edges.
Definition: planargraph/DirectedEdgeStar.h:61
A sorted collection of DirectedEdge which leave a Node in a PlanarGraph.
Definition: planargraph/DirectedEdgeStar.h:46
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:96
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:79
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54