GEOS  3.3.6
DirectedEdgeStar.h
00001 /**********************************************************************
00002  * $Id: DirectedEdgeStar.h 3255 2011-03-01 17:56:10Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  * Copyright (C) 2005-2006 Refractions Research 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 #ifndef GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
00018 #define GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
00019 
00020 #include <geos/export.h>
00021 
00022 #include <vector>
00023 
00024 #ifdef _MSC_VER
00025 #pragma warning(push)
00026 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00027 #endif
00028 
00029 // Forward declarations
00030 namespace geos {
00031         namespace geom {
00032                 class Coordinate;
00033         }
00034         namespace planargraph {
00035                 class DirectedEdge;
00036                 class Edge;
00037         }
00038 }
00039 
00040 namespace geos {
00041 namespace planargraph { // geos.planargraph
00042 
00044 class GEOS_DLL DirectedEdgeStar {
00045 protected:
00046 
00047 private:
00051         mutable std::vector<DirectedEdge*> outEdges;
00052         mutable bool sorted;
00053         void sortEdges() const;
00054 
00055 public:
00059         DirectedEdgeStar(): sorted(false) {}
00060 
00061         virtual ~DirectedEdgeStar() {}
00062 
00066         void add(DirectedEdge *de);
00067 
00071         void remove(DirectedEdge *de);
00072 
00077         std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
00079         std::vector<DirectedEdge*>::iterator begin();
00080 
00082         std::vector<DirectedEdge*>::iterator end();
00083 
00085         std::vector<DirectedEdge*>::const_iterator begin() const;
00086 
00088         std::vector<DirectedEdge*>::const_iterator end() const;
00089 
00094          std::size_t getDegree() const { return outEdges.size(); }
00095 
00100         geom::Coordinate& getCoordinate() const;
00101 
00106         std::vector<DirectedEdge*>& getEdges();
00107 
00113         int getIndex(const Edge *edge);
00114 
00120         int getIndex(const DirectedEdge *dirEdge);
00121 
00126         int getIndex(int i) const;
00127 
00133         DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
00134 };
00135 
00136 } // namespace geos::planargraph
00137 } // namespace geos
00138 
00139 #ifdef _MSC_VER
00140 #pragma warning(pop)
00141 #endif
00142 
00143 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
00144 
00145 /**********************************************************************
00146  * $Log$
00147  * Revision 1.2  2006/06/12 10:49:43  strk
00148  * unsigned int => size_t
00149  *
00150  * Revision 1.1  2006/03/21 21:42:54  strk
00151  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
00152  *
00153  **********************************************************************/
00154