• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

EdgeList.h

00001 /**********************************************************************
00002  * $Id: EdgeList.h 2557 2009-06-08 09:30:55Z strk $
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 // Forward declarations
00036 namespace geos {
00037         namespace index {
00038                 class SpatialIndex;
00039         }
00040         namespace geomgraph {
00041                 class Edge;
00042         }
00043 }
00044 
00045 namespace geos {
00046 namespace geomgraph { // geos.geomgraph
00047 
00054 class GEOS_DLL EdgeList {
00055 
00056 private:
00057 
00058         std::vector<Edge*> edges;
00059 
00060         struct OcaCmp {
00061                 bool operator()(
00062                         const noding::OrientedCoordinateArray *oca1,
00063                         const noding::OrientedCoordinateArray *oca2) const
00064                 {
00065                         return oca1->compareTo(*oca2)<0;
00066                 }
00067         };
00068 
00077         typedef std::map<noding::OrientedCoordinateArray*, Edge*, OcaCmp> EdgeMap;
00078         EdgeMap ocaMap;
00079 
00080 public:
00081         friend std::ostream& operator<< (std::ostream& os, const EdgeList& el);
00082 
00083         EdgeList()
00084                 :
00085                 edges(),
00086                 ocaMap()
00087         {}
00088 
00089         virtual ~EdgeList();
00090 
00094         void add(Edge *e);
00095 
00096         void addAll(const std::vector<Edge*> &edgeColl);
00097 
00098         std::vector<Edge*> &getEdges() { return edges; }
00099 
00100         Edge* findEqualEdge(Edge* e);
00101 
00102         Edge* get(int i);
00103 
00104         int findEdgeIndex(Edge *e);
00105 
00106         std::string print();
00107 
00108         void clearList();
00109 
00110 };
00111 
00112 std::ostream& operator<< (std::ostream& os, const EdgeList& el);
00113 
00114 
00115 } // namespace geos.geomgraph
00116 } // namespace geos
00117 
00118 //#ifdef GEOS_INLINE
00119 //# include "geos/geomgraph/EdgeList.inl"
00120 //#endif
00121 
00122 #endif // ifndef GEOS_GEOMGRAPH_EDGELIST_H
00123 
00124 /**********************************************************************
00125  * $Log$
00126  * Revision 1.3  2006/03/24 09:52:41  strk
00127  * USE_INLINE => GEOS_INLINE
00128  *
00129  * Revision 1.2  2006/03/14 11:03:15  strk
00130  * Added operator<< for Edge and EdgeList
00131  *
00132  * Revision 1.1  2006/03/09 16:46:49  strk
00133  * geos::geom namespace definition, first pass at headers split
00134  *
00135  **********************************************************************/
00136 

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1