LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_color_map.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 3 3 100.0 %
Date: 2025-04-16 00:42:22 Functions: 1 1 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "color-map" 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_COLOR_MAP_INCLUDED
      14             : #define GDALALG_RASTER_COLOR_MAP_INCLUDED
      15             : 
      16             : #include "gdalalg_raster_pipeline.h"
      17             : 
      18             : #include <limits>
      19             : 
      20             : //! @cond Doxygen_Suppress
      21             : 
      22             : /************************************************************************/
      23             : /*                       GDALRasterColorMapAlgorithm                    */
      24             : /************************************************************************/
      25             : 
      26             : class GDALRasterColorMapAlgorithm /* non final */
      27             :     : public GDALRasterPipelineStepAlgorithm
      28             : {
      29             :   public:
      30             :     static constexpr const char *NAME = "color-map";
      31             :     static constexpr const char *DESCRIPTION =
      32             :         "Generate a RGB or RGBA dataset from a single band, using a color "
      33             :         "map";
      34             :     static constexpr const char *HELP_URL =
      35             :         "/programs/gdal_raster_color_map.html";
      36             : 
      37             :     explicit GDALRasterColorMapAlgorithm(bool standaloneStep = false);
      38             : 
      39             :   private:
      40             :     bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override;
      41             : 
      42             :     int m_band = 1;
      43             :     std::string m_colorMap{};
      44             :     bool m_addAlpha = false;
      45             :     std::string m_colorSelection = "interpolate";
      46             : };
      47             : 
      48             : /************************************************************************/
      49             : /*                  GDALRasterColorMapAlgorithmStandalone               */
      50             : /************************************************************************/
      51             : 
      52             : class GDALRasterColorMapAlgorithmStandalone final
      53             :     : public GDALRasterColorMapAlgorithm
      54             : {
      55             :   public:
      56          20 :     GDALRasterColorMapAlgorithmStandalone()
      57          20 :         : GDALRasterColorMapAlgorithm(/* standaloneStep = */ true)
      58             :     {
      59          20 :     }
      60             : };
      61             : 
      62             : //! @endcond
      63             : 
      64             : #endif /* GDALALG_RASTER_COLOR_MAP_INCLUDED */

Generated by: LCOV version 1.14