GEOS 3.2.2
|
00001 /********************************************************************** 00002 * $Id: DirectedEdgeStar.h 2556 2009-06-06 22:22:28Z strk $ 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 #include <cstddef> 00024 00025 // Forward declarations 00026 namespace geos { 00027 namespace geom { 00028 class Coordinate; 00029 } 00030 namespace planargraph { 00031 class DirectedEdge; 00032 class Edge; 00033 } 00034 } 00035 00036 namespace geos { 00037 namespace planargraph { // geos.planargraph 00038 00039 using namespace std; 00040 00042 class GEOS_DLL DirectedEdgeStar { 00043 protected: 00044 00045 private: 00049 mutable std::vector<DirectedEdge*> outEdges; 00050 mutable bool sorted; 00051 void sortEdges() const; 00052 00053 public: 00057 DirectedEdgeStar(): sorted(false) {} 00058 00059 virtual ~DirectedEdgeStar() {} 00060 00064 void add(DirectedEdge *de); 00065 00069 void remove(DirectedEdge *de); 00070 00075 std::vector<DirectedEdge*>::iterator iterator() { return begin(); } 00077 std::vector<DirectedEdge*>::iterator begin(); 00078 00080 std::vector<DirectedEdge*>::iterator end(); 00081 00083 std::vector<DirectedEdge*>::const_iterator begin() const; 00084 00086 std::vector<DirectedEdge*>::const_iterator end() const; 00087 00092 size_t getDegree() const { return outEdges.size(); } 00093 00098 geom::Coordinate& getCoordinate() const; 00099 00104 std::vector<DirectedEdge*>& getEdges(); 00105 00111 int getIndex(const Edge *edge); 00112 00118 int getIndex(const DirectedEdge *dirEdge); 00119 00124 int getIndex(int i) const; 00125 00131 DirectedEdge* getNextEdge(DirectedEdge *dirEdge); 00132 }; 00133 00134 00135 } // namespace geos::planargraph 00136 } // namespace geos 00137 00138 #endif // GEOS_PLANARGRAPH_DIRECTEDEDGESTAR_H 00139 00140 /********************************************************************** 00141 * $Log$ 00142 * Revision 1.2 2006/06/12 10:49:43 strk 00143 * unsigned int => size_t 00144 * 00145 * Revision 1.1 2006/03/21 21:42:54 strk 00146 * planargraph.h header split, planargraph:: classes renamed to match JTS symbols 00147 * 00148 **********************************************************************/ 00149