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 <set>
31 #include <string>
32 #include <vector>
33 #include <algorithm> // for inlines (find)
34 
35 #ifdef _MSC_VER
36 #pragma warning(push)
37 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
38 #endif
39 
40 // Forward declarations
41 namespace geos {
42 namespace algorithm {
43 class BoundaryNodeRule;
44 }
45 namespace geomgraph {
46 class GeometryGraph;
47 }
48 }
49 
50 namespace geos {
51 namespace geomgraph { // geos.geomgraph
52 
53 
62 class GEOS_DLL EdgeEndStar {
63 public:
64 
65  typedef std::set<EdgeEnd*, EdgeEndLT> container;
66 
67  typedef container::iterator iterator;
68  typedef container::const_iterator const_iterator;
69  typedef container::reverse_iterator reverse_iterator;
70 
71  EdgeEndStar();
72 
73  virtual
74  ~EdgeEndStar() {}
75 
79  virtual void insert(EdgeEnd* e) = 0;
80 
89 
90  const geom::Coordinate& getCoordinate() const;
91 
92  virtual std::size_t getDegree();
93 
94  virtual iterator begin();
95 
96  virtual iterator end();
97 
98  virtual reverse_iterator rbegin();
99 
100  virtual reverse_iterator rend();
101 
102  virtual const_iterator
103  begin() const
104  {
105  return edgeMap.begin();
106  }
107 
108  virtual const_iterator
109  end() const
110  {
111  return edgeMap.end();
112  }
113 
114  virtual container& getEdges();
115 
116  virtual EdgeEnd* getNextCW(EdgeEnd* ee);
117 
118  virtual void computeLabelling(std::vector<GeometryGraph*>* geomGraph);
119  // throw(TopologyException *);
120 
121  virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
122 
123  virtual void propagateSideLabels(uint32_t geomIndex);
124  // throw(TopologyException *);
125 
126  //virtual int findIndex(EdgeEnd *eSearch);
127  virtual iterator find(EdgeEnd* eSearch);
128 
129  virtual std::string print() const;
130 
131 protected:
132 
137  EdgeEndStar::container edgeMap;
138 
142  virtual void
144  {
145  edgeMap.insert(e);
146  }
147 
148 private:
149 
150  virtual geom::Location getLocation(uint32_t geomIndex,
151  const geom::Coordinate& p,
152  std::vector<GeometryGraph*>* geom);
153 
158  std::array<geom::Location, 2> ptInAreaLocation;
159 
160  virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
161 
162  virtual bool checkAreaLabelsConsistent(uint32_t geomIndex);
163 
164 };
165 
166 inline std::size_t
167 EdgeEndStar::getDegree()
168 {
169  return edgeMap.size();
170 }
171 
172 inline EdgeEndStar::iterator
173 EdgeEndStar::begin()
174 {
175  return edgeMap.begin();
176 }
177 
178 inline EdgeEndStar::container&
179 EdgeEndStar::getEdges()
180 {
181  return edgeMap;
182 }
183 
184 inline EdgeEndStar::reverse_iterator
185 EdgeEndStar::rend()
186 {
187  return edgeMap.rend();
188 }
189 
190 inline EdgeEndStar::iterator
191 EdgeEndStar::end()
192 {
193  return edgeMap.end();
194 }
195 
196 inline EdgeEndStar::reverse_iterator
197 EdgeEndStar::rbegin()
198 {
199  return edgeMap.rbegin();
200 }
201 
202 inline EdgeEndStar::iterator
203 EdgeEndStar::find(EdgeEnd* eSearch)
204 {
205  return edgeMap.find(eSearch);
206 }
207 
208 std::ostream& operator<< (std::ostream&, const EdgeEndStar&);
209 
210 } // namespace geos.geomgraph
211 } // namespace geos
212 
213 #ifdef _MSC_VER
214 #pragma warning(pop)
215 #endif
216 
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:62
virtual geom::Coordinate & getCoordinate()
EdgeEndStar::container edgeMap
A map which maintains the edges in sorted order around the node.
Definition: EdgeEndStar.h:137
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:143
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