GEOS  3.3.3
EdgeList.h
1 /**********************************************************************
2  * $Id: EdgeList.h 2958 2010-03-29 11:29:40Z mloskot $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: geomgraph/EdgeList.java rev. 1.4 (JTS-1.10)
18  *
19  **********************************************************************/
20 
21 
22 #ifndef GEOS_GEOMGRAPH_EDGELIST_H
23 #define GEOS_GEOMGRAPH_EDGELIST_H
24 
25 #include <geos/export.h>
26 #include <vector>
27 #include <map>
28 #include <string>
29 #include <iostream>
30 
31 #include <geos/noding/OrientedCoordinateArray.h> // for map comparator
32 
33 #include <geos/inline.h>
34 
35 #ifdef _MSC_VER
36 #pragma warning(push)
37 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
38 #endif
39 
40 // Forward declarations
41 namespace geos {
42  namespace index {
43  class SpatialIndex;
44  }
45  namespace geomgraph {
46  class Edge;
47  }
48 }
49 
50 namespace geos {
51 namespace geomgraph { // geos.geomgraph
52 
59 class GEOS_DLL EdgeList {
60 
61 private:
62 
63  std::vector<Edge*> edges;
64 
65  struct OcaCmp {
66  bool operator()(
68  const noding::OrientedCoordinateArray *oca2) const
69  {
70  return oca1->compareTo(*oca2)<0;
71  }
72  };
73 
82  typedef std::map<noding::OrientedCoordinateArray*, Edge*, OcaCmp> EdgeMap;
83  EdgeMap ocaMap;
84 
85 public:
86  friend std::ostream& operator<< (std::ostream& os, const EdgeList& el);
87 
88  EdgeList()
89  :
90  edges(),
91  ocaMap()
92  {}
93 
94  virtual ~EdgeList();
95 
99  void add(Edge *e);
100 
101  void addAll(const std::vector<Edge*> &edgeColl);
102 
103  std::vector<Edge*> &getEdges() { return edges; }
104 
105  Edge* findEqualEdge(Edge* e);
106 
107  Edge* get(int i);
108 
109  int findEdgeIndex(Edge *e);
110 
111  std::string print();
112 
113  void clearList();
114 
115 };
116 
117 std::ostream& operator<< (std::ostream& os, const EdgeList& el);
118 
119 
120 } // namespace geos.geomgraph
121 } // namespace geos
122 
123 //#ifdef GEOS_INLINE
124 //# include "geos/geomgraph/EdgeList.inl"
125 //#endif
126 
127 #ifdef _MSC_VER
128 #pragma warning(pop)
129 #endif
130 
131 #endif // ifndef GEOS_GEOMGRAPH_EDGELIST_H
132 
133 /**********************************************************************
134  * $Log$
135  * Revision 1.3 2006/03/24 09:52:41 strk
136  * USE_INLINE => GEOS_INLINE
137  *
138  * Revision 1.2 2006/03/14 11:03:15 strk
139  * Added operator<< for Edge and EdgeList
140  *
141  * Revision 1.1 2006/03/09 16:46:49 strk
142  * geos::geom namespace definition, first pass at headers split
143  *
144  **********************************************************************/
145