LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_update.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 12 12 100.0 %
Date: 2025-12-01 18:11:08 Functions: 7 7 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "raster update" subcommand
       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_UPDATE_INCLUDED
      14             : #define GDALALG_RASTER_UPDATE_INCLUDED
      15             : 
      16             : #include "gdalalg_raster_pipeline.h"
      17             : 
      18             : #include "gdalalg_clip_common.h"
      19             : 
      20             : #include <limits>
      21             : 
      22             : //! @cond Doxygen_Suppress
      23             : 
      24             : /************************************************************************/
      25             : /*                     GDALRasterUpdateAlgorithm                        */
      26             : /************************************************************************/
      27             : 
      28             : class GDALRasterUpdateAlgorithm /* non final */
      29             :     : public GDALRasterPipelineStepAlgorithm,
      30             :       public GDALClipCommon
      31             : {
      32             :   public:
      33             :     static constexpr const char *NAME = "update";
      34             :     static constexpr const char *DESCRIPTION =
      35             :         "Update the destination raster with the content of the input one.";
      36             :     static constexpr const char *HELP_URL = "/programs/gdal_raster_update.html";
      37             : 
      38             :     explicit GDALRasterUpdateAlgorithm(bool standaloneStep = false);
      39             : 
      40           5 :     bool CanBeLastStep() const override
      41             :     {
      42           5 :         return true;
      43             :     }
      44             : 
      45           9 :     bool CanBeMiddleStep() const override
      46             :     {
      47           9 :         return true;
      48             :     }
      49             : 
      50           4 :     bool IsNativelyStreamingCompatible() const override
      51             :     {
      52           4 :         return false;
      53             :     }
      54             : 
      55           1 :     bool OutputDatasetAllowedBeforeRunningStep() const override
      56             :     {
      57           1 :         return true;
      58             :     }
      59             : 
      60             :   private:
      61             :     bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
      62             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      63             : 
      64             :     std::string m_resampling{};
      65             :     std::vector<std::string> m_warpOptions{};
      66             :     std::vector<std::string> m_transformOptions{};
      67             :     double m_errorThreshold = std::numeric_limits<double>::quiet_NaN();
      68             :     bool m_noUpdateOverviews = false;
      69             : };
      70             : 
      71             : /************************************************************************/
      72             : /*                 GDALRasterUpdateAlgorithmStandalone                  */
      73             : /************************************************************************/
      74             : 
      75          36 : class GDALRasterUpdateAlgorithmStandalone final
      76             :     : public GDALRasterUpdateAlgorithm
      77             : {
      78             :   public:
      79          18 :     GDALRasterUpdateAlgorithmStandalone()
      80          18 :         : GDALRasterUpdateAlgorithm(/* standaloneStep = */ true)
      81             :     {
      82          18 :     }
      83             : 
      84             :     ~GDALRasterUpdateAlgorithmStandalone() override;
      85             : };
      86             : 
      87             : //! @endcond
      88             : 
      89             : #endif

Generated by: LCOV version 1.14