Coverage Report

Created: 2026-02-14 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/gdal/apps/gdalalg_raster_viewshed.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  gdal "raster viewshed" subcommand
5
 * Author:   Even Rouault <even dot rouault at spatialys.com>
6
 *
7
 ******************************************************************************
8
 * Copyright (c) 2025, Even Rouault <even dot rouault at spatialys.com>
9
 *
10
 * SPDX-License-Identifier: MIT
11
 ****************************************************************************/
12
13
#ifndef GDALALG_RASTER_VIEWSHED_INCLUDED
14
#define GDALALG_RASTER_VIEWSHED_INCLUDED
15
16
#include "gdalalg_raster_pipeline.h"
17
#include "viewshed/viewshed_types.h"
18
19
//! @cond Doxygen_Suppress
20
21
/************************************************************************/
22
/*                     GDALRasterViewshedAlgorithm                      */
23
/************************************************************************/
24
25
class GDALRasterViewshedAlgorithm /* non final */
26
    : public GDALRasterPipelineNonNativelyStreamingAlgorithm
27
{
28
  public:
29
    static constexpr const char *NAME = "viewshed";
30
    static constexpr const char *DESCRIPTION =
31
        "Compute the viewshed of a raster dataset.";
32
    static constexpr const char *HELP_URL =
33
        "/programs/gdal_raster_viewshed.html";
34
35
    explicit GDALRasterViewshedAlgorithm(bool standaloneStep = false);
36
37
  private:
38
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
39
40
    std::vector<double> m_observerPos{};
41
    gdal::viewshed::Options m_opts{};
42
43
    std::string m_outputMode = "normal";
44
    int m_band = 1;
45
    int m_numThreads = 3;
46
    GDALArgDatasetValue m_sdFilename{};
47
48
    // Work variables
49
    std::string m_numThreadsStr{};
50
};
51
52
/************************************************************************/
53
/*                GDALRasterViewshedAlgorithmStandalone                 */
54
/************************************************************************/
55
56
class GDALRasterViewshedAlgorithmStandalone final
57
    : public GDALRasterViewshedAlgorithm
58
{
59
  public:
60
    GDALRasterViewshedAlgorithmStandalone()
61
0
        : GDALRasterViewshedAlgorithm(/* standaloneStep = */ true)
62
0
    {
63
0
    }
64
65
    ~GDALRasterViewshedAlgorithmStandalone() override;
66
};
67
68
//! @endcond
69
70
#endif