Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: gdal "raster convert" subcommand 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_CONVERT_INCLUDED 14 : #define GDALALG_RASTER_CONVERT_INCLUDED 15 : 16 : #include "gdalalgorithm.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALRasterConvertAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALRasterConvertAlgorithm final : public GDALAlgorithm 25 : { 26 : public: 27 : static constexpr const char *NAME = "convert"; 28 : static constexpr const char *DESCRIPTION = "Convert a raster dataset."; 29 : static constexpr const char *HELP_URL = 30 : "/programs/gdal_raster_convert.html"; 31 : 32 : explicit GDALRasterConvertAlgorithm(bool openForMixedRasterVector = false); 33 : 34 5 : GDALDataset *GetDatasetRef() 35 : { 36 5 : return m_inputDataset.GetDatasetRef(); 37 : } 38 : 39 1 : void SetDataset(GDALDataset *poDS) 40 : { 41 1 : auto arg = GetArg(GDAL_ARG_NAME_INPUT); 42 1 : arg->Set(poDS); 43 1 : arg->SetSkipIfAlreadySet(); 44 1 : } 45 : 46 : private: 47 : bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override; 48 : 49 : std::string m_outputFormat{}; 50 : GDALArgDatasetValue m_inputDataset{}; 51 : std::vector<std::string> m_openOptions{}; 52 : std::vector<std::string> m_inputFormats{}; 53 : GDALArgDatasetValue m_outputDataset{}; 54 : std::vector<std::string> m_creationOptions{}; 55 : bool m_overwrite = false; 56 : bool m_append = false; 57 : }; 58 : 59 : //! @endcond 60 : 61 : #endif