GEOS  3.6.2
EdgeEndStar.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
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 r428 (JTS-1.12+)
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 #ifdef _MSC_VER
00037 #pragma warning(push)
00038 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00039 #endif
00040 
00041 // Forward declarations
00042 namespace geos {
00043         namespace algorithm {
00044                 class BoundaryNodeRule;
00045         }
00046         namespace geomgraph {
00047                 class GeometryGraph;
00048         }
00049 }
00050 
00051 namespace geos {
00052 namespace geomgraph { // geos.geomgraph
00053 
00054 
00063 class GEOS_DLL EdgeEndStar {
00064 public:
00065 
00066         typedef std::set<EdgeEnd *, EdgeEndLT> container;
00067 
00068         typedef container::iterator iterator;
00069         typedef container::const_iterator const_iterator;
00070         typedef container::reverse_iterator reverse_iterator;
00071 
00072         EdgeEndStar();
00073 
00074         virtual ~EdgeEndStar() {}
00075 
00079         virtual void insert(EdgeEnd *e)=0;
00080 
00088         virtual geom::Coordinate& getCoordinate();
00089 
00090         const geom::Coordinate& getCoordinate() const;
00091 
00092         virtual std::size_t getDegree();
00093 
00094         virtual iterator begin();
00095 
00096         virtual iterator end();
00097 
00098         virtual reverse_iterator rbegin();
00099 
00100         virtual reverse_iterator rend();
00101 
00102         virtual const_iterator begin() const { return edgeMap.begin(); }
00103 
00104         virtual const_iterator end() const { return edgeMap.end(); }
00105 
00106         virtual container &getEdges();
00107 
00108         virtual EdgeEnd* getNextCW(EdgeEnd *ee);
00109 
00110         virtual void computeLabelling(std::vector<GeometryGraph*> *geomGraph);
00111                 // throw(TopologyException *);
00112 
00113         virtual bool isAreaLabelsConsistent(const GeometryGraph& geomGraph);
00114 
00115         virtual void propagateSideLabels(int geomIndex);
00116                 // throw(TopologyException *);
00117 
00118         //virtual int findIndex(EdgeEnd *eSearch);
00119         virtual iterator find(EdgeEnd *eSearch);
00120 
00121         virtual std::string print() const;
00122 
00123 protected:
00124 
00129         EdgeEndStar::container edgeMap;
00130 
00134         virtual void insertEdgeEnd(EdgeEnd *e) { edgeMap.insert(e); }
00135 
00136 private:
00137 
00138         virtual int getLocation(int geomIndex,
00139                 const geom::Coordinate& p,
00140                 std::vector<GeometryGraph*> *geom); 
00141 
00146         int ptInAreaLocation[2];
00147 
00148         virtual void computeEdgeEndLabels(const algorithm::BoundaryNodeRule&);
00149 
00150         virtual bool checkAreaLabelsConsistent(int geomIndex);
00151 
00152 };
00153 
00154 inline std::size_t
00155 EdgeEndStar::getDegree()
00156 {
00157         return edgeMap.size();
00158 }
00159 
00160 inline EdgeEndStar::iterator
00161 EdgeEndStar::begin()
00162 {
00163         return edgeMap.begin();
00164 }
00165 
00166 inline EdgeEndStar::container&
00167 EdgeEndStar::getEdges()
00168 {
00169         return edgeMap;
00170 }
00171 
00172 inline EdgeEndStar::reverse_iterator
00173 EdgeEndStar::rend()
00174 {
00175         return edgeMap.rend();
00176 }
00177 
00178 inline EdgeEndStar::iterator
00179 EdgeEndStar::end()
00180 {
00181         return edgeMap.end();
00182 }
00183 
00184 inline EdgeEndStar::reverse_iterator
00185 EdgeEndStar::rbegin()
00186 {
00187         return edgeMap.rbegin();
00188 }
00189 
00190 inline EdgeEndStar::iterator
00191 EdgeEndStar::find(EdgeEnd *eSearch)
00192 {
00193         return edgeMap.find(eSearch);
00194 }
00195 
00196 std::ostream& operator<< (std::ostream&, const EdgeEndStar&);
00197 
00198 } // namespace geos.geomgraph
00199 } // namespace geos
00200 
00201 //#ifdef GEOS_INLINE
00202 //# include "geos/geomgraph/EdgeEndStar.inl"
00203 //#endif
00204 
00205 #ifdef _MSC_VER
00206 #pragma warning(pop)
00207 #endif
00208 
00209 #endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
00210