Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "edit" 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_EDIT_INCLUDED 14 : #define GDALALG_RASTER_EDIT_INCLUDED 15 : 16 : #include "gdalalg_raster_pipeline.h" 17 : 18 : namespace gdal 19 : { 20 : class GCP; 21 : } 22 : 23 : //! @cond Doxygen_Suppress 24 : 25 : /************************************************************************/ 26 : /* GDALRasterEditAlgorithm */ 27 : /************************************************************************/ 28 : 29 97 : class GDALRasterEditAlgorithm /* non final */ 30 : : public GDALRasterPipelineStepAlgorithm 31 : { 32 : public: 33 : static constexpr const char *NAME = "edit"; 34 : static constexpr const char *DESCRIPTION = "Edit a raster dataset."; 35 : static constexpr const char *HELP_URL = "/programs/gdal_raster_edit.html"; 36 : 37 : explicit GDALRasterEditAlgorithm(bool standaloneStep = false); 38 : ~GDALRasterEditAlgorithm() override; 39 : 40 : private: 41 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 42 : std::vector<gdal::GCP> ParseGCPs() const; 43 : 44 : GDALArgDatasetValue m_dataset{}; // standalone mode only 45 : bool m_readOnly = false; // standalone mode only 46 : std::string m_overrideCrs{}; 47 : std::vector<double> m_bbox{}; 48 : std::vector<std::string> m_metadata{}; 49 : std::vector<std::string> m_unsetMetadata{}; 50 : std::string m_nodata{}; 51 : std::vector<std::string> m_gcps{}; 52 : bool m_stats = false; // standalone mode only 53 : bool m_approxStats = false; // standalone mode only 54 : bool m_hist = false; // standalone mode only 55 : }; 56 : 57 : /************************************************************************/ 58 : /* GDALRasterEditAlgorithmStandalone */ 59 : /************************************************************************/ 60 : 61 62 : class GDALRasterEditAlgorithmStandalone final : public GDALRasterEditAlgorithm 62 : { 63 : public: 64 31 : GDALRasterEditAlgorithmStandalone() 65 31 : : GDALRasterEditAlgorithm(/* standaloneStep = */ true) 66 : { 67 31 : } 68 : 69 : ~GDALRasterEditAlgorithmStandalone() override; 70 : }; 71 : 72 : //! @endcond 73 : 74 : #endif /* GDALALG_RASTER_EDIT_INCLUDED */