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 "gdalalg_vector_pipeline.h" 17 : 18 : #include "ogrsf_frmts.h" 19 : 20 : //! @cond Doxygen_Suppress 21 : 22 : /************************************************************************/ 23 : /* GDALVectorConcatAlgorithm */ 24 : /************************************************************************/ 25 : 26 : 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 : 36 : private: 37 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 38 : bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override; 39 : 40 : std::string m_layerNameTemplate{}; 41 : std::string m_sourceLayerFieldName{}; 42 : std::string m_sourceLayerFieldContent{}; 43 : std::string m_mode = "merge-per-layer-name"; 44 : std::string m_fieldStrategy = "union"; 45 : std::string m_srsCrs{}; 46 : std::string m_dstCrs{}; 47 : 48 : std::vector<std::unique_ptr<OGRLayer>> m_tempLayersKeeper{}; 49 : }; 50 : 51 : /************************************************************************/ 52 : /* GDALVectorConcatAlgorithmStandalone */ 53 : /************************************************************************/ 54 : 55 : class GDALVectorConcatAlgorithmStandalone final 56 : : public GDALVectorConcatAlgorithm 57 : { 58 : public: 59 27 : GDALVectorConcatAlgorithmStandalone() 60 27 : : GDALVectorConcatAlgorithm(/* standaloneStep = */ true) 61 : { 62 27 : } 63 : }; 64 : 65 : //! @endcond 66 : 67 : #endif