Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: gdal "vector concat" subcommand 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_CONCAT_INCLUDED 14 : #define GDALALG_VECTOR_CONCAT_INCLUDED 15 : 16 : #include "gdalvectorpipelinestepalgorithm.h" 17 : 18 : #include "ogrsf_frmts.h" 19 : 20 : //! @cond Doxygen_Suppress 21 : 22 : /************************************************************************/ 23 : /* GDALVectorConcatAlgorithm */ 24 : /************************************************************************/ 25 : 26 152 : class GDALVectorConcatAlgorithm /* non final */ 27 : : public GDALVectorPipelineStepAlgorithm 28 : { 29 : public: 30 : static constexpr const char *NAME = "concat"; 31 : static constexpr const char *DESCRIPTION = "Concatenate vector datasets."; 32 : static constexpr const char *HELP_URL = "/programs/gdal_vector_concat.html"; 33 : 34 : explicit GDALVectorConcatAlgorithm(bool bStandalone = false); 35 : ~GDALVectorConcatAlgorithm() override; 36 : 37 30 : bool CanBeFirstStep() const override 38 : { 39 30 : return true; 40 : } 41 : 42 : private: 43 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 44 : bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override; 45 : 46 : std::string m_layerNameTemplate{}; 47 : std::string m_sourceLayerFieldName{}; 48 : std::string m_sourceLayerFieldContent{}; 49 : std::string m_mode = "merge-per-layer-name"; 50 : std::string m_fieldStrategy = "union"; 51 : std::string m_srsCrs{}; 52 : std::string m_dstCrs{}; 53 : }; 54 : 55 : /************************************************************************/ 56 : /* GDALVectorConcatAlgorithmStandalone */ 57 : /************************************************************************/ 58 : 59 144 : class GDALVectorConcatAlgorithmStandalone final 60 : : public GDALVectorConcatAlgorithm 61 : { 62 : public: 63 72 : GDALVectorConcatAlgorithmStandalone() 64 72 : : GDALVectorConcatAlgorithm(/* standaloneStep = */ true) 65 : { 66 72 : } 67 : 68 : ~GDALVectorConcatAlgorithmStandalone() override; 69 : }; 70 : 71 : //! @endcond 72 : 73 : #endif