Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "clip" step of "vector pipeline", or "gdal vector 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_VECTOR_CLIP_INCLUDED 14 : #define GDALALG_VECTOR_CLIP_INCLUDED 15 : 16 : #include "gdalalg_vector_pipeline.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALVectorClipAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALVectorClipAlgorithm /* non final */ 25 : : public GDALVectorPipelineStepAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "clip"; 29 : static constexpr const char *DESCRIPTION = "Clip a vector dataset."; 30 : static constexpr const char *HELP_URL = "/programs/gdal_vector_clip.html"; 31 : 32 198 : static std::vector<std::string> GetAliases() 33 : { 34 198 : return {}; 35 : } 36 : 37 : explicit GDALVectorClipAlgorithm(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 : std::string m_geometry{}; 45 : std::string m_geometryCrs{}; 46 : GDALArgDatasetValue m_likeDataset{}; 47 : std::string m_likeLayer{}; 48 : std::string m_likeSQL{}; 49 : std::string m_likeWhere{}; 50 : }; 51 : 52 : /************************************************************************/ 53 : /* GDALVectorClipAlgorithmStandalone */ 54 : /************************************************************************/ 55 : 56 : class GDALVectorClipAlgorithmStandalone final : public GDALVectorClipAlgorithm 57 : { 58 : public: 59 33 : GDALVectorClipAlgorithmStandalone() 60 33 : : GDALVectorClipAlgorithm(/* standaloneStep = */ true) 61 : { 62 33 : } 63 : }; 64 : 65 : //! @endcond 66 : 67 : #endif /* GDALALG_VECTOR_CLIP_INCLUDED */