GEOS  3.8.0dev
LineSegmentIndex.h
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 #ifndef GEOS_SIMPLIFY_LINESEGMENTINDEX_H
24 #define GEOS_SIMPLIFY_LINESEGMENTINDEX_H
25 
26 #include <geos/export.h>
27 #include <geos/geom/Envelope.h>
28 #include <geos/index/quadtree/Quadtree.h>
29 #include <vector>
30 #include <memory> // for unique_ptr
31 
32 #ifdef _MSC_VER
33 #pragma warning(push)
34 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
35 #endif
36 
37 // Forward declarations
38 namespace geos {
39 namespace geom {
40 class LineSegment;
41 }
42 namespace simplify {
43 class TaggedLineString;
44 }
45 }
46 
47 namespace geos {
48 namespace simplify { // geos::simplify
49 
50 class GEOS_DLL LineSegmentIndex {
51 
52 public:
53 
54  LineSegmentIndex() = default;
55 
56  ~LineSegmentIndex() = default;
57 
58  void add(const TaggedLineString& line);
59 
60  void add(const geom::LineSegment* seg);
61 
62  void remove(const geom::LineSegment* seg);
63 
64  std::unique_ptr< std::vector<geom::LineSegment*> >
65  query(const geom::LineSegment* seg);
66 
67 
68 private:
69 
70  index::quadtree::Quadtree index;
71 
72  std::vector<std::unique_ptr<geom::Envelope>> newEnvelopes;
73 
78  LineSegmentIndex(const LineSegmentIndex&) = delete;
79  LineSegmentIndex& operator=(const LineSegmentIndex&) = delete;
80 };
81 
82 } // namespace geos::simplify
83 } // namespace geos
84 
85 #ifdef _MSC_VER
86 #pragma warning(pop)
87 #endif
88 
89 #endif // GEOS_SIMPLIFY_LINESEGMENTINDEX_H
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25