/src/gdal/apps/gdalalg_raster_pipeline.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: gdal "raster pipeline" subcommand |
5 | | * Author: Even Rouault <even dot rouault at spatialys.com> |
6 | | * |
7 | | ****************************************************************************** |
8 | | * Copyright (c) 2024, Even Rouault <even dot rouault at spatialys.com> |
9 | | * |
10 | | * SPDX-License-Identifier: MIT |
11 | | ****************************************************************************/ |
12 | | |
13 | | #ifndef GDALALG_RASTER_PIPELINE_INCLUDED |
14 | | #define GDALALG_RASTER_PIPELINE_INCLUDED |
15 | | |
16 | | #include "gdalalgorithm.h" |
17 | | #include "gdalalg_abstract_pipeline.h" |
18 | | #include "gdalrasterpipelinestepalgorithm.h" |
19 | | |
20 | | //! @cond Doxygen_Suppress |
21 | | |
22 | | /************************************************************************/ |
23 | | /* GDALRasterAlgorithmStepRegistry */ |
24 | | /************************************************************************/ |
25 | | |
26 | | class GDALRasterAlgorithmStepRegistry : public virtual GDALAlgorithmRegistry |
27 | | { |
28 | | public: |
29 | 0 | GDALRasterAlgorithmStepRegistry() = default; Unexecuted instantiation: GDALRasterAlgorithmStepRegistry::GDALRasterAlgorithmStepRegistry() Unexecuted instantiation: GDALRasterAlgorithmStepRegistry::GDALRasterAlgorithmStepRegistry() |
30 | | ~GDALRasterAlgorithmStepRegistry() override; |
31 | | |
32 | | /** Register the algorithm of type MyAlgorithm. |
33 | | */ |
34 | | template <class MyAlgorithm> |
35 | | bool Register(const std::string &name = std::string()) |
36 | 0 | { |
37 | 0 | static_assert( |
38 | 0 | std::is_base_of_v<GDALRasterPipelineStepAlgorithm, MyAlgorithm>, |
39 | 0 | "Algorithm is not a GDALRasterPipelineStepAlgorithm"); |
40 | |
|
41 | 0 | AlgInfo info; |
42 | 0 | info.m_name = name.empty() ? MyAlgorithm::NAME : name; |
43 | 0 | info.m_aliases = MyAlgorithm::GetAliasesStatic(); |
44 | 0 | info.m_creationFunc = []() -> std::unique_ptr<GDALAlgorithm> |
45 | 0 | { return std::make_unique<MyAlgorithm>(); };Unexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterReadAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterCalcAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterCreateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterNeighborsAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterWriteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterInfoAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterAspectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterBlendAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterCleanCollarAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterClipAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterColorMapAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterCompareAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterEditAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterNoDataToAlphaAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterFillNodataAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterHillshadeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALMaterializeRasterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterMosaicAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterOverviewAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterPansharpenAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterProximityAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterReclassifyAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterReprojectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterResizeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterRGBToPaletteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterRoughnessAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterScaleAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterSelectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterSetTypeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterSieveAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterSlopeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterStackAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterTileAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterTPIAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterTRIAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterUnscaleAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterUpdateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALRasterViewshedAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALTeeRasterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() constUnexecuted instantiation: GDALRasterAlgorithmStepRegistry::Register<GDALExternalRasterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)::{lambda()#1}::operator()() const |
46 | 0 | return GDALAlgorithmRegistry::Register(info); |
47 | 0 | } Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterReadAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterCalcAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterCreateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterNeighborsAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterWriteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterInfoAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterAspectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterBlendAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterCleanCollarAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterClipAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterColorMapAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterCompareAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterEditAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterNoDataToAlphaAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterFillNodataAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterHillshadeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALMaterializeRasterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterMosaicAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterOverviewAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterPansharpenAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterProximityAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterReclassifyAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterReprojectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterResizeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterRGBToPaletteAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterRoughnessAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterScaleAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterSelectAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterSetTypeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterSieveAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterSlopeAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterStackAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterTileAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterTPIAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterTRIAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterUnscaleAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterUpdateAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALRasterViewshedAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALTeeRasterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) Unexecuted instantiation: bool GDALRasterAlgorithmStepRegistry::Register<GDALExternalRasterAlgorithm>(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) |
48 | | }; |
49 | | |
50 | | /************************************************************************/ |
51 | | /* GDALRasterPipelineAlgorithm */ |
52 | | /************************************************************************/ |
53 | | |
54 | | class GDALRasterPipelineAlgorithm final : public GDALAbstractPipelineAlgorithm |
55 | | { |
56 | | public: |
57 | | static constexpr const char *NAME = "pipeline"; |
58 | | static constexpr const char *DESCRIPTION = |
59 | | "Process a raster dataset applying several steps."; |
60 | | static constexpr const char *HELP_URL = |
61 | | "/programs/gdal_raster_pipeline.html"; |
62 | | |
63 | | static std::vector<std::string> GetAliasesStatic() |
64 | 0 | { |
65 | 0 | return { |
66 | 0 | #ifdef GDAL_PIPELINE_PROJ_NOSTALGIA |
67 | 0 | GDALAlgorithmRegistry::HIDDEN_ALIAS_SEPARATOR, |
68 | 0 | "+pipeline", |
69 | 0 | "+gdal=pipeline", |
70 | 0 | #endif |
71 | 0 | }; |
72 | 0 | } |
73 | | |
74 | | explicit GDALRasterPipelineAlgorithm(bool openForMixedRasterVector = false); |
75 | | |
76 | | std::string GetUsageForCLI(bool shortUsage, |
77 | | const UsageOptions &usageOptions) const override; |
78 | | |
79 | | static void RegisterAlgorithms(GDALRasterAlgorithmStepRegistry ®istry, |
80 | | bool forMixedPipeline); |
81 | | |
82 | | int GetInputType() const override |
83 | 0 | { |
84 | 0 | return GDAL_OF_RASTER; |
85 | 0 | } |
86 | | |
87 | | int GetOutputType() const override |
88 | 0 | { |
89 | 0 | return GDAL_OF_RASTER; |
90 | 0 | } |
91 | | |
92 | | protected: |
93 | | GDALRasterAlgorithmStepRegistry m_stepRegistry{}; |
94 | | |
95 | | GDALAlgorithmRegistry &GetStepRegistry() override |
96 | 0 | { |
97 | 0 | return m_stepRegistry; |
98 | 0 | } |
99 | | |
100 | | const GDALAlgorithmRegistry &GetStepRegistry() const override |
101 | 0 | { |
102 | 0 | return m_stepRegistry; |
103 | 0 | } |
104 | | |
105 | | private: |
106 | | std::unique_ptr<GDALAbstractPipelineAlgorithm> |
107 | | CreateNestedPipeline() const override |
108 | 0 | { |
109 | 0 | auto pipeline = std::make_unique<GDALRasterPipelineAlgorithm>(); |
110 | 0 | pipeline->m_bInnerPipeline = true; |
111 | 0 | return pipeline; |
112 | 0 | } |
113 | | }; |
114 | | |
115 | | //! @endcond |
116 | | |
117 | | #endif |