LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_reproject.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 4 4 100.0 %
Date: 2025-06-19 12:30:01 Functions: 3 3 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  "reproject" step of "raster pipeline"
       5             :  * Author:   Even Rouault <even dot rouault at spatialys.com>
       6             :  *
       7             :  ******************************************************************************
       8             :  * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com>
       9             :  *
      10             :  * SPDX-License-Identifier: MIT
      11             :  ****************************************************************************/
      12             : 
      13             : #ifndef GDALALG_RASTER_REPROJECT_INCLUDED
      14             : #define GDALALG_RASTER_REPROJECT_INCLUDED
      15             : 
      16             : #include "gdalalg_raster_pipeline.h"
      17             : 
      18             : #include <limits>
      19             : 
      20             : //! @cond Doxygen_Suppress
      21             : 
      22             : /************************************************************************/
      23             : /*                    GDALRasterReprojectAlgorithm                      */
      24             : /************************************************************************/
      25             : 
      26             : class GDALRasterReprojectAlgorithm /* non final */
      27             :     : public GDALRasterPipelineStepAlgorithm
      28             : {
      29             :   public:
      30             :     static constexpr const char *NAME = "reproject";
      31             :     static constexpr const char *DESCRIPTION = "Reproject a raster dataset.";
      32             :     static constexpr const char *HELP_URL =
      33             :         "/programs/gdal_raster_reproject.html";
      34             : 
      35             :     explicit GDALRasterReprojectAlgorithm(bool standaloneStep = false);
      36             : 
      37             :     bool CanHandleNextStep(GDALPipelineStepAlgorithm *) const override;
      38             : 
      39             :   private:
      40             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      41             : 
      42             :     std::string m_srsCrs{};
      43             :     std::string m_dstCrs{};
      44             :     std::string m_resampling{};
      45             :     std::vector<double> m_resolution{};
      46             :     std::vector<double> m_bbox{};
      47             :     std::string m_bboxCrs{};
      48             :     std::vector<int> m_size{};
      49             :     bool m_targetAlignedPixels = false;
      50             :     std::vector<std::string> m_srcNoData{};
      51             :     std::vector<std::string> m_dstNoData{};
      52             :     bool m_addAlpha = false;
      53             :     std::vector<std::string> m_warpOptions{};
      54             :     std::vector<std::string> m_transformOptions{};
      55             :     double m_errorThreshold = std::numeric_limits<double>::quiet_NaN();
      56             :     int m_numThreads = 0;
      57             : 
      58             :     // Work variables
      59             :     std::string m_numThreadsStr{"ALL_CPUS"};
      60             : };
      61             : 
      62             : /************************************************************************/
      63             : /*                 GDALRasterReprojectAlgorithmStandalone               */
      64             : /************************************************************************/
      65             : 
      66          58 : class GDALRasterReprojectAlgorithmStandalone final
      67             :     : public GDALRasterReprojectAlgorithm
      68             : {
      69             :   public:
      70          29 :     GDALRasterReprojectAlgorithmStandalone()
      71          29 :         : GDALRasterReprojectAlgorithm(/* standaloneStep = */ true)
      72             :     {
      73          29 :     }
      74             : 
      75             :     ~GDALRasterReprojectAlgorithmStandalone() override;
      76             : };
      77             : 
      78             : /************************************************************************/
      79             : /*                     GDALRasterReprojectUtils                         */
      80             : /************************************************************************/
      81             : 
      82             : class GDALRasterReprojectUtils final
      83             : {
      84             :   public:
      85             :     static void AddResamplingArg(GDALAlgorithm *alg, std::string &resampling);
      86             : 
      87             :     static void AddWarpOptTransformOptErrorThresholdArg(
      88             :         GDALAlgorithm *alg, std::vector<std::string> &warpOptions,
      89             :         std::vector<std::string> &transformOptions, double &errorThreshold);
      90             : };
      91             : 
      92             : //! @endcond
      93             : 
      94             : #endif /* GDALALG_RASTER_REPROJECT_INCLUDED */

Generated by: LCOV version 1.14