/src/geos/include/geos/simplify/LineSegmentIndex.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2006 Refractions Research Inc. |
7 | | * |
8 | | * This is free software; you can redistribute and/or modify it under |
9 | | * the terms of the GNU Lesser General Licence as published |
10 | | * by the Free Software Foundation. |
11 | | * See the COPYING file for more information. |
12 | | * |
13 | | ********************************************************************** |
14 | | * |
15 | | * Last port: simplify/LineSegmentIndex.java rev. 1.1 (JTS-1.7.1) |
16 | | * |
17 | | ********************************************************************** |
18 | | * |
19 | | * NOTES |
20 | | * |
21 | | **********************************************************************/ |
22 | | |
23 | | #pragma once |
24 | | |
25 | | #include <geos/export.h> |
26 | | #include <geos/geom/Envelope.h> |
27 | | #include <geos/index/quadtree/Quadtree.h> |
28 | | #include <vector> |
29 | | #include <memory> // for unique_ptr |
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 geom { |
39 | | class LineSegment; |
40 | | } |
41 | | namespace simplify { |
42 | | class TaggedLineString; |
43 | | } |
44 | | } |
45 | | |
46 | | namespace geos { |
47 | | namespace simplify { // geos::simplify |
48 | | |
49 | | class GEOS_DLL LineSegmentIndex { |
50 | | |
51 | | public: |
52 | | |
53 | 0 | LineSegmentIndex() = default; |
54 | | |
55 | 0 | ~LineSegmentIndex() = default; |
56 | | |
57 | | void add(const TaggedLineString& line); |
58 | | |
59 | | void add(const geom::LineSegment* seg); |
60 | | |
61 | | void remove(const geom::LineSegment* seg); |
62 | | |
63 | | std::vector<const geom::LineSegment*> |
64 | | query(const geom::LineSegment* seg); |
65 | | |
66 | | |
67 | | private: |
68 | | |
69 | | index::quadtree::Quadtree index; |
70 | | |
71 | | std::vector<std::unique_ptr<geom::Envelope>> newEnvelopes; |
72 | | |
73 | | /** |
74 | | * Disable copy construction and assignment. Apparently needed to make this |
75 | | * class compile under MSVC. (See https://stackoverflow.com/q/29565299) |
76 | | */ |
77 | | LineSegmentIndex(const LineSegmentIndex&) = delete; |
78 | | LineSegmentIndex& operator=(const LineSegmentIndex&) = delete; |
79 | | }; |
80 | | |
81 | | } // namespace geos::simplify |
82 | | } // namespace geos |
83 | | |
84 | | #ifdef _MSC_VER |
85 | | #pragma warning(pop) |
86 | | #endif |
87 | | |