EdgeEndStar.h

00001 /**********************************************************************
00002  * $Id: EdgeEndStar.h 1820 2006-09-06 16:54:23Z mloskot $
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.4 (JTS-1.7)
00018  *
00019  **********************************************************************/
00020 
00021 
00022 #ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
00023 #define GEOS_GEOMGRAPH_EDGEENDSTAR_H
00024 
00025 #include <geos/geomgraph/EdgeEnd.h>  // for EdgeEndLT
00026 #include <geos/geom/Coordinate.h>  // for p0,p1
00027 
00028 #include <geos/inline.h>
00029 
00030 #include <set>
00031 #include <string>
00032 #include <vector>
00033 #include <algorithm> // for inlines (find)
00034 
00035 // Forward declarations
00036 namespace geos {
00037         namespace geomgraph {
00038                 class GeometryGraph;
00039         }
00040 }
00041 
00042 namespace geos {
00043 namespace geomgraph { // geos.geomgraph
00044 
00045 
00054 class EdgeEndStar {
00055 public:
00056 
00057         typedef std::set<EdgeEnd *, EdgeEndLT> container;
00058 
00059         typedef container::iterator iterator;
00060         typedef container::reverse_iterator reverse_iterator;
00061 
00062         EdgeEndStar();
00063 
00064         virtual ~EdgeEndStar() {};
00065 
00069         virtual void insert(EdgeEnd *e)=0;
00070 
00078         virtual geom::Coordinate& getCoordinate();
00079 
00080         virtual size_t getDegree();
00081 
00082         virtual iterator begin();
00083 
00084         virtual iterator end();
00085 
00086         virtual reverse_iterator rbegin();
00087 
00088         virtual reverse_iterator rend();
00089 
00090         virtual container &getEdges();
00091 
00092 
00093         virtual EdgeEnd* getNextCW(EdgeEnd *ee);
00094 
00095         virtual void computeLabelling(std::vector<GeometryGraph*> *geom);
00096                 // throw(TopologyException *);
00097 
00098         virtual int getLocation(int geomIndex,
00099                 const geom::Coordinate& p,
00100                 std::vector<GeometryGraph*> *geom); 
00101 
00102         virtual bool isAreaLabelsConsistent();
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 
00131         int ptInAreaLocation[2];
00132 
00133         virtual void computeEdgeEndLabels();
00134 
00135         virtual bool checkAreaLabelsConsistent(int geomIndex);
00136 
00137 };
00138 
00139 inline size_t
00140 EdgeEndStar::getDegree()
00141 {
00142         return edgeMap.size();
00143 }
00144 
00145 inline EdgeEndStar::iterator
00146 EdgeEndStar::begin()
00147 {
00148         return edgeMap.begin();
00149 }
00150 
00151 inline EdgeEndStar::container&
00152 EdgeEndStar::getEdges()
00153 {
00154         return edgeMap;
00155 }
00156 
00157 inline EdgeEndStar::reverse_iterator
00158 EdgeEndStar::rend()
00159 {
00160         return edgeMap.rend();
00161 }
00162 
00163 inline EdgeEndStar::iterator
00164 EdgeEndStar::end()
00165 {
00166         return edgeMap.end();
00167 }
00168 
00169 inline EdgeEndStar::reverse_iterator
00170 EdgeEndStar::rbegin()
00171 {
00172         return edgeMap.rbegin();
00173 }
00174 
00175 inline EdgeEndStar::iterator
00176 EdgeEndStar::find(EdgeEnd *eSearch)
00177 {
00178         return edgeMap.find(eSearch);
00179 }
00180 
00181 
00182 } // namespace geos.geomgraph
00183 } // namespace geos
00184 
00185 //#ifdef GEOS_INLINE
00186 //# include "geos/geomgraph/EdgeEndStar.inl"
00187 //#endif
00188 
00189 #endif // ifndef GEOS_GEOMGRAPH_EDGEENDSTAR_H
00190 
00191 /**********************************************************************
00192  * $Log$
00193  * Revision 1.4  2006/06/12 10:49:43  strk
00194  * unsigned int => size_t
00195  *
00196  * Revision 1.3  2006/04/04 13:35:55  strk
00197  * Port info, assertion checking, indentation
00198  *
00199  * Revision 1.2  2006/03/24 09:52:41  strk
00200  * USE_INLINE => GEOS_INLINE
00201  *
00202  * Revision 1.1  2006/03/09 16:46:49  strk
00203  * geos::geom namespace definition, first pass at headers split
00204  *
00205  **********************************************************************/
00206 

Generated on Fri Mar 27 04:52:40 2009 for GEOS by  doxygen 1.5.4