GEOS 3.9.1
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 <unordered_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
40namespace geos {
41namespace index {
42class SpatialIndex;
43}
44namespace geomgraph {
45class Edge;
46}
47}
48
49namespace geos {
50namespace geomgraph { // geos.geomgraph
51
58class GEOS_DLL EdgeList {
59
60private:
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
77 typedef std::unordered_map<noding::OrientedCoordinateArray,
78 Edge*,
79 noding::OrientedCoordinateArray::HashCode> EdgeMap;
80 EdgeMap ocaMap;
81
82public:
83 friend std::ostream& operator<< (std::ostream& os, const EdgeList& el);
84
85 EdgeList()
86 :
87 edges(),
88 ocaMap()
89 {}
90
91 virtual ~EdgeList() = default;
92
96 void add(Edge* e);
97
98 void addAll(const std::vector<Edge*>& edgeColl);
99
100 std::vector<Edge*>&
101 getEdges()
102 {
103 return edges;
104 }
105
106 Edge* findEqualEdge(const Edge* e) const;
107
108 Edge* get(int i);
109
110 int findEdgeIndex(const Edge* e) const;
111
112 std::string print();
113
114 void clearList();
115
116};
117
118std::ostream& operator<< (std::ostream& os, const EdgeList& el);
119
120
121} // namespace geos.geomgraph
122} // namespace geos
123
124//#ifdef GEOS_INLINE
125//# include "geos/geomgraph/EdgeList.inl"
126//#endif
127
128#ifdef _MSC_VER
129#pragma warning(pop)
130#endif
131
132#endif // ifndef GEOS_GEOMGRAPH_EDGELIST_H
A EdgeList is a list of Edges.
Definition: EdgeList.h:58
Definition: geomgraph/Edge.h:66
Allows comparing geom::CoordinateSequences in an orientation-independent way.
Definition: OrientedCoordinateArray.h:43
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26