GEOS  3.3.3
EdgeEndStar.h
1 /**********************************************************************
2  * $Id: EdgeEndStar.h 2961 2010-03-29 12:17:37Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
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 rev. 1.8 (JTS-1.10)
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::reverse_iterator reverse_iterator;
70 
71  EdgeEndStar();
72 
73  virtual ~EdgeEndStar() {};
74 
78  virtual void insert(EdgeEnd *e)=0;
79 
87  virtual geom::Coordinate& getCoordinate();
88 
89  virtual std::size_t getDegree();
90 
91  virtual iterator begin();
92 
93  virtual iterator end();
94 
95  virtual reverse_iterator rbegin();
96 
97  virtual reverse_iterator rend();
98 
99  virtual container &getEdges();
100 
101 
102  virtual EdgeEnd* getNextCW(EdgeEnd *ee);
103 
104  virtual void computeLabelling(std::vector<GeometryGraph*> *geomGraph);
105  // throw(TopologyException *);
106 
107  virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
108 
109  virtual void propagateSideLabels(int geomIndex);
110  // throw(TopologyException *);
111 
112  //virtual int findIndex(EdgeEnd *eSearch);
113  virtual iterator find(EdgeEnd *eSearch);
114 
115  virtual std::string print();
116 
117 protected:
118 
123  EdgeEndStar::container edgeMap;
124 
128  virtual void insertEdgeEnd(EdgeEnd *e) { edgeMap.insert(e); }
129 
130 private:
131 
132  virtual int getLocation(int geomIndex,
133  const geom::Coordinate& p,
134  std::vector<GeometryGraph*> *geom);
135 
140  int ptInAreaLocation[2];
141 
142  virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
143 
144  virtual bool checkAreaLabelsConsistent(int geomIndex);
145 
146 };
147 
148 inline std::size_t
149 EdgeEndStar::getDegree()
150 {
151  return edgeMap.size();
152 }
153 
154 inline EdgeEndStar::iterator
155 EdgeEndStar::begin()
156 {
157  return edgeMap.begin();
158 }
159 
160 inline EdgeEndStar::container&
161 EdgeEndStar::getEdges()
162 {
163  return edgeMap;
164 }
165 
166 inline EdgeEndStar::reverse_iterator
167 EdgeEndStar::rend()
168 {
169  return edgeMap.rend();
170 }
171 
172 inline EdgeEndStar::iterator
173 EdgeEndStar::end()
174 {
175  return edgeMap.end();
176 }
177 
178 inline EdgeEndStar::reverse_iterator
179 EdgeEndStar::rbegin()
180 {
181  return edgeMap.rbegin();
182 }
183 
184 inline EdgeEndStar::iterator
185 EdgeEndStar::find(EdgeEnd *eSearch)
186 {
187  return edgeMap.find(eSearch);
188 }
189 
190 
191 } // namespace geos.geomgraph
192 } // namespace geos
193 
194 //#ifdef GEOS_INLINE
195 //# include "geos/geomgraph/EdgeEndStar.inl"
196 //#endif
197 
198 #ifdef _MSC_VER
199 #pragma warning(pop)
200 #endif
201 
202 #endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
203 
204 /**********************************************************************
205  * $Log$
206  * Revision 1.4 2006/06/12 10:49:43 strk
207  * unsigned int => size_t
208  *
209  * Revision 1.3 2006/04/04 13:35:55 strk
210  * Port info, assertion checking, indentation
211  *
212  * Revision 1.2 2006/03/24 09:52:41 strk
213  * USE_INLINE => GEOS_INLINE
214  *
215  * Revision 1.1 2006/03/09 16:46:49 strk
216  * geos::geom namespace definition, first pass at headers split
217  *
218  **********************************************************************/
219