Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: Common code for gdalalg_raster_clip and gdalalg_vector_clip 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_CLIP_COMMON_INCLUDED 14 : #define GDALALG_CLIP_COMMON_INCLUDED 15 : 16 : #include "gdalalgorithm.h" 17 : 18 : #include "ogr_geometry.h" 19 : 20 : #include <utility> 21 : 22 : //! @cond Doxygen_Suppress 23 : 24 : /************************************************************************/ 25 : /* GDALClipCommon */ 26 : /************************************************************************/ 27 : 28 71 : class GDALClipCommon /* non final */ 29 : { 30 : public: 31 : virtual ~GDALClipCommon(); 32 : 33 : protected: 34 71 : GDALClipCommon() = default; 35 : 36 : std::vector<double> m_bbox{}; 37 : std::string m_bboxCrs{}; 38 : std::string m_geometry{}; 39 : std::string m_geometryCrs{}; 40 : GDALArgDatasetValue m_likeDataset{}; 41 : std::string m_likeLayer{}; 42 : std::string m_likeSQL{}; 43 : std::string m_likeWhere{}; 44 : 45 : std::pair<std::unique_ptr<OGRGeometry>, std::string> GetClipGeometry(); 46 : 47 : private: 48 : std::pair<std::unique_ptr<OGRGeometry>, std::string> LoadGeometry(); 49 : }; 50 : 51 : //! @endcond 52 : 53 : #endif