24 QString QgsAspectAlgorithm::name()
const
26 return QStringLiteral(
"aspect" );
29 QString QgsAspectAlgorithm::displayName()
const
31 return QObject::tr(
"Aspect" );
34 QStringList QgsAspectAlgorithm::tags()
const
36 return QObject::tr(
"dem,aspect,terrain" ).split(
',' );
39 QString QgsAspectAlgorithm::group()
const
41 return QObject::tr(
"Raster terrain analysis" );
44 QString QgsAspectAlgorithm::groupId()
const
46 return QStringLiteral(
"rasterterrainanalysis" );
49 QString QgsAspectAlgorithm::shortHelpString()
const
51 return QObject::tr(
"This algorithm calculates the aspect of the Digital Terrain Model in input." )
52 + QStringLiteral(
"\n\n" )
53 + QObject::tr(
"The final aspect raster layer contains values from 0 to 360 that express "
54 "the slope direction: starting from North (0°) and continuing clockwise." );
57 QgsAspectAlgorithm *QgsAspectAlgorithm::createInstance()
const
59 return new QgsAspectAlgorithm();
62 void QgsAspectAlgorithm::initAlgorithm(
const QVariantMap & )
73 QgsRasterLayer *inputLayer = parameterAsRasterLayer( parameters, QStringLiteral(
"INPUT" ), context );
78 double zFactor = parameterAsDouble( parameters, QStringLiteral(
"Z_FACTOR" ), context );
80 const QString outputFile = parameterAsOutputLayer( parameters, QStringLiteral(
"OUTPUT" ), context );
81 QFileInfo fi( outputFile );
85 aspect.setZFactor( zFactor );
86 aspect.processRaster( feedback );
89 outputs.insert( QStringLiteral(
"OUTPUT" ), outputFile );