GDAL
gdalalg_raster_scale.h
1/******************************************************************************
2 *
3 * Project: GDAL
4 * Purpose: "scale" 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_SCALE_INCLUDED
14#define GDALALG_RASTER_SCALE_INCLUDED
15
16#include <limits>
17
18#include "gdalalg_raster_pipeline.h"
19
21
22/************************************************************************/
23/* GDALRasterScaleAlgorithm */
24/************************************************************************/
25
26class GDALRasterScaleAlgorithm /* non final */
27 : public GDALRasterPipelineStepAlgorithm
28{
29 public:
30 static constexpr const char *NAME = "scale";
31 static constexpr const char *DESCRIPTION =
32 "Scale the values of the bands of a raster dataset.";
33 static constexpr const char *HELP_URL = "/programs/gdal_raster_scale.html";
34
35 explicit GDALRasterScaleAlgorithm(bool standaloneStep = false);
36
37 private:
38 bool RunStep(GDALPipelineStepRunContext &ctxt) override;
39
40 std::string m_type{};
41 int m_band = 0;
42 double m_srcMin = std::numeric_limits<double>::quiet_NaN();
43 double m_srcMax = std::numeric_limits<double>::quiet_NaN();
44 double m_dstMin = std::numeric_limits<double>::quiet_NaN();
45 double m_dstMax = std::numeric_limits<double>::quiet_NaN();
46 double m_exponent = std::numeric_limits<double>::quiet_NaN();
47 bool m_noClip = false;
48};
49
50/************************************************************************/
51/* GDALRasterScaleAlgorithmStandalone */
52/************************************************************************/
53
54class GDALRasterScaleAlgorithmStandalone final : public GDALRasterScaleAlgorithm
55{
56 public:
57 GDALRasterScaleAlgorithmStandalone()
58 : GDALRasterScaleAlgorithm(/* standaloneStep = */ true)
59 {
60 }
61
62 ~GDALRasterScaleAlgorithmStandalone() override;
63};
64
66
67#endif /* GDALALG_RASTER_SCALE_INCLUDED */