GEOS  3.6.2
DirectedEdgeStar.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00007  * Copyright (C) 2005-2006 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************/
00015 
00016 #ifndef GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
00017 #define GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
00018 
00019 #include <geos/export.h>
00020 
00021 #include <vector>
00022 
00023 #ifdef _MSC_VER
00024 #pragma warning(push)
00025 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00026 #endif
00027 
00028 // Forward declarations
00029 namespace geos {
00030         namespace geom {
00031                 class Coordinate;
00032         }
00033         namespace planargraph {
00034                 class DirectedEdge;
00035                 class Edge;
00036         }
00037 }
00038 
00039 namespace geos {
00040 namespace planargraph { // geos.planargraph
00041 
00043 class GEOS_DLL DirectedEdgeStar {
00044 protected:
00045 
00046 private:
00050         mutable std::vector<DirectedEdge*> outEdges;
00051         mutable bool sorted;
00052         void sortEdges() const;
00053 
00054 public:
00058         DirectedEdgeStar(): sorted(false) {}
00059 
00060         virtual ~DirectedEdgeStar() {}
00061 
00065         void add(DirectedEdge *de);
00066 
00070         void remove(DirectedEdge *de);
00071 
00076         std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
00078         std::vector<DirectedEdge*>::iterator begin();
00079 
00081         std::vector<DirectedEdge*>::iterator end();
00082 
00084         std::vector<DirectedEdge*>::const_iterator begin() const;
00085 
00087         std::vector<DirectedEdge*>::const_iterator end() const;
00088 
00093          std::size_t getDegree() const { return outEdges.size(); }
00094 
00099         geom::Coordinate& getCoordinate() const;
00100 
00105         std::vector<DirectedEdge*>& getEdges();
00106 
00112         int getIndex(const Edge *edge);
00113 
00119         int getIndex(const DirectedEdge *dirEdge);
00120 
00125         int getIndex(int i) const;
00126 
00132         DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
00133 };
00134 
00135 } // namespace geos::planargraph
00136 } // namespace geos
00137 
00138 #ifdef _MSC_VER
00139 #pragma warning(pop)
00140 #endif
00141 
00142 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H