LCOV - code coverage report
Current view: top level - apps - gdalalg_raster_create.h (source / functions) Hit Total Coverage
Test: gdal_filtered.info Lines: 8 8 100.0 %
Date: 2025-12-13 23:48:27 Functions: 5 5 100.0 %

          Line data    Source code
       1             : /******************************************************************************
       2             :  *
       3             :  * Project:  GDAL
       4             :  * Purpose:  gdal "raster create" 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_CREATE_INCLUDED
      14             : #define GDALALG_RASTER_CREATE_INCLUDED
      15             : 
      16             : #include "gdalalg_raster_pipeline.h"
      17             : 
      18             : //! @cond Doxygen_Suppress
      19             : 
      20             : /************************************************************************/
      21             : /*                     GDALRasterCreateAlgorithm                        */
      22             : /************************************************************************/
      23             : 
      24             : class GDALRasterCreateAlgorithm : public GDALRasterPipelineStepAlgorithm
      25             : {
      26             :   public:
      27             :     static constexpr const char *NAME = "create";
      28             :     static constexpr const char *DESCRIPTION = "Create a new raster dataset.";
      29             :     static constexpr const char *HELP_URL = "/programs/gdal_raster_create.html";
      30             : 
      31             :     explicit GDALRasterCreateAlgorithm(bool standaloneStep = false) noexcept;
      32             : 
      33           9 :     bool CanBeMiddleStep() const override
      34             :     {
      35           9 :         return true;
      36             :     }
      37             : 
      38          19 :     bool CanBeFirstStep() const override
      39             :     {
      40          19 :         return true;
      41             :     }
      42             : 
      43             :   private:
      44             :     bool RunStep(GDALPipelineStepRunContext &ctxt) override;
      45             :     bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override;
      46             : 
      47             :     std::vector<int> m_size{};
      48             :     int m_bandCount = 1;
      49             :     std::string m_type = "Byte";
      50             :     std::string m_crs{};
      51             :     std::vector<double> m_bbox{};
      52             :     std::vector<std::string> m_metadata{};
      53             :     std::string m_nodata{};
      54             :     std::vector<double> m_burnValues{};
      55             :     bool m_copyOverviews = false;
      56             :     bool m_copyMetadata = false;
      57             : };
      58             : 
      59             : /************************************************************************/
      60             : /*                  GDALRasterCreateAlgorithmStandalone                 */
      61             : /************************************************************************/
      62             : 
      63         108 : class GDALRasterCreateAlgorithmStandalone final
      64             :     : public GDALRasterCreateAlgorithm
      65             : {
      66             :   public:
      67          54 :     GDALRasterCreateAlgorithmStandalone()
      68          54 :         : GDALRasterCreateAlgorithm(/* standaloneStep = */ true)
      69             :     {
      70          54 :     }
      71             : 
      72             :     ~GDALRasterCreateAlgorithmStandalone() override;
      73             : };
      74             : 
      75             : //! @endcond
      76             : 
      77             : #endif

Generated by: LCOV version 1.14