DirectedEdgeStar.h

00001 /**********************************************************************
00002  * $Id: DirectedEdgeStar.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) 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 <vector>
00021 
00022 // Forward declarations
00023 namespace geos {
00024         namespace geom {
00025                 class Coordinate;
00026         }
00027         namespace planargraph {
00028                 class DirectedEdge;
00029                 class Edge;
00030         }
00031 }
00032 
00033 namespace geos {
00034 namespace planargraph { // geos.planargraph
00035 
00037 class DirectedEdgeStar {
00038 protected:
00039 
00040 private:
00044         mutable std::vector<DirectedEdge*> outEdges;
00045         mutable bool sorted;
00046         void sortEdges() const;
00047 
00048 public:
00052         DirectedEdgeStar(): sorted(false) {}
00053 
00054         virtual ~DirectedEdgeStar() {}
00055 
00059         void add(DirectedEdge *de);
00060 
00064         void remove(DirectedEdge *de);
00065 
00070         std::vector<DirectedEdge*>::iterator iterator() { return begin(); }
00072         std::vector<DirectedEdge*>::iterator begin();
00073 
00075         std::vector<DirectedEdge*>::iterator end();
00076 
00078         std::vector<DirectedEdge*>::const_iterator begin() const;
00079 
00081         std::vector<DirectedEdge*>::const_iterator end() const;
00082 
00087         size_t getDegree() const { return outEdges.size(); }
00088 
00093         geom::Coordinate& getCoordinate() const;
00094 
00099         std::vector<DirectedEdge*>& getEdges();
00100 
00106         int getIndex(const Edge *edge);
00107 
00113         int getIndex(const DirectedEdge *dirEdge);
00114 
00119         int getIndex(int i) const;
00120 
00126         DirectedEdge* getNextEdge(DirectedEdge *dirEdge);
00127 };
00128 
00129 
00130 } // namespace geos::planargraph
00131 } // namespace geos
00132 
00133 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H
00134 
00135 /**********************************************************************
00136  * $Log$
00137  * Revision 1.2  2006/06/12 10:49:43  strk
00138  * unsigned int => size_t
00139  *
00140  * Revision 1.1  2006/03/21 21:42:54  strk
00141  * planargraph.h header split, planargraph:: classes renamed to match JTS symbols
00142  *
00143  **********************************************************************/
00144 

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