/src/gdal/apps/gdalalg_vector_layer_algebra.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: gdal "vector layer-algebra" 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_LAYER_ALGEBRA_INCLUDED |
14 | | #define GDALALG_VECTOR_LAYER_ALGEBRA_INCLUDED |
15 | | |
16 | | #include "gdalvectorpipelinestepalgorithm.h" |
17 | | |
18 | | #include <limits> |
19 | | |
20 | | //! @cond Doxygen_Suppress |
21 | | |
22 | | /************************************************************************/ |
23 | | /* GDALVectorLayerAlgebraAlgorithm */ |
24 | | /************************************************************************/ |
25 | | |
26 | | class GDALVectorLayerAlgebraAlgorithm /* non final */ |
27 | | : public GDALVectorPipelineStepAlgorithm |
28 | | { |
29 | | public: |
30 | | static constexpr const char *NAME = "layer-algebra"; |
31 | | static constexpr const char *DESCRIPTION = |
32 | | "Perform algebraic operation between 2 layers."; |
33 | | static constexpr const char *HELP_URL = |
34 | | "/programs/gdal_vector_layer_algebra.html"; |
35 | | |
36 | | explicit GDALVectorLayerAlgebraAlgorithm(bool standaloneStep = false); |
37 | | |
38 | | bool IsNativelyStreamingCompatible() const override |
39 | 0 | { |
40 | 0 | return false; |
41 | 0 | } |
42 | | |
43 | | bool |
44 | | CanHandleNextStep(GDALPipelineStepAlgorithm *poNextStep) const override; |
45 | | |
46 | | private: |
47 | | std::string m_operation{}; |
48 | | |
49 | | std::string m_inputLayerName{}; |
50 | | GDALArgDatasetValue m_methodDataset{}; |
51 | | std::string m_methodLayerName{}; |
52 | | |
53 | | // Output arguments |
54 | | std::string m_geometryType{}; |
55 | | |
56 | | std::string m_inputPrefix{}; |
57 | | std::vector<std::string> m_inputFields{}; |
58 | | bool m_noInputFields = false; |
59 | | bool m_allInputFields = false; |
60 | | |
61 | | std::string m_methodPrefix{}; |
62 | | std::vector<std::string> m_methodFields{}; |
63 | | bool m_noMethodFields = false; |
64 | | bool m_allMethodFields = false; |
65 | | |
66 | | bool RunStep(GDALPipelineStepRunContext &ctxt) override; |
67 | | bool RunImpl(GDALProgressFunc pfnProgress, void *pProgressData) override; |
68 | | }; |
69 | | |
70 | | /************************************************************************/ |
71 | | /* GDALVectorLayerAlgebraAlgorithmStandalone */ |
72 | | /************************************************************************/ |
73 | | |
74 | | class GDALVectorLayerAlgebraAlgorithmStandalone final |
75 | | : public GDALVectorLayerAlgebraAlgorithm |
76 | | { |
77 | | public: |
78 | | GDALVectorLayerAlgebraAlgorithmStandalone() |
79 | 0 | : GDALVectorLayerAlgebraAlgorithm(/* standaloneStep = */ true) |
80 | 0 | { |
81 | 0 | } |
82 | | |
83 | | ~GDALVectorLayerAlgebraAlgorithmStandalone() override; |
84 | | }; |
85 | | |
86 | | //! @endcond |
87 | | |
88 | | #endif |