GEOS  3.8.0dev
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
61  ~DirectedEdgeStar() {}
62 
66  void add(DirectedEdge* de);
67 
71  void remove(DirectedEdge* de);
72 
77  std::vector<DirectedEdge*>::iterator
79  {
80  return begin();
81  }
83  std::vector<DirectedEdge*>::iterator begin();
84 
86  std::vector<DirectedEdge*>::iterator end();
87 
89  std::vector<DirectedEdge*>::const_iterator begin() const;
90 
92  std::vector<DirectedEdge*>::const_iterator end() const;
93 
98  std::size_t
99  getDegree() const
100  {
101  return outEdges.size();
102  }
103 
108  geom::Coordinate& getCoordinate() const;
109 
114  std::vector<DirectedEdge*>& getEdges();
115 
121  int getIndex(const Edge* edge);
122 
128  int getIndex(const DirectedEdge* dirEdge);
129 
134  int getIndex(int i) const;
135 
141  DirectedEdge* getNextEdge(DirectedEdge* dirEdge);
142 };
143 
144 } // namespace geos::planargraph
145 } // namespace geos
146 
147 #ifdef _MSC_VER
148 #pragma warning(pop)
149 #endif
150 
151 #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:99
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:78
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Represents an undirected edge of a PlanarGraph.
Definition: planargraph/Edge.h:54