LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_calc.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 6 6 100.0 %
Date: 2025-07-06 19:57:03 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "calc" step of "raster pipeline"
       5             :  * Author:   Daniel Baston
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2025, ISciences LLC
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_RASTER_CALC_INCLUDED
      14             : #define GDALALG_RASTER_CALC_INCLUDED
      15             : 
      16             : #include "gdalalg_raster_pipeline.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                       GDALRasterCalcAlgorithm                        */
      22             : /************************************************************************/
      23             : 
      24             : class GDALRasterCalcAlgorithm : public GDALRasterPipelineStepAlgorithm
      25             : {
      26             :   public:
      27             :     explicit GDALRasterCalcAlgorithm(bool standaloneStep = false) noexcept;
      28             : 
      29             :     static constexpr const char *NAME = "calc";
      30             :     static constexpr const char *DESCRIPTION = "Perform raster algebra";
      31             :     static constexpr const char *HELP_URL = "/programs/gdal_raster_calc.html";
      32             : 
      33          12 :     bool CanBeFirstStep() const override
      34             :     {
      35          12 :         return true;
      36             :     }
      37             : 
      38             :   private:
      39             :     bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
      40             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      41             : 
      42             :     std::vector<std::string> m_expr{};
      43             :     std::string m_dialect{"muparser"};
      44             :     bool m_flatten{false};
      45             :     std::string m_type{};
      46             :     std::string m_nodata{};
      47             :     bool m_noCheckSRS{false};
      48             :     bool m_noCheckExtent{false};
      49             :     bool m_noCheckExpression{false};
      50             :     bool m_propagateNoData{false};
      51             : };
      52             : 
      53             : /************************************************************************/
      54             : /*                   GDALRasterCalcAlgorithmStandalone                  */
      55             : /************************************************************************/
      56             : 
      57         170 : class GDALRasterCalcAlgorithmStandalone final : public GDALRasterCalcAlgorithm
      58             : {
      59             :   public:
      60          85 :     GDALRasterCalcAlgorithmStandalone()
      61          85 :         : GDALRasterCalcAlgorithm(/* standaloneStep = */ true)
      62             :     {
      63          85 :     }
      64             : 
      65             :     ~GDALRasterCalcAlgorithmStandalone() override;
      66             : };
      67             : 
      68             : //! @endcond
      69             : 
      70             : #endif /* GDALALG_RASTER_CALC_INCLUDED */

Generated by: LCOV version 1.14