GEOS 3.2.1
|
00001 /********************************************************************** 00002 * $Id: EdgeEndStar.h 2557 2009-06-08 09:30:55Z strk $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 ********************************************************************** 00016 * 00017 * Last port: geomgraph/EdgeEndStar.java rev. 1.8 (JTS-1.10) 00018 * 00019 **********************************************************************/ 00020 00021 00022 #ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H 00023 #define GEOS_GEOMGRAPH_EDGEENDSTAR_H 00024 00025 #include <geos/export.h> 00026 #include <geos/geomgraph/EdgeEnd.h> // for EdgeEndLT 00027 #include <geos/geom/Coordinate.h> // for p0,p1 00028 00029 #include <geos/inline.h> 00030 00031 #include <set> 00032 #include <string> 00033 #include <vector> 00034 #include <algorithm> // for inlines (find) 00035 00036 // Forward declarations 00037 namespace geos { 00038 namespace algorithm { 00039 class BoundaryNodeRule; 00040 } 00041 namespace geomgraph { 00042 class GeometryGraph; 00043 } 00044 } 00045 00046 namespace geos { 00047 namespace geomgraph { // geos.geomgraph 00048 00049 00058 class GEOS_DLL EdgeEndStar { 00059 public: 00060 00061 typedef std::set<EdgeEnd *, EdgeEndLT> container; 00062 00063 typedef container::iterator iterator; 00064 typedef container::reverse_iterator reverse_iterator; 00065 00066 EdgeEndStar(); 00067 00068 virtual ~EdgeEndStar() {}; 00069 00073 virtual void insert(EdgeEnd *e)=0; 00074 00082 virtual geom::Coordinate& getCoordinate(); 00083 00084 virtual size_t getDegree(); 00085 00086 virtual iterator begin(); 00087 00088 virtual iterator end(); 00089 00090 virtual reverse_iterator rbegin(); 00091 00092 virtual reverse_iterator rend(); 00093 00094 virtual container &getEdges(); 00095 00096 00097 virtual EdgeEnd* getNextCW(EdgeEnd *ee); 00098 00099 virtual void computeLabelling(std::vector<GeometryGraph*> *geomGraph); 00100 // throw(TopologyException *); 00101 00102 virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph); 00103 00104 virtual void propagateSideLabels(int geomIndex); 00105 // throw(TopologyException *); 00106 00107 //virtual int findIndex(EdgeEnd *eSearch); 00108 virtual iterator find(EdgeEnd *eSearch); 00109 00110 virtual std::string print(); 00111 00112 protected: 00113 00118 EdgeEndStar::container edgeMap; 00119 00123 virtual void insertEdgeEnd(EdgeEnd *e) { edgeMap.insert(e); } 00124 00125 private: 00126 00127 virtual int getLocation(int geomIndex, 00128 const geom::Coordinate& p, 00129 std::vector<GeometryGraph*> *geom); 00130 00135 int ptInAreaLocation[2]; 00136 00137 virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&); 00138 00139 virtual bool checkAreaLabelsConsistent(int geomIndex); 00140 00141 }; 00142 00143 inline size_t 00144 EdgeEndStar::getDegree() 00145 { 00146 return edgeMap.size(); 00147 } 00148 00149 inline EdgeEndStar::iterator 00150 EdgeEndStar::begin() 00151 { 00152 return edgeMap.begin(); 00153 } 00154 00155 inline EdgeEndStar::container& 00156 EdgeEndStar::getEdges() 00157 { 00158 return edgeMap; 00159 } 00160 00161 inline EdgeEndStar::reverse_iterator 00162 EdgeEndStar::rend() 00163 { 00164 return edgeMap.rend(); 00165 } 00166 00167 inline EdgeEndStar::iterator 00168 EdgeEndStar::end() 00169 { 00170 return edgeMap.end(); 00171 } 00172 00173 inline EdgeEndStar::reverse_iterator 00174 EdgeEndStar::rbegin() 00175 { 00176 return edgeMap.rbegin(); 00177 } 00178 00179 inline EdgeEndStar::iterator 00180 EdgeEndStar::find(EdgeEnd *eSearch) 00181 { 00182 return edgeMap.find(eSearch); 00183 } 00184 00185 00186 } // namespace geos.geomgraph 00187 } // namespace geos 00188 00189 //#ifdef GEOS_INLINE 00190 //# include "geos/geomgraph/EdgeEndStar.inl" 00191 //#endif 00192 00193 #endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H 00194 00195 /********************************************************************** 00196 * $Log$ 00197 * Revision 1.4 2006/06/12 10:49:43 strk 00198 * unsigned int => size_t 00199 * 00200 * Revision 1.3 2006/04/04 13:35:55 strk 00201 * Port info, assertion checking, indentation 00202 * 00203 * Revision 1.2 2006/03/24 09:52:41 strk 00204 * USE_INLINE => GEOS_INLINE 00205 * 00206 * Revision 1.1 2006/03/09 16:46:49 strk 00207 * geos::geom namespace definition, first pass at headers split 00208 * 00209 **********************************************************************/ 00210