GEOS  3.3.8
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 
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 
44 class GEOS_DLL DirectedEdgeStar {
45 protected:
46 
47 private:
51  mutable std::vector<DirectedEdge*> outEdges;
52  mutable bool sorted;
53  void sortEdges() const;
54 
55 public:
59  DirectedEdgeStar(): sorted(false) {}
60 
61  virtual ~DirectedEdgeStar() {}
62 
66  void add(DirectedEdge *de);
67 
71  void remove(DirectedEdge *de);
72 
77  std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
79  std::vector<DirectedEdge*>::iterator begin();
80 
82  std::vector<DirectedEdge*>::iterator end();
83 
85  std::vector<DirectedEdge*>::const_iterator begin() const;
86 
88  std::vector<DirectedEdge*>::const_iterator end() const;
89 
94  std::size_t getDegree() const { return outEdges.size(); }
95 
100  geom::Coordinate& getCoordinate() const;
101 
106  std::vector<DirectedEdge*>& getEdges();
107 
113  int getIndex(const Edge *edge);
114 
120  int getIndex(const DirectedEdge *dirEdge);
121 
126  int getIndex(int i) const;
127 
133  DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
134 };
135 
136 } // namespace geos::planargraph
137 } // namespace geos
138 
139 #ifdef _MSC_VER
140 #pragma warning(pop)
141 #endif
142 
143 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
144 
145 /**********************************************************************
146  * $Log$
147  * Revision 1.2 2006/06/12 10:49:43 strk
148  * unsigned int => size_t
149  *
150  * Revision 1.1 2006/03/21 21:42:54 strk
151  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
152  *
153  **********************************************************************/
154