GEOS  3.3.3
planargraph/DirectedEdgeStar.h
1 /**********************************************************************
2  * $Id: DirectedEdgeStar.h 3255 2011-03-01 17:56:10Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  * Copyright (C) 2005-2006 Refractions Research Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************/
16 
17 #ifndef GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
18 #define GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
19 
20 #include <geos/export.h>
21 
22 #include <vector>
23 #include <cstddef>
24 
25 #ifdef _MSC_VER
26 #pragma warning(push)
27 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
28 #endif
29 
30 // Forward declarations
31 namespace geos {
32  namespace geom {
33  class Coordinate;
34  }
35  namespace planargraph {
36  class DirectedEdge;
37  class Edge;
38  }
39 }
40 
41 namespace geos {
42 namespace planargraph { // geos.planargraph
43 
44 using namespace std;
45 
47 class GEOS_DLL DirectedEdgeStar {
48 protected:
49 
50 private:
54  mutable std::vector<DirectedEdge*> outEdges;
55  mutable bool sorted;
56  void sortEdges() const;
57 
58 public:
62  DirectedEdgeStar(): sorted(false) {}
63 
64  virtual ~DirectedEdgeStar() {}
65 
69  void add(DirectedEdge *de);
70 
74  void remove(DirectedEdge *de);
75 
80  std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
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 getDegree() const { return outEdges.size(); }
98 
103  geom::Coordinate& getCoordinate() const;
104 
109  std::vector<DirectedEdge*>& getEdges();
110 
116  int getIndex(const Edge *edge);
117 
123  int getIndex(const DirectedEdge *dirEdge);
124 
129  int getIndex(int i) const;
130 
136  DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
137 };
138 
139 } // namespace geos::planargraph
140 } // namespace geos
141 
142 #ifdef _MSC_VER
143 #pragma warning(pop)
144 #endif
145 
146 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
147 
148 /**********************************************************************
149  * $Log$
150  * Revision 1.2 2006/06/12 10:49:43 strk
151  * unsigned int => size_t
152  *
153  * Revision 1.1 2006/03/21 21:42:54 strk
154  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
155  *
156  **********************************************************************/
157