• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

OSGeo / gdal / 12706066811

10 Jan 2025 08:38AM UTC coverage: 70.084% (-2.5%) from 72.549%
12706066811

Pull #11629

github

web-flow
Merge 9418dc48f into 0df468c56
Pull Request #11629: add uv documentation for python package

563296 of 803749 relevant lines covered (70.08%)

223434.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.5
/alg/viewshed/combiner.cpp
1
/******************************************************************************
2
 * (c) 2024 info@hobu.co
3
 *
4
 * SPDX-License-Identifier: MIT
5
 ****************************************************************************/
6

7
#include "combiner.h"
8
#include "util.h"
9

10
namespace gdal
11
{
12
namespace viewshed
13
{
14

15
/// Read viewshed executor output and sum it up in our owned memory raster.
16
void Combiner::run()
3✔
17
{
18
    DatasetPtr pTempDataset;
6✔
19

20
    while (m_inputQueue.pop(pTempDataset))
591✔
21
    {
22
        if (!m_dataset)
588✔
23
            m_dataset = std::move(pTempDataset);
3✔
24
        else
25
            sum(std::move(pTempDataset));
585✔
26
    }
27
    // Queue remaining summed rasters.
28
    queueOutputBuffer();
3✔
29
}
3✔
30

31
/// Add the values of the source dataset to those of the owned dataset.
32
/// @param src  Source dataset.
33
void Combiner::sum(DatasetPtr src)
585✔
34
{
35
    if (!m_dataset)
585✔
36
    {
37
        m_dataset = std::move(src);
×
38
        return;
×
39
    }
40
    size_t size = bandSize(*m_dataset->GetRasterBand(1));
585✔
41

42
    uint8_t *dstP =
43
        static_cast<uint8_t *>(m_dataset->GetInternalHandle("MEMORY1"));
585✔
44
    uint8_t *srcP = static_cast<uint8_t *>(src->GetInternalHandle("MEMORY1"));
585✔
45
    for (size_t i = 0; i < size; ++i)
8,423,280✔
46
        *dstP++ += *srcP++;
8,422,690✔
47
    // If we've seen 255 inputs, queue our raster for output and rollup since we might overflow
48
    // otherwise.
49
    if (++m_count == 255)
585✔
50
        queueOutputBuffer();
×
51
}
52

53
/// Queue the owned buffer as for output.
54
void Combiner::queueOutputBuffer()
3✔
55
{
56
    if (m_dataset)
3✔
57
        m_outputQueue.push(std::move(m_dataset));
3✔
58
    m_count = 0;
3✔
59
}
3✔
60

61
}  // namespace viewshed
62
}  // namespace gdal
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc