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