GEOS 3.3.1
|
00001 /********************************************************************** 00002 * $Id: EdgeList.h 2958 2010-03-29 11:29:40Z 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/EdgeList.java rev. 1.4 (JTS-1.10) 00018 * 00019 **********************************************************************/ 00020 00021 00022 #ifndef GEOS_GEOMGRAPH_EDGELIST_H 00023 #define GEOS_GEOMGRAPH_EDGELIST_H 00024 00025 #include <geos/export.h> 00026 #include <vector> 00027 #include <map> 00028 #include <string> 00029 #include <iostream> 00030 00031 #include <geos/noding/OrientedCoordinateArray.h> // for map comparator 00032 00033 #include <geos/inline.h> 00034 00035 #ifdef _MSC_VER 00036 #pragma warning(push) 00037 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class 00038 #endif 00039 00040 // Forward declarations 00041 namespace geos { 00042 namespace index { 00043 class SpatialIndex; 00044 } 00045 namespace geomgraph { 00046 class Edge; 00047 } 00048 } 00049 00050 namespace geos { 00051 namespace geomgraph { // geos.geomgraph 00052 00059 class GEOS_DLL EdgeList { 00060 00061 private: 00062 00063 std::vector<Edge*> edges; 00064 00065 struct OcaCmp { 00066 bool operator()( 00067 const noding::OrientedCoordinateArray *oca1, 00068 const noding::OrientedCoordinateArray *oca2) const 00069 { 00070 return oca1->compareTo(*oca2)<0; 00071 } 00072 }; 00073 00082 typedef std::map<noding::OrientedCoordinateArray*, Edge*, OcaCmp> EdgeMap; 00083 EdgeMap ocaMap; 00084 00085 public: 00086 friend std::ostream& operator<< (std::ostream& os, const EdgeList& el); 00087 00088 EdgeList() 00089 : 00090 edges(), 00091 ocaMap() 00092 {} 00093 00094 virtual ~EdgeList(); 00095 00099 void add(Edge *e); 00100 00101 void addAll(const std::vector<Edge*> &edgeColl); 00102 00103 std::vector<Edge*> &getEdges() { return edges; } 00104 00105 Edge* findEqualEdge(Edge* e); 00106 00107 Edge* get(int i); 00108 00109 int findEdgeIndex(Edge *e); 00110 00111 std::string print(); 00112 00113 void clearList(); 00114 00115 }; 00116 00117 std::ostream& operator<< (std::ostream& os, const EdgeList& el); 00118 00119 00120 } // namespace geos.geomgraph 00121 } // namespace geos 00122 00123 //#ifdef GEOS_INLINE 00124 //# include "geos/geomgraph/EdgeList.inl" 00125 //#endif 00126 00127 #ifdef _MSC_VER 00128 #pragma warning(pop) 00129 #endif 00130 00131 #endif // ifndef GEOS_GEOMGRAPH_EDGELIST_H 00132 00133 /********************************************************************** 00134 * $Log$ 00135 * Revision 1.3 2006/03/24 09:52:41 strk 00136 * USE_INLINE => GEOS_INLINE 00137 * 00138 * Revision 1.2 2006/03/14 11:03:15 strk 00139 * Added operator<< for Edge and EdgeList 00140 * 00141 * Revision 1.1 2006/03/09 16:46:49 strk 00142 * geos::geom namespace definition, first pass at headers split 00143 * 00144 **********************************************************************/ 00145