Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: gdal "raster proximity" subcommand 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_PROXIMITY_INCLUDED 14 : #define GDALALG_RASTER_PROXIMITY_INCLUDED 15 : 16 : #include "gdalalg_raster_pipeline.h" 17 : 18 : //! @cond Doxygen_Suppress 19 : 20 : /************************************************************************/ 21 : /* GDALRasterProximityAlgorithm */ 22 : /************************************************************************/ 23 : 24 : class GDALRasterProximityAlgorithm /* non final */ 25 : : public GDALRasterPipelineNonNativelyStreamingAlgorithm 26 : { 27 : public: 28 : static constexpr const char *NAME = "proximity"; 29 : static constexpr const char *DESCRIPTION = 30 : "Produces a raster proximity map."; 31 : static constexpr const char *HELP_URL = 32 : "/programs/gdal_raster_proximity.html"; 33 : 34 : explicit GDALRasterProximityAlgorithm(bool standaloneStep = false); 35 : 36 : private: 37 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 38 : 39 : double m_noDataValue = 0.0; 40 : int m_inputBand = 1; 41 : std::string m_outputDataType = 42 : "Float32"; // Byte|Int16|UInt16|Int32|UInt32|Float32|Float64; 43 : std::vector<double> m_targetPixelValues{}; 44 : std::string m_distanceUnits = "pixel"; // pixel|geo 45 : double m_maxDistance = 0.0; 46 : double m_fixedBufferValue = 0.0; 47 : }; 48 : 49 : /************************************************************************/ 50 : /* GDALRasterProximityAlgorithmStandalone */ 51 : /************************************************************************/ 52 : 53 : class GDALRasterProximityAlgorithmStandalone final 54 : : public GDALRasterProximityAlgorithm 55 : { 56 : public: 57 18 : GDALRasterProximityAlgorithmStandalone() 58 18 : : GDALRasterProximityAlgorithm(/* standaloneStep = */ true) 59 : { 60 18 : } 61 : }; 62 : 63 : //! @endcond 64 : 65 : #endif