Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "clip" step of "raster pipeline", or "gdal raster clip" standalone 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_CLIP_INCLUDED 14 : #define GDALALG_RASTER_CLIP_INCLUDED 15 : 16 : #include "gdalalg_raster_pipeline.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALRasterClipAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALRasterClipAlgorithm /* non final */ 25 : : public GDALRasterPipelineStepAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "clip"; 29 : static constexpr const char *DESCRIPTION = "Clip a raster dataset."; 30 : static constexpr const char *HELP_URL = "/programs/gdal_raster_clip.html"; 31 : 32 228 : static std::vector<std::string> GetAliases() 33 : { 34 228 : return {}; 35 : } 36 : 37 : explicit GDALRasterClipAlgorithm(bool standaloneStep = false); 38 : 39 : private: 40 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 41 : 42 : std::vector<double> m_bbox{}; 43 : std::string m_bboxCrs{}; 44 : GDALArgDatasetValue m_likeDataset{}; 45 : }; 46 : 47 : /************************************************************************/ 48 : /* GDALRasterClipAlgorithmStandalone */ 49 : /************************************************************************/ 50 : 51 : class GDALRasterClipAlgorithmStandalone final : public GDALRasterClipAlgorithm 52 : { 53 : public: 54 2 : GDALRasterClipAlgorithmStandalone() 55 2 : : GDALRasterClipAlgorithm(/* standaloneStep = */ true) 56 : { 57 2 : } 58 : }; 59 : 60 : //! @endcond 61 : 62 : #endif /* GDALALG_RASTER_CLIP_INCLUDED */