GEOS  3.13.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 #pragma once
23 
24 #include <geos/export.h>
25 #include <geos/geomgraph/EdgeEnd.h> // for EdgeEndLT
26 #include <geos/geom/Location.h>
27 #include <geos/geom/Coordinate.h> // for p0,p1
28 
29 #include <array>
30 #include <memory>
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 
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(const std::vector<std::unique_ptr<GeometryGraph>>&geomGraph);
120  // throw(TopologyException *);
121 
122  virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
123 
124  virtual void propagateSideLabels(uint32_t 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 geom::Location getLocation(uint32_t geomIndex,
152  const geom::Coordinate&p,
153  const std::vector<std::unique_ptr<GeometryGraph>>&geom);
154 
159  std::array<geom::Location, 2> ptInAreaLocation;
160 
161  virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
162 
163  virtual bool checkAreaLabelsConsistent(uint32_t 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 _MSC_VER
215 #pragma warning(pop)
216 #endif
217 
An interface for rules which determine whether node points which are in boundaries of lineal geometry...
Definition: BoundaryNodeRule.h:50
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
A EdgeEndStar is an ordered list of EdgeEnds around a node.
Definition: EdgeEndStar.h:63
virtual geom::Coordinate & getCoordinate()
EdgeEndStar::container edgeMap
A map which maintains the edges in sorted order around the node.
Definition: EdgeEndStar.h:138
virtual void insert(EdgeEnd *e)=0
Insert a EdgeEnd into this EdgeEndStar.
virtual void insertEdgeEnd(EdgeEnd *e)
Insert an EdgeEnd into the map.
Definition: EdgeEndStar.h:144
Models the end of an edge incident on a node.
Definition: EdgeEnd.h:54
Location
Constants representing the location of a point relative to a geometry.
Definition: Location.h:32
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25