/src/gdal/apps/gdalalg_vector_concat.h
Line | Count | Source |
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 | | #include "ogrlayerpool.h" |
20 | | |
21 | | //! @cond Doxygen_Suppress |
22 | | |
23 | | /************************************************************************/ |
24 | | /* GDALVectorConcatAlgorithm */ |
25 | | /************************************************************************/ |
26 | | |
27 | | class GDALVectorConcatAlgorithm /* non final */ |
28 | | : public GDALVectorPipelineStepAlgorithm |
29 | | { |
30 | | public: |
31 | | static constexpr const char *NAME = "concat"; |
32 | | static constexpr const char *DESCRIPTION = "Concatenate vector datasets."; |
33 | | static constexpr const char *HELP_URL = "/programs/gdal_vector_concat.html"; |
34 | | |
35 | | explicit GDALVectorConcatAlgorithm(bool bStandalone = false); |
36 | | ~GDALVectorConcatAlgorithm() override; |
37 | | |
38 | | bool CanBeFirstStep() const override |
39 | 0 | { |
40 | 0 | return true; |
41 | 0 | } |
42 | | |
43 | | private: |
44 | | bool RunStep(GDALPipelineStepRunContext &ctxt) override; |
45 | | bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override; |
46 | | |
47 | | std::string m_layerNameTemplate{}; |
48 | | std::string m_sourceLayerFieldName{}; |
49 | | std::string m_sourceLayerFieldContent{}; |
50 | | std::string m_mode = "merge-per-layer-name"; |
51 | | std::string m_fieldStrategy = "union"; |
52 | | std::string m_srsCrs{}; |
53 | | std::string m_dstCrs{}; |
54 | | |
55 | | std::unique_ptr<OGRLayerPool> m_poLayerPool{}; |
56 | | std::vector<std::unique_ptr<OGRLayer>> m_tempLayersKeeper{}; |
57 | | }; |
58 | | |
59 | | /************************************************************************/ |
60 | | /* GDALVectorConcatAlgorithmStandalone */ |
61 | | /************************************************************************/ |
62 | | |
63 | | class GDALVectorConcatAlgorithmStandalone final |
64 | | : public GDALVectorConcatAlgorithm |
65 | | { |
66 | | public: |
67 | | GDALVectorConcatAlgorithmStandalone() |
68 | 0 | : GDALVectorConcatAlgorithm(/* standaloneStep = */ true) |
69 | 0 | { |
70 | 0 | } |
71 | | |
72 | | ~GDALVectorConcatAlgorithmStandalone() override; |
73 | | }; |
74 | | |
75 | | //! @endcond |
76 | | |
77 | | #endif |