QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgshillshadefilter.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgshillshadefilter.h - description
3  --------------------------------
4  begin : September 26th, 2011
5  copyright : (C) 2011 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSHILLSHADEFILTER_H
19 #define QGSHILLSHADEFILTER_H
20 
21 #include "qgsderivativefilter.h"
22 #include "qgis_analysis.h"
23 
29 class ANALYSIS_EXPORT QgsHillshadeFilter: public QgsDerivativeFilter
30 {
31  public:
32  QgsHillshadeFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat, double lightAzimuth = 300,
33  double lightAngle = 40 );
34 
35  float processNineCellWindow( float *x11, float *x21, float *x31,
36  float *x12, float *x22, float *x32,
37  float *x13, float *x23, float *x33 ) override;
38 
39  float lightAzimuth() const { return mLightAzimuth; }
40  void setLightAzimuth( float azimuth );
41  float lightAngle() const { return mLightAngle; }
42  void setLightAngle( float angle );
43 
44  private:
45 
46 #ifdef HAVE_OPENCL
47 
48  const QString openClProgramBaseName() const override
49  {
50  return QStringLiteral( "hillshade" );
51  }
52 #endif
53 
54  float mLightAzimuth;
55  float mLightAngle;
56  // Precalculate for speed:
57  float mCosZenithRad;
58  float mSinZenithRad;
59  float mAzimuthRad;
60 
61 
62 #ifdef HAVE_OPENCL
63  private:
64 
65  void addExtraRasterParams( std::vector<float> &params ) override;
66 #endif
67 
68 };
69 
70 #endif // QGSHILLSHADEFILTER_H
QgsDerivativeFilter
Adds the ability to calculate derivatives in x- and y-directions.
Definition: qgsderivativefilter.h:30
QgsDerivativeFilter::processNineCellWindow
float processNineCellWindow(float *x11, float *x21, float *x31, float *x12, float *x22, float *x32, float *x13, float *x23, float *x33) override=0
Calculates output value from nine input values.
QgsHillshadeFilter
A hillshade filter.
Definition: qgshillshadefilter.h:29
QgsHillshadeFilter::lightAzimuth
float lightAzimuth() const
Definition: qgshillshadefilter.h:39
qgsderivativefilter.h
MathUtils::angle
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Definition: MathUtils.cpp:786
QgsHillshadeFilter::lightAngle
float lightAngle() const
Definition: qgshillshadefilter.h:41