/src/gdal/alg/viewshed/combiner.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * (c) 2024 info@hobu.co |
3 | | * |
4 | | * SPDX-License-Identifier: MIT |
5 | | ****************************************************************************/ |
6 | | |
7 | | #ifndef VIEWSHED_COMBINER_H_INCLUDED |
8 | | #define VIEWSHED_COMBINER_H_INCLUDED |
9 | | |
10 | | #include "cumulative.h" |
11 | | #include "viewshed_types.h" |
12 | | |
13 | | namespace gdal |
14 | | { |
15 | | namespace viewshed |
16 | | { |
17 | | |
18 | | /// Reads completed viewshed rasters and sums them together. When the |
19 | | /// summed values may exceed the 8-bit limit, push it on the output |
20 | | /// queue. |
21 | | class Combiner |
22 | | { |
23 | | public: |
24 | | /// Constructor |
25 | | /// @param inputQueue Reference to input queue of datasets |
26 | | /// @param outputQueue Reference to output queue of datasets |
27 | | Combiner(Cumulative::DatasetQueue &inputQueue, |
28 | | Cumulative::DatasetQueue &outputQueue) |
29 | 0 | : m_inputQueue(inputQueue), m_outputQueue(outputQueue) |
30 | 0 | { |
31 | 0 | } |
32 | | |
33 | | /// Copy ctor. Allows initialization in a vector of Combiners. |
34 | | /// @param src Source Combiner. |
35 | | // cppcheck-suppress missingMemberCopy |
36 | | Combiner(const Combiner &src) |
37 | 0 | : m_inputQueue(src.m_inputQueue), m_outputQueue(src.m_outputQueue) |
38 | 0 | { |
39 | 0 | } |
40 | | |
41 | | void queueOutputBuffer(); |
42 | | void run(); |
43 | | |
44 | | private: |
45 | | Cumulative::DatasetQueue &m_inputQueue; |
46 | | Cumulative::DatasetQueue &m_outputQueue; |
47 | | DatasetPtr m_dataset{}; |
48 | | size_t m_count{0}; |
49 | | |
50 | | void sum(DatasetPtr srcDs); |
51 | | }; |
52 | | |
53 | | } // namespace viewshed |
54 | | } // namespace gdal |
55 | | |
56 | | #endif |