GEOS  3.13.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 #pragma once
22 
23 #include <geos/export.h>
24 #include <vector>
25 #include <unordered_map>
26 #include <string>
27 #include <iostream>
28 
29 #include <geos/noding/OrientedCoordinateArray.h> // for map comparator
30 
31 #ifdef _MSC_VER
32 #pragma warning(push)
33 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
34 #endif
35 
36 // Forward declarations
37 namespace geos {
38 namespace index {
39 class SpatialIndex;
40 }
41 namespace geomgraph {
42 class Edge;
43 }
44 }
45 
46 namespace geos {
47 namespace geomgraph { // geos.geomgraph
48 
55 class GEOS_DLL EdgeList {
56 
57 private:
58 
59  std::vector<Edge*> edges;
60 
61  struct OcaCmp {
62  bool
63  operator()(
65  const noding::OrientedCoordinateArray* oca2) const
66  {
67  return *oca1 < *oca2;
68  }
69  };
70 
74  typedef std::unordered_map<noding::OrientedCoordinateArray,
75  Edge*,
76  noding::OrientedCoordinateArray::HashCode> EdgeMap;
77  EdgeMap ocaMap;
78 
79 public:
80  friend std::ostream& operator<< (std::ostream& os, const EdgeList& el);
81 
82  EdgeList()
83  :
84  edges(),
85  ocaMap()
86  {}
87 
88  virtual ~EdgeList() = default;
89 
93  void add(Edge* e);
94 
95  void addAll(const std::vector<Edge*>& edgeColl);
96 
97  std::vector<Edge*>&
98  getEdges()
99  {
100  return edges;
101  }
102 
103  Edge* findEqualEdge(const Edge* e) const;
104 
105  Edge* get(std::size_t i);
106 
107  int findEdgeIndex(const Edge* e) const;
108 
109  std::string print();
110 
111  void clearList();
112 
113 };
114 
115 std::ostream& operator<< (std::ostream& os, const EdgeList& el);
116 
117 
118 } // namespace geos.geomgraph
119 } // namespace geos
120 
121 #ifdef _MSC_VER
122 #pragma warning(pop)
123 #endif
124 
A EdgeList is a list of Edges.
Definition: EdgeList.h:55
Definition: geomgraph/Edge.h:63
Allows comparing geom::CoordinateSequences in an orientation-independent way.
Definition: OrientedCoordinateArray.h:42
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25