Line data Source code
1 : /****************************************************************************** 2 : * 3 : * Project: GDAL 4 : * Purpose: "hillshade" 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_HILLSHADE_INCLUDED 14 : #define GDALALG_RASTER_HILLSHADE_INCLUDED 15 : 16 : #include "gdalalg_raster_pipeline.h" 17 : 18 : #include <limits> 19 : 20 : //! @cond Doxygen_Suppress 21 : 22 : /************************************************************************/ 23 : /* GDALRasterHillshadeAlgorithm */ 24 : /************************************************************************/ 25 : 26 : class GDALRasterHillshadeAlgorithm /* non final */ 27 : : public GDALRasterPipelineStepAlgorithm 28 : { 29 : public: 30 : static constexpr const char *NAME = "hillshade"; 31 : static constexpr const char *DESCRIPTION = "Generate a shaded relief map"; 32 : static constexpr const char *HELP_URL = 33 : "/programs/gdal_raster_hillshade.html"; 34 : 35 : explicit GDALRasterHillshadeAlgorithm(bool standaloneStep = false); 36 : 37 : private: 38 : bool RunStep(GDALProgressFunc pfnProgress, void *pProgressData) override; 39 : 40 : int m_band = 1; 41 : double m_zfactor = 1; 42 : double m_xscale = std::numeric_limits<double>::quiet_NaN(); 43 : double m_yscale = std::numeric_limits<double>::quiet_NaN(); 44 : double m_azimuth = 315; 45 : double m_altitude = 45; 46 : std::string m_gradientAlg = "Horn"; 47 : std::string m_variant = "regular"; 48 : bool m_noEdges = false; 49 : }; 50 : 51 : /************************************************************************/ 52 : /* GDALRasterHillshadeAlgorithmStandalone */ 53 : /************************************************************************/ 54 : 55 : class GDALRasterHillshadeAlgorithmStandalone final 56 : : public GDALRasterHillshadeAlgorithm 57 : { 58 : public: 59 20 : GDALRasterHillshadeAlgorithmStandalone() 60 20 : : GDALRasterHillshadeAlgorithm(/* standaloneStep = */ true) 61 : { 62 20 : } 63 : }; 64 : 65 : //! @endcond 66 : 67 : #endif /* GDALALG_RASTER_HILLSHADE_INCLUDED */