GEOS  3.9.1
HotPixelIndex.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
7  *
8  * This is free software; you can redistribute and/or modify it under
9  * the terms of the GNU Lesser General Public Licence as published
10  * by the Free Software Foundation.
11  * See the COPYING file for more information.
12  *
13  **********************************************************************/
14 
15 #pragma once
16 
17 #include <geos/export.h>
18 #include <geos/geom/Envelope.h> // for unique_ptr
19 #include <geos/geom/Coordinate.h> // for composition
20 #include <geos/algorithm/LineIntersector.h>
21 #include <geos/noding/snapround/HotPixel.h>
22 #include <geos/geom/PrecisionModel.h>
23 #include <geos/util/IllegalArgumentException.h>
24 #include <geos/io/WKTWriter.h>
25 #include <geos/index/kdtree/KdTree.h>
26 #include <geos/index/kdtree/KdNodeVisitor.h>
27 
28 #include <array>
29 #include <map>
30 #include <memory>
31 
32 
33 #ifdef _MSC_VER
34 #pragma warning(push)
35 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
36 #endif
37 
38 // Forward declarations
39 namespace geos {
40 namespace algorithm {
41 class LineIntersector;
42 }
43 namespace index {
44 class ItemVisitor;
45 }
46 namespace noding {
47 namespace snapround {
48 class HotPixel;
49 }
50 }
51 }
52 
53 
54 namespace geos {
55 namespace noding { // geos::noding
56 namespace snapround { // geos::noding::snapround
57 
58 
59 class GEOS_DLL HotPixelIndex {
60 
61 private:
62 
63  /* members */
64  const geom::PrecisionModel* pm;
65  double scaleFactor;
66  std::unique_ptr<geos::index::kdtree::KdTree> index;
67  std::deque<HotPixel> hotPixelQue;
68 
69  /* methods */
70  geom::Coordinate round(const geom::Coordinate& c);
71  HotPixel* find(const geom::Coordinate& pixelPt);
72 
73 public:
74 
75  HotPixelIndex(const geom::PrecisionModel* p_pm);
76  HotPixel* add(const geom::Coordinate& pt);
77  void add(const geom::CoordinateSequence* pts);
78  void add(const std::vector<geom::Coordinate>& pts);
79  void addNodes(const geom::CoordinateSequence* pts);
80  void addNodes(const std::vector<geom::Coordinate>& pts);
81 
87  void query(const geom::Coordinate& p0, const geom::Coordinate& p1,
88  index::kdtree::KdNodeVisitor& visitor);
89 
90 };
91 
92 } // namespace geos::noding::snapround
93 } // namespace geos::noding
94 } // namespace geos
95 
96 #ifdef _MSC_VER
97 #pragma warning(pop)
98 #endif
99 
100 
double round(double val)
Definition: math.h:36
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26