LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_scale.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 5 5 100.0 %
Date: 2025-03-28 11:40:40 Functions: 2 2 100.0 %

          Line data    Source code
       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             : 
      20             : //! @cond Doxygen_Suppress
      21             : 
      22             : /************************************************************************/
      23             : /*                    GDALRasterScaleAlgorithm                          */
      24             : /************************************************************************/
      25             : 
      26             : class 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         378 :     static std::vector<std::string> GetAliases()
      36             :     {
      37         378 :         return {};
      38             :     }
      39             : 
      40             :     explicit GDALRasterScaleAlgorithm(bool standaloneStep = false);
      41             : 
      42             :   private:
      43             :     bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override;
      44             : 
      45             :     std::string m_type{};
      46             :     int m_band = 0;
      47             :     double m_srcMin = std::numeric_limits<double>::quiet_NaN();
      48             :     double m_srcMax = std::numeric_limits<double>::quiet_NaN();
      49             :     double m_dstMin = std::numeric_limits<double>::quiet_NaN();
      50             :     double m_dstMax = std::numeric_limits<double>::quiet_NaN();
      51             :     double m_exponent = std::numeric_limits<double>::quiet_NaN();
      52             :     bool m_noClip = false;
      53             : };
      54             : 
      55             : /************************************************************************/
      56             : /*                 GDALRasterScaleAlgorithmStandalone                   */
      57             : /************************************************************************/
      58             : 
      59             : class GDALRasterScaleAlgorithmStandalone final : public GDALRasterScaleAlgorithm
      60             : {
      61             :   public:
      62          23 :     GDALRasterScaleAlgorithmStandalone()
      63          23 :         : GDALRasterScaleAlgorithm(/* standaloneStep = */ true)
      64             :     {
      65          23 :     }
      66             : };
      67             : 
      68             : //! @endcond
      69             : 
      70             : #endif /* GDALALG_RASTER_SCALE_INCLUDED */

Generated by: LCOV version 1.14