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 : #include "gdalalg_clip_common.h" 19 : 20 : //! @cond Doxygen_Suppress 21 : 22 : /************************************************************************/ 23 : /* GDALRasterClipAlgorithm */ 24 : /************************************************************************/ 25 : 26 : class GDALRasterClipAlgorithm /* non final */ 27 : : public GDALRasterPipelineStepAlgorithm, 28 : public GDALClipCommon 29 : { 30 : public: 31 : static constexpr const char *NAME = "clip"; 32 : static constexpr const char *DESCRIPTION = "Clip a raster dataset."; 33 : static constexpr const char *HELP_URL = "/programs/gdal_raster_clip.html"; 34 : 35 : explicit GDALRasterClipAlgorithm(bool standaloneStep = false); 36 : 37 : private: 38 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 39 : 40 : bool m_onlyBBOX{false}; 41 : bool m_allowExtentOutsideSource{false}; 42 : bool m_addAlpha{false}; 43 : }; 44 : 45 : /************************************************************************/ 46 : /* GDALRasterClipAlgorithmStandalone */ 47 : /************************************************************************/ 48 : 49 : class GDALRasterClipAlgorithmStandalone final : public GDALRasterClipAlgorithm 50 : { 51 : public: 52 23 : GDALRasterClipAlgorithmStandalone() 53 23 : : GDALRasterClipAlgorithm(/* standaloneStep = */ true) 54 : { 55 23 : } 56 : }; 57 : 58 : //! @endcond 59 : 60 : #endif /* GDALALG_RASTER_CLIP_INCLUDED */