GEOS  3.8.0dev
EdgeList.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: geomgraph/EdgeList.java rev. 1.4 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 
21 #ifndef GEOS_GEOMGRAPH_EDGELIST_H
22 #define GEOS_GEOMGRAPH_EDGELIST_H
23 
24 #include <geos/export.h>
25 #include <vector>
26 #include <map>
27 #include <string>
28 #include <iostream>
29 
30 #include <geos/noding/OrientedCoordinateArray.h> // for map comparator
31 
32 #include <geos/inline.h>
33 
34 #ifdef _MSC_VER
35 #pragma warning(push)
36 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
37 #endif
38 
39 // Forward declarations
40 namespace geos {
41 namespace index {
42 class SpatialIndex;
43 }
44 namespace geomgraph {
45 class Edge;
46 }
47 }
48 
49 namespace geos {
50 namespace geomgraph { // geos.geomgraph
51 
58 class GEOS_DLL EdgeList {
59 
60 private:
61 
62  std::vector<Edge*> edges;
63 
64  struct OcaCmp {
65  bool
66  operator()(
68  const noding::OrientedCoordinateArray* oca2) const
69  {
70  return *oca1 < *oca2;
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*>&
104  getEdges()
105  {
106  return edges;
107  }
108 
109  Edge* findEqualEdge(Edge* e);
110 
111  Edge* get(int i);
112 
113  int findEdgeIndex(Edge* e);
114 
115  std::string print();
116 
117  void clearList();
118 
119 };
120 
121 std::ostream& operator<< (std::ostream& os, const EdgeList& el);
122 
123 
124 } // namespace geos.geomgraph
125 } // namespace geos
126 
127 //#ifdef GEOS_INLINE
128 //# include "geos/geomgraph/EdgeList.inl"
129 //#endif
130 
131 #ifdef _MSC_VER
132 #pragma warning(pop)
133 #endif
134 
135 #endif // ifndef GEOS_GEOMGRAPH_EDGELIST_H
Definition: EdgeList.h:58
Allows comparing geom::CoordinateSequences in an orientation-independent way.
Definition: OrientedCoordinateArray.h:46
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
Definition: geomgraph/Edge.h:66