| 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Project: GDAL |
| 4 | * Purpose: "gdal raster fill-nodata" standalone command |
| 5 | * Author: Alessandro Pasotti <elpaso at itopen dot it> |
| 6 | * |
| 7 | ****************************************************************************** |
| 8 | * Copyright (c) 2025, Alessandro Pasotti <elpaso at itopen dot it> |
| 9 | * |
| 10 | * SPDX-License-Identifier: MIT |
| 11 | ****************************************************************************/ |
| 12 | |
| 13 | #ifndef GDALALG_RASTER_FILL_NODATA_INCLUDED |
| 14 | #define GDALALG_RASTER_FILL_NODATA_INCLUDEDcxx . . $ `apps/gdalalg_raster_fill_nodata.h:14:9`! |
| 15 | |
| 16 | #include "gdalalg_raster_pipeline.h"cxx . . $ `<file>/apps/gdalalg_raster_pipeline.h`/ |
| 17 | |
| 18 | //! @cond Doxygen_Suppress |
| 19 | |
| 20 | /************************************************************************/ |
| 21 | /* GDALRasterFillNodataAlgorithm */ |
| 22 | /************************************************************************/ |
| 23 | |
| 24 | class GDALRasterFillNodataAlgorithmcxx . . $ GDALRasterFillNodataAlgorithm# /* non final */ |
| 25 | : public GDALRasterPipelineNonNativelyStreamingAlgorithmcxx . . $ GDALRasterPipelineNonNativelyStreamingAlgorithm# |
| 26 | { |
| 27 | public: |
| 28 | static constexpr const char *NAMEcxx . . $ GDALRasterFillNodataAlgorithm#NAME. = "fill-nodata"; |
| 29 | static constexpr const char *DESCRIPTIONcxx . . $ GDALRasterFillNodataAlgorithm#DESCRIPTION. = |
| 30 | "Fill nodata raster regions by interpolation from edges."; |
| 31 | static constexpr const char *HELP_URLcxx . . $ GDALRasterFillNodataAlgorithm#HELP_URL. = |
| 32 | "/programs/gdal_raster_fill_nodata.html"; |
| 33 | |
| 34 | explicit GDALRasterFillNodataAlgorithmcxx . . $ GDALRasterFillNodataAlgorithm#GDALRasterFillNodataAlgorithm(9f0ba574c1c44ffc).( |
| 35 | bool standaloneStep = false) noexcept; |
| 36 | |
| 37 | private: |
| 38 | bool RunStepcxx . . $ GDALRasterFillNodataAlgorithm#RunStep(f551efd8892e175).(GDALPipelineStepRunContextcxx . . $ GDALPipelineStepRunContext# &ctxt) override; |
| 39 | |
| 40 | // The maximum distance (in pixels) that the algorithm will search out for values to interpolate. The default is 100 pixels. |
| 41 | int m_maxDistancecxx . . $ GDALRasterFillNodataAlgorithm#m_maxDistance. = 100; |
| 42 | // The number of 3x3 average filter smoothing iterations to run after the interpolation to dampen artifacts. The default is zero smoothing iterations. |
| 43 | int m_smoothingIterationscxx . . $ GDALRasterFillNodataAlgorithm#m_smoothingIterations. = 0; |
| 44 | // The band to operate on, by default the first band is operated on. |
| 45 | int m_bandcxx . . $ GDALRasterFillNodataAlgorithm#m_band. = 1; |
| 46 | // Use the first band of the specified file as a validity mask (zero is invalid, non-zero is valid). |
| 47 | GDALArgDatasetValuecxx . . $ GDALArgDatasetValue# m_maskDatasetcxx . . $ GDALRasterFillNodataAlgorithm#m_maskDataset.{cxx . . $ GDALArgDatasetValue#GDALArgDatasetValue(ced63f7c635d850d).}; |
| 48 | // By default, pixels are interpolated using an inverse distance weighting (inv_dist). It is also possible to choose a nearest neighbour (nearest) strategy. |
| 49 | stdcxx . . $ std/::string m_strategycxx . . $ GDALRasterFillNodataAlgorithm#m_strategy. = "invdist"; |
| 50 | }; |
| 51 | |
| 52 | /************************************************************************/ |
| 53 | /* GDALRasterFillNodataAlgorithmStandalone */ |
| 54 | /************************************************************************/ |
| 55 | |
| 56 | class GDALRasterFillNodataAlgorithmStandalonecxx . . $ GDALRasterFillNodataAlgorithmStandalone# final |
| 57 | : public GDALRasterFillNodataAlgorithmcxx . . $ GDALRasterFillNodataAlgorithm# |
| 58 | { |
| 59 | public: |
| 60 | GDALRasterFillNodataAlgorithmStandalonecxx . . $ GDALRasterFillNodataAlgorithmStandalone#GDALRasterFillNodataAlgorithmStandalone(49f6e7a06ebc5aa8).() |
| 61 | : GDALRasterFillNodataAlgorithmcxx . . $ GDALRasterFillNodataAlgorithm#GDALRasterFillNodataAlgorithm(9f0ba574c1c44ffc).(/* standaloneStep = */ true) |
| 62 | { |
| 63 | } |
| 64 | |
| 65 | ~cxx . . $ GDALRasterFillNodataAlgorithmStandalone#`~GDALRasterFillNodataAlgorithmStandalone`(ced63f7c635d850d).GDALRasterFillNodataAlgorithmStandalonecxx . . $ GDALRasterFillNodataAlgorithmStandalone#() override; |
| 66 | }; |
| 67 | |
| 68 | //! @endcond |
| 69 | |
| 70 | #endif /* GDALALG_RASTER_FILLNODATA_INCLUDED */ |