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 307 : 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 : int m_band = 0; 47 : std::string m_overrideCrs{}; 48 : std::string m_colorMap{}; 49 : std::vector<double> m_bbox{}; 50 : std::vector<std::string> m_metadata{}; 51 : std::vector<std::string> m_unsetMetadata{}; 52 : std::vector<std::string> m_unsetMetadataDomain{}; 53 : std::vector<std::string> m_colorInterpretation{}; 54 : std::vector<std::string> m_scale{}; 55 : std::vector<std::string> m_offset{}; 56 : std::string m_nodata{}; 57 : std::vector<std::string> m_gcps{}; 58 : bool m_stats = false; // standalone mode only 59 : bool m_approxStats = false; // standalone mode only 60 : bool m_hist = false; // standalone mode only 61 : bool m_unsetColorTable = false; 62 : }; 63 : 64 : /************************************************************************/ 65 : /* GDALRasterEditAlgorithmStandalone */ 66 : /************************************************************************/ 67 : 68 254 : class GDALRasterEditAlgorithmStandalone final : public GDALRasterEditAlgorithm 69 : { 70 : public: 71 127 : GDALRasterEditAlgorithmStandalone() 72 127 : : GDALRasterEditAlgorithm(/* standaloneStep = */ true) 73 : { 74 127 : } 75 : 76 : ~GDALRasterEditAlgorithmStandalone() override; 77 : }; 78 : 79 : //! @endcond 80 : 81 : #endif /* GDALALG_RASTER_EDIT_INCLUDED */