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/Location.h>
28 #include <geos/geom/Coordinate.h> // for p0,p1
29 
30 #include <geos/inline.h>
31 
32 #include <array>
33 #include <set>
34 #include <string>
35 #include <vector>
36 #include <algorithm> // for inlines (find)
37 
38 #ifdef _MSC_VER
39 #pragma warning(push)
40 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
41 #endif
42 
43 // Forward declarations
44 namespace geos {
45 namespace algorithm {
46 class BoundaryNodeRule;
47 }
48 namespace geomgraph {
49 class GeometryGraph;
50 }
51 }
52 
53 namespace geos {
54 namespace geomgraph { // geos.geomgraph
55 
56 
65 class GEOS_DLL EdgeEndStar {
66 public:
67 
68  typedef std::set<EdgeEnd*, EdgeEndLT> container;
69 
70  typedef container::iterator iterator;
71  typedef container::const_iterator const_iterator;
72  typedef container::reverse_iterator reverse_iterator;
73 
74  EdgeEndStar();
75 
76  virtual
77  ~EdgeEndStar() {}
78 
82  virtual void insert(EdgeEnd* e) = 0;
83 
91  virtual geom::Coordinate& getCoordinate();
92 
93  const geom::Coordinate& getCoordinate() const;
94 
95  virtual std::size_t getDegree();
96 
97  virtual iterator begin();
98 
99  virtual iterator end();
100 
101  virtual reverse_iterator rbegin();
102 
103  virtual reverse_iterator rend();
104 
105  virtual const_iterator
106  begin() const
107  {
108  return edgeMap.begin();
109  }
110 
111  virtual const_iterator
112  end() const
113  {
114  return edgeMap.end();
115  }
116 
117  virtual container& getEdges();
118 
119  virtual EdgeEnd* getNextCW(EdgeEnd* ee);
120 
121  virtual void computeLabelling(std::vector<GeometryGraph*>* geomGraph);
122  // throw(TopologyException *);
123 
124  virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
125 
126  virtual void propagateSideLabels(int geomIndex);
127  // throw(TopologyException *);
128 
129  //virtual int findIndex(EdgeEnd *eSearch);
130  virtual iterator find(EdgeEnd* eSearch);
131 
132  virtual std::string print() const;
133 
134 protected:
135 
140  EdgeEndStar::container edgeMap;
141 
145  virtual void
147  {
148  edgeMap.insert(e);
149  }
150 
151 private:
152 
153  virtual geom::Location getLocation(int geomIndex,
154  const geom::Coordinate& p,
155  std::vector<GeometryGraph*>* geom);
156 
161  std::array<geom::Location, 2> ptInAreaLocation;
162 
163  virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
164 
165  virtual bool checkAreaLabelsConsistent(int geomIndex);
166 
167 };
168 
169 inline std::size_t
170 EdgeEndStar::getDegree()
171 {
172  return edgeMap.size();
173 }
174 
175 inline EdgeEndStar::iterator
176 EdgeEndStar::begin()
177 {
178  return edgeMap.begin();
179 }
180 
181 inline EdgeEndStar::container&
182 EdgeEndStar::getEdges()
183 {
184  return edgeMap;
185 }
186 
187 inline EdgeEndStar::reverse_iterator
188 EdgeEndStar::rend()
189 {
190  return edgeMap.rend();
191 }
192 
193 inline EdgeEndStar::iterator
194 EdgeEndStar::end()
195 {
196  return edgeMap.end();
197 }
198 
199 inline EdgeEndStar::reverse_iterator
200 EdgeEndStar::rbegin()
201 {
202  return edgeMap.rbegin();
203 }
204 
205 inline EdgeEndStar::iterator
206 EdgeEndStar::find(EdgeEnd* eSearch)
207 {
208  return edgeMap.find(eSearch);
209 }
210 
211 std::ostream& operator<< (std::ostream&, const EdgeEndStar&);
212 
213 } // namespace geos.geomgraph
214 } // namespace geos
215 
216 //#ifdef GEOS_INLINE
217 //# include "geos/geomgraph/EdgeEndStar.inl"
218 //#endif
219 
220 #ifdef _MSC_VER
221 #pragma warning(pop)
222 #endif
223 
224 #endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
225 
virtual void insertEdgeEnd(EdgeEnd *e)
Insert an EdgeEnd into the map.
Definition: EdgeEndStar.h:146
A EdgeEndStar is an ordered list of EdgeEnds around a node.
Definition: EdgeEndStar.h:65
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
A GeometryGraph is a graph that models a given Geometry.
Definition: GeometryGraph.h:73
Models the end of an edge incident on a node.
Definition: EdgeEnd.h:56
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
Definition: BoundaryNodeRule.h:51
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:33
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:140