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_hillshade.h
Line
Count
Source
1
/******************************************************************************
2
 *
3
 * Project:  GDAL
4
 * Purpose:  "hillshade" step of "raster pipeline"
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_HILLSHADE_INCLUDED
14
#define GDALALG_RASTER_HILLSHADE_INCLUDED
15
16
#include "gdalalg_raster_pipeline.h"
17
18
#include <limits>
19
20
//! @cond Doxygen_Suppress
21
22
/************************************************************************/
23
/*                     GDALRasterHillshadeAlgorithm                     */
24
/************************************************************************/
25
26
class GDALRasterHillshadeAlgorithm /* non final */
27
    : public GDALRasterPipelineStepAlgorithm
28
{
29
  public:
30
    static constexpr const char *NAME = "hillshade";
31
    static constexpr const char *DESCRIPTION = "Generate a shaded relief map";
32
    static constexpr const char *HELP_URL =
33
        "/programs/gdal_raster_hillshade.html";
34
35
    explicit GDALRasterHillshadeAlgorithm(bool standaloneStep = false);
36
37
    bool CanHandleNextStep(GDALPipelineStepAlgorithm *) const override;
38
39
  private:
40
    bool RunStep(GDALPipelineStepRunContext &ctxt) override;
41
42
    int m_band = 1;
43
    double m_zfactor = 1;
44
    double m_xscale = std::numeric_limits<double>::quiet_NaN();
45
    double m_yscale = std::numeric_limits<double>::quiet_NaN();
46
    double m_azimuth = 315;
47
    double m_altitude = 45;
48
    std::string m_gradientAlg = "Horn";
49
    std::string m_variant = "regular";
50
    bool m_noEdges = false;
51
};
52
53
/************************************************************************/
54
/*                GDALRasterHillshadeAlgorithmStandalone                */
55
/************************************************************************/
56
57
class GDALRasterHillshadeAlgorithmStandalone final
58
    : public GDALRasterHillshadeAlgorithm
59
{
60
  public:
61
    GDALRasterHillshadeAlgorithmStandalone()
62
0
        : GDALRasterHillshadeAlgorithm(/* standaloneStep = */ true)
63
0
    {
64
0
    }
65
66
    ~GDALRasterHillshadeAlgorithmStandalone() override;
67
};
68
69
//! @endcond
70
71
#endif /* GDALALG_RASTER_HILLSHADE_INCLUDED */