Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "gdal vector combine" 5 : * Author: Daniel Baston 6 : * 7 : ****************************************************************************** 8 : * Copyright (c) 2025-2026, ISciences LLC 9 : * 10 : * SPDX-License-Identifier: MIT 11 : ****************************************************************************/ 12 : 13 : #ifndef GDALALG_VECTOR_COMBINE_INCLUDED 14 : #define GDALALG_VECTOR_COMBINE_INCLUDED 15 : 16 : #include "gdalalg_vector_pipeline.h" 17 : #include "cpl_progress.h" 18 : 19 : #include <string> 20 : 21 : //! @cond Doxygen_Suppress 22 : 23 : /************************************************************************/ 24 : /* GDALVectorCombineAlgorithm */ 25 : /************************************************************************/ 26 : 27 : class GDALVectorCombineAlgorithm : public GDALVectorPipelineStepAlgorithm 28 : { 29 : public: 30 : static constexpr const char *NAME = "combine"; 31 : static constexpr const char *DESCRIPTION = 32 : "Combine features into collections"; 33 : static constexpr const char *HELP_URL = 34 : "/programs/gdal_vector_combine.html"; 35 : 36 : explicit GDALVectorCombineAlgorithm(bool standaloneStep = false); 37 : 38 : static constexpr const char *NO = "no"; 39 : static constexpr const char *SOMETIMES_IDENTICAL = "sometimes-identical"; 40 : static constexpr const char *ALWAYS_IDENTICAL = "always-identical"; 41 : 42 : private: 43 : bool RunStep(GDALPipelineStepRunContext &ctxt) override; 44 : 45 : std::vector<std::string> m_groupBy{}; 46 : bool m_keepNested{false}; 47 : std::string m_addExtraFields{NO}; 48 : }; 49 : 50 : /************************************************************************/ 51 : /* GDALVectorCombineAlgorithmStandalone */ 52 : /************************************************************************/ 53 : 54 128 : class GDALVectorCombineAlgorithmStandalone final 55 : : public GDALVectorCombineAlgorithm 56 : { 57 : public: 58 64 : GDALVectorCombineAlgorithmStandalone() 59 64 : : GDALVectorCombineAlgorithm(/* standaloneStep = */ true) 60 : { 61 64 : } 62 : 63 : ~GDALVectorCombineAlgorithmStandalone() override; 64 : }; 65 : 66 : //! @endcond 67 : 68 : #endif /* GDALALG_VECTOR_COMBINE_INCLUDED */