GDAL

gdalalg_raster_slope.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "slope" 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_SLOPE_INCLUDED
14#define GDALALG_RASTER_SLOPE_INCLUDED
15
16#include "gdalalg_raster_pipeline.h"
17
18#include <limits>
19
21
22/************************************************************************/
23/* GDALRasterSlopeAlgorithm */
24/************************************************************************/
25
26 class GDALRasterSlopeAlgorithm /* non final */
27 : public GDALRasterPipelineStepAlgorithm
28{
29 public:
30 static constexpr const char *NAME = "slope";
31 static constexpr const char *DESCRIPTION = "Generate a slope map";
32 static constexpr const char *HELP_URL = "/programs/gdal_raster_slope.html";
33
34 explicit GDALRasterSlopeAlgorithm(bool standaloneStep = false);
35
36 private:
37 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
38
39 int m_band = 1;
40 std::string m_unit = "degree";
41 double m_xscale = std::numeric_limits<double>::quiet_NaN();
42 double m_yscale = std::numeric_limits<double>::quiet_NaN();
43 std::string m_gradientAlg = "Horn";
44 bool m_noEdges = false;
45};
46
47/************************************************************************/
48/* GDALRasterSlopeAlgorithmStandalone */
49/************************************************************************/
50
51 class GDALRasterSlopeAlgorithmStandalone final : public GDALRasterSlopeAlgorithm
52{
53 public:
54 GDALRasterSlopeAlgorithmStandalone()
55 : GDALRasterSlopeAlgorithm(/* standaloneStep = */ true)
56 {
57 }
58
59 ~GDALRasterSlopeAlgorithmStandalone() override;
60};
61
63
64#endif /* GDALALG_RASTER_SLOPE_INCLUDED */