GEOS  3.6.1
EdgeEndStar.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
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 ~EdgeEndStar() {}
75 
79  virtual void insert(EdgeEnd *e)=0;
80 
88  virtual geom::Coordinate& getCoordinate();
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 begin() const { return edgeMap.begin(); }
103 
104  virtual const_iterator end() const { return edgeMap.end(); }
105 
106  virtual container &getEdges();
107 
108  virtual EdgeEnd* getNextCW(EdgeEnd *ee);
109 
110  virtual void computeLabelling(std::vector<GeometryGraph*> *geomGraph);
111  // throw(TopologyException *);
112 
113  virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
114 
115  virtual void propagateSideLabels(int geomIndex);
116  // throw(TopologyException *);
117 
118  //virtual int findIndex(EdgeEnd *eSearch);
119  virtual iterator find(EdgeEnd *eSearch);
120 
121  virtual std::string print() const;
122 
123 protected:
124 
129  EdgeEndStar::container edgeMap;
130 
134  virtual void insertEdgeEnd(EdgeEnd *e) { edgeMap.insert(e); }
135 
136 private:
137 
138  virtual int getLocation(int geomIndex,
139  const geom::Coordinate& p,
140  std::vector<GeometryGraph*> *geom);
141 
146  int ptInAreaLocation[2];
147 
148  virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
149 
150  virtual bool checkAreaLabelsConsistent(int geomIndex);
151 
152 };
153 
154 inline std::size_t
155 EdgeEndStar::getDegree()
156 {
157  return edgeMap.size();
158 }
159 
160 inline EdgeEndStar::iterator
161 EdgeEndStar::begin()
162 {
163  return edgeMap.begin();
164 }
165 
166 inline EdgeEndStar::container&
167 EdgeEndStar::getEdges()
168 {
169  return edgeMap;
170 }
171 
172 inline EdgeEndStar::reverse_iterator
173 EdgeEndStar::rend()
174 {
175  return edgeMap.rend();
176 }
177 
178 inline EdgeEndStar::iterator
179 EdgeEndStar::end()
180 {
181  return edgeMap.end();
182 }
183 
184 inline EdgeEndStar::reverse_iterator
185 EdgeEndStar::rbegin()
186 {
187  return edgeMap.rbegin();
188 }
189 
190 inline EdgeEndStar::iterator
191 EdgeEndStar::find(EdgeEnd *eSearch)
192 {
193  return edgeMap.find(eSearch);
194 }
195 
196 std::ostream& operator<< (std::ostream&, const EdgeEndStar&);
197 
198 } // namespace geos.geomgraph
199 } // namespace geos
200 
201 //#ifdef GEOS_INLINE
202 //# include "geos/geomgraph/EdgeEndStar.inl"
203 //#endif
204 
205 #ifdef _MSC_VER
206 #pragma warning(pop)
207 #endif
208 
209 #endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
210 
virtual void insertEdgeEnd(EdgeEnd *e)
Insert an EdgeEnd into the map.
Definition: EdgeEndStar.h:134
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:129