GEOS  3.8.0dev
EdgeEndStar.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions 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  * Last port: geomgraph/EdgeEndStar.java r428 (JTS-1.12+)
18  *
19  **********************************************************************/
20 
21 
22 #ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
23 #define GEOS_GEOMGRAPH_EDGEENDSTAR_H
24 
25 #include <geos/export.h>
26 #include <geos/geomgraph/EdgeEnd.h> // for EdgeEndLT
27 #include <geos/geom/Coordinate.h> // for p0,p1
28 
29 #include <geos/inline.h>
30 
31 #include <set>
32 #include <string>
33 #include <vector>
34 #include <algorithm> // for inlines (find)
35 
36 #ifdef _MSC_VER
37 #pragma warning(push)
38 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
39 #endif
40 
41 // Forward declarations
42 namespace geos {
43 namespace algorithm {
44 class BoundaryNodeRule;
45 }
46 namespace geomgraph {
47 class GeometryGraph;
48 }
49 }
50 
51 namespace geos {
52 namespace geomgraph { // geos.geomgraph
53 
54 
63 class GEOS_DLL EdgeEndStar {
64 public:
65 
66  typedef std::set<EdgeEnd*, EdgeEndLT> container;
67 
68  typedef container::iterator iterator;
69  typedef container::const_iterator const_iterator;
70  typedef container::reverse_iterator reverse_iterator;
71 
72  EdgeEndStar();
73 
74  virtual
75  ~EdgeEndStar() {}
76 
80  virtual void insert(EdgeEnd* e) = 0;
81 
89  virtual geom::Coordinate& getCoordinate();
90 
91  const geom::Coordinate& getCoordinate() const;
92 
93  virtual std::size_t getDegree();
94 
95  virtual iterator begin();
96 
97  virtual iterator end();
98 
99  virtual reverse_iterator rbegin();
100 
101  virtual reverse_iterator rend();
102 
103  virtual const_iterator
104  begin() const
105  {
106  return edgeMap.begin();
107  }
108 
109  virtual const_iterator
110  end() const
111  {
112  return edgeMap.end();
113  }
114 
115  virtual container& getEdges();
116 
117  virtual EdgeEnd* getNextCW(EdgeEnd* ee);
118 
119  virtual void computeLabelling(std::vector<GeometryGraph*>* geomGraph);
120  // throw(TopologyException *);
121 
122  virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
123 
124  virtual void propagateSideLabels(int geomIndex);
125  // throw(TopologyException *);
126 
127  //virtual int findIndex(EdgeEnd *eSearch);
128  virtual iterator find(EdgeEnd* eSearch);
129 
130  virtual std::string print() const;
131 
132 protected:
133 
138  EdgeEndStar::container edgeMap;
139 
143  virtual void
145  {
146  edgeMap.insert(e);
147  }
148 
149 private:
150 
151  virtual int getLocation(int geomIndex,
152  const geom::Coordinate& p,
153  std::vector<GeometryGraph*>* geom);
154 
159  int ptInAreaLocation[2];
160 
161  virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
162 
163  virtual bool checkAreaLabelsConsistent(int geomIndex);
164 
165 };
166 
167 inline std::size_t
168 EdgeEndStar::getDegree()
169 {
170  return edgeMap.size();
171 }
172 
173 inline EdgeEndStar::iterator
174 EdgeEndStar::begin()
175 {
176  return edgeMap.begin();
177 }
178 
179 inline EdgeEndStar::container&
180 EdgeEndStar::getEdges()
181 {
182  return edgeMap;
183 }
184 
185 inline EdgeEndStar::reverse_iterator
186 EdgeEndStar::rend()
187 {
188  return edgeMap.rend();
189 }
190 
191 inline EdgeEndStar::iterator
192 EdgeEndStar::end()
193 {
194  return edgeMap.end();
195 }
196 
197 inline EdgeEndStar::reverse_iterator
198 EdgeEndStar::rbegin()
199 {
200  return edgeMap.rbegin();
201 }
202 
203 inline EdgeEndStar::iterator
204 EdgeEndStar::find(EdgeEnd* eSearch)
205 {
206  return edgeMap.find(eSearch);
207 }
208 
209 std::ostream& operator<< (std::ostream&, const EdgeEndStar&);
210 
211 } // namespace geos.geomgraph
212 } // namespace geos
213 
214 //#ifdef GEOS_INLINE
215 //# include "geos/geomgraph/EdgeEndStar.inl"
216 //#endif
217 
218 #ifdef _MSC_VER
219 #pragma warning(pop)
220 #endif
221 
222 #endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
223 
virtual void insertEdgeEnd(EdgeEnd *e)
Insert an EdgeEnd into the map.
Definition: EdgeEndStar.h:144
A EdgeEndStar is an ordered list of EdgeEnds around a node.
Definition: EdgeEndStar.h:63
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Definition: GeometryGraph.h:73
Models the end of an edge incident on a node.
Definition: EdgeEnd.h:56
Definition: BoundaryNodeRule.h:50
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
EdgeEndStar::container edgeMap
A map which maintains the edges in sorted order around the node.
Definition: EdgeEndStar.h:138