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 314 : static std::vector<std::string> GetAliases() 33 : { 34 314 : return {}; 35 : } 36 : 37 : explicit GDALVectorClipAlgorithm(bool standaloneStep = false); 38 : 39 : private: 40 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 41 : 42 : std::string m_activeLayer{}; 43 : std::vector<double> m_bbox{}; 44 : std::string m_bboxCrs{}; 45 : std::string m_geometry{}; 46 : std::string m_geometryCrs{}; 47 : GDALArgDatasetValue m_likeDataset{}; 48 : std::string m_likeLayer{}; 49 : std::string m_likeSQL{}; 50 : std::string m_likeWhere{}; 51 : }; 52 : 53 : /************************************************************************/ 54 : /* GDALVectorClipAlgorithmStandalone */ 55 : /************************************************************************/ 56 : 57 : class GDALVectorClipAlgorithmStandalone final : public GDALVectorClipAlgorithm 58 : { 59 : public: 60 34 : GDALVectorClipAlgorithmStandalone() 61 34 : : GDALVectorClipAlgorithm(/* standaloneStep = */ true) 62 : { 63 34 : } 64 : }; 65 : 66 : //! @endcond 67 : 68 : #endif /* GDALALG_VECTOR_CLIP_INCLUDED */