EdgeList.h

00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-2006 Refractions Research Inc.
00007  * Copyright (C) 2001-2002 Vivid Solutions 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  * Last port: geomgraph/EdgeList.java rev. 1.4 (JTS-1.10)
00017  *
00018  **********************************************************************/
00019 
00020 
00021 #ifndef GEOS_GEOMGRAPH_EDGELIST_H
00022 #define GEOS_GEOMGRAPH_EDGELIST_H
00023 
00024 #include <geos/export.h>
00025 #include <vector>
00026 #include <map>
00027 #include <string>
00028 #include <iostream>
00029 
00030 #include <geos/noding/OrientedCoordinateArray.h> // for map comparator
00031 
00032 #include <geos/inline.h>
00033 
00034 #ifdef _MSC_VER
00035 #pragma warning(push)
00036 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
00037 #endif
00038 
00039 // Forward declarations
00040 namespace geos {
00041         namespace index {
00042                 class SpatialIndex;
00043         }
00044         namespace geomgraph {
00045                 class Edge;
00046         }
00047 }
00048 
00049 namespace geos {
00050 namespace geomgraph { // geos.geomgraph
00051 
00058 class GEOS_DLL EdgeList {
00059 
00060 private:
00061 
00062         std::vector<Edge*> edges;
00063 
00064         struct OcaCmp {
00065                 bool operator()(
00066                         const noding::OrientedCoordinateArray *oca1,
00067                         const noding::OrientedCoordinateArray *oca2) const
00068                 {
00069                         return *oca1 < *oca2;
00070                 }
00071         };
00072 
00081         typedef std::map<noding::OrientedCoordinateArray*, Edge*, OcaCmp> EdgeMap;
00082         EdgeMap ocaMap;
00083 
00084 public:
00085         friend std::ostream& operator<< (std::ostream& os, const EdgeList& el);
00086 
00087         EdgeList()
00088                 :
00089                 edges(),
00090                 ocaMap()
00091         {}
00092 
00093         virtual ~EdgeList();
00094 
00098         void add(Edge *e);
00099 
00100         void addAll(const std::vector<Edge*> &edgeColl);
00101 
00102         std::vector<Edge*> &getEdges() { return edges; }
00103 
00104         Edge* findEqualEdge(Edge* e);
00105 
00106         Edge* get(int i);
00107 
00108         int findEdgeIndex(Edge *e);
00109 
00110         std::string print();
00111 
00112         void clearList();
00113 
00114 };
00115 
00116 std::ostream& operator<< (std::ostream& os, const EdgeList& el);
00117 
00118 
00119 } // namespace geos.geomgraph
00120 } // namespace geos
00121 
00122 //#ifdef GEOS_INLINE
00123 //# include "geos/geomgraph/EdgeList.inl"
00124 //#endif
00125 
00126 #ifdef _MSC_VER
00127 #pragma warning(pop)
00128 #endif
00129 
00130 #endif // ifndef GEOS_GEOMGRAPH_EDGELIST_H

Generated on 30 Dec 2015 for GEOS by  doxygen 1.4.7