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 "gdalrasterpipelinestepalgorithm.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 20 : bool CanBeFirstStep() const override 39 : { 40 20 : 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 : std::vector<std::string> m_size_str{}; 49 : std::vector<std::string> m_resolution_str{}; 50 : std::vector<double> m_resolution{}; 51 : int m_bandCount = 1; 52 : std::string m_type = "Byte"; 53 : std::string m_crs{}; 54 : std::vector<double> m_bbox{}; 55 : std::vector<std::string> m_metadata{}; 56 : std::string m_nodata{}; 57 : std::vector<double> m_burnValues{}; 58 : bool m_copyOverviews = false; 59 : bool m_copyMetadata = false; 60 : }; 61 : 62 : /************************************************************************/ 63 : /* GDALRasterCreateAlgorithmStandalone */ 64 : /************************************************************************/ 65 : 66 308 : class GDALRasterCreateAlgorithmStandalone final 67 : : public GDALRasterCreateAlgorithm 68 : { 69 : public: 70 154 : GDALRasterCreateAlgorithmStandalone() 71 154 : : GDALRasterCreateAlgorithm(/* standaloneStep = */ true) 72 : { 73 154 : } 74 : 75 : ~GDALRasterCreateAlgorithmStandalone() override; 76 : }; 77 : 78 : //! @endcond 79 : 80 : #endif