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 232 : 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::vector<std::string> m_unsetMetadataDomain{}; 51 : std::string m_nodata{}; 52 : std::vector<std::string> m_gcps{}; 53 : bool m_stats = false; // standalone mode only 54 : bool m_approxStats = false; // standalone mode only 55 : bool m_hist = false; // standalone mode only 56 : }; 57 : 58 : /************************************************************************/ 59 : /* GDALRasterEditAlgorithmStandalone */ 60 : /************************************************************************/ 61 : 62 64 : class GDALRasterEditAlgorithmStandalone final : public GDALRasterEditAlgorithm 63 : { 64 : public: 65 32 : GDALRasterEditAlgorithmStandalone() 66 32 : : GDALRasterEditAlgorithm(/* standaloneStep = */ true) 67 : { 68 32 : } 69 : 70 : ~GDALRasterEditAlgorithmStandalone() override; 71 : }; 72 : 73 : //! @endcond 74 : 75 : #endif /* GDALALG_RASTER_EDIT_INCLUDED */