24 QString QgsHillshadeAlgorithm::name()
const
26 return QStringLiteral(
"hillshade" );
29 QString QgsHillshadeAlgorithm::displayName()
const
31 return QObject::tr(
"Hillshade" );
34 QStringList QgsHillshadeAlgorithm::tags()
const
36 return QObject::tr(
"dem,hillshade,terrain" ).split(
',' );
39 QString QgsHillshadeAlgorithm::group()
const
41 return QObject::tr(
"Raster terrain analysis" );
44 QString QgsHillshadeAlgorithm::groupId()
const
46 return QStringLiteral(
"rasterterrainanalysis" );
49 QString QgsHillshadeAlgorithm::shortHelpString()
const
51 return QObject::tr(
"This algorithm calculates the hillshade of the Digital Terrain Model in input." )
52 + QStringLiteral(
"\n\n" )
53 + QObject::tr(
"The shading of the layer is calculated according to the sun position (azimuth and elevation)." );
56 QgsHillshadeAlgorithm *QgsHillshadeAlgorithm::createInstance()
const
58 return new QgsHillshadeAlgorithm();
61 void QgsHillshadeAlgorithm::initAlgorithm(
const QVariantMap & )
76 QgsRasterLayer *inputLayer = parameterAsRasterLayer( parameters, QStringLiteral(
"INPUT" ), context );
81 double zFactor = parameterAsDouble( parameters, QStringLiteral(
"Z_FACTOR" ), context );
82 double azimuth = parameterAsDouble( parameters, QStringLiteral(
"AZIMUTH" ), context );
83 double vAngle = parameterAsDouble( parameters, QStringLiteral(
"V_ANGLE" ), context );
85 const QString outputFile = parameterAsOutputLayer( parameters, QStringLiteral(
"OUTPUT" ), context );
86 QFileInfo fi( outputFile );
90 hillshade.setZFactor( zFactor );
91 hillshade.processRaster( feedback );
94 outputs.insert( QStringLiteral(
"OUTPUT" ), outputFile );