GEOS  3.9.1dev
EdgeEndStar.h
Go to the documentation of this file.
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 
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
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(uint32_t 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 
141 
145  virtual void
147  {
148  edgeMap.insert(e);
149  }
150 
151 private:
152 
153  virtual geom::Location getLocation(uint32_t 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(uint32_t geomIndex);
166 
167 };
168 
169 inline std::size_t
170 EdgeEndStar::getDegree()
171 {
172  return edgeMap.size();
173 }
174 
176 EdgeEndStar::begin()
177 {
178  return edgeMap.begin();
179 }
180 
182 EdgeEndStar::getEdges()
183 {
184  return edgeMap;
185 }
186 
188 EdgeEndStar::rend()
189 {
190  return edgeMap.rend();
191 }
192 
194 EdgeEndStar::end()
195 {
196  return edgeMap.end();
197 }
198 
200 EdgeEndStar::rbegin()
201 {
202  return edgeMap.rbegin();
203 }
204 
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
std::set< EdgeEnd *, EdgeEndLT > container
Definition: EdgeEndStar.h:68
virtual const_iterator end() const
Definition: EdgeEndStar.h:112
#define GEOS_DLL
Definition: export.h:28
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
container::iterator iterator
Definition: EdgeEndStar.h:70
A GeometryGraph is a graph that models a given Geometry.
Definition: GeometryGraph.h:74
virtual const_iterator begin() const
Definition: EdgeEndStar.h:106
container::const_iterator const_iterator
Definition: EdgeEndStar.h:71
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...
std::array< geom::Location, 2 > ptInAreaLocation
The location of the point for this star in Geometry i Areas.
Definition: EdgeEndStar.h:161
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:34
Basic namespace for all GEOS functionalities.
container::reverse_iterator reverse_iterator
Definition: EdgeEndStar.h:72
std::ostream & operator<<(std::ostream &o, const HCoordinate &c)
EdgeEndStar::container edgeMap
A map which maintains the edges in sorted order around the node.
Definition: EdgeEndStar.h:140