/src/gdal/apps/gdalalg_raster_nodata_to_alpha.h
Line | Count | Source |
1 | | /****************************************************************************** |
2 | | * |
3 | | * Project: GDAL |
4 | | * Purpose: "nodata-to-alpha" step of "raster pipeline" |
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_RASTER_NODATA_TO_ALPHA_INCLUDED |
14 | | #define GDALALG_RASTER_NODATA_TO_ALPHA_INCLUDED |
15 | | |
16 | | #include "gdalalg_raster_pipeline.h" |
17 | | |
18 | | //! @cond Doxygen_Suppress |
19 | | |
20 | | /************************************************************************/ |
21 | | /* GDALRasterNoDataToAlphaAlgorithm */ |
22 | | /************************************************************************/ |
23 | | |
24 | | class GDALRasterNoDataToAlphaAlgorithm /* non final */ |
25 | | : public GDALRasterPipelineStepAlgorithm |
26 | | { |
27 | | public: |
28 | | static constexpr const char *NAME = "nodata-to-alpha"; |
29 | | static constexpr const char *DESCRIPTION = |
30 | | "Replace nodata value(s) with an alpha band."; |
31 | | static constexpr const char *HELP_URL = |
32 | | "/programs/gdal_raster_nodata_to_alpha.html"; |
33 | | |
34 | | explicit GDALRasterNoDataToAlphaAlgorithm(bool standaloneStep = false); |
35 | | |
36 | | private: |
37 | | bool RunStep(GDALPipelineStepRunContext &ctxt) override; |
38 | | |
39 | | std::vector<double> m_nodata{}; |
40 | | |
41 | | // Work variables |
42 | | std::unique_ptr<GDALDataset> m_tempDS{}; |
43 | | }; |
44 | | |
45 | | /************************************************************************/ |
46 | | /* GDALRasterNoDataToAlphaAlgorithmStandalone */ |
47 | | /************************************************************************/ |
48 | | |
49 | | class GDALRasterNoDataToAlphaAlgorithmStandalone final |
50 | | : public GDALRasterNoDataToAlphaAlgorithm |
51 | | { |
52 | | public: |
53 | | GDALRasterNoDataToAlphaAlgorithmStandalone() |
54 | 0 | : GDALRasterNoDataToAlphaAlgorithm(/* standaloneStep = */ true) |
55 | 0 | { |
56 | 0 | } |
57 | | |
58 | | ~GDALRasterNoDataToAlphaAlgorithmStandalone() override; |
59 | | }; |
60 | | |
61 | | //! @endcond |
62 | | |
63 | | #endif /* GDALALG_RASTER_NODATA_TO_ALPHA_INCLUDED */ |