QGIS API Documentation  3.14.0-Pi (9f7028fd23)
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 
28 class ANALYSIS_EXPORT QgsHillshadeFilter: public QgsDerivativeFilter
29 {
30  public:
31  QgsHillshadeFilter( const QString &inputFile, const QString &outputFile, const QString &outputFormat, double lightAzimuth = 300,
32  double lightAngle = 40 );
33 
37  float processNineCellWindow( float *x11, float *x21, float *x31,
38  float *x12, float *x22, float *x32,
39  float *x13, float *x23, float *x33 ) override;
40 
41  float lightAzimuth() const { return mLightAzimuth; }
42  void setLightAzimuth( float azimuth );
43  float lightAngle() const { return mLightAngle; }
44  void setLightAngle( float angle );
45 
46  private:
47 
48 #ifdef HAVE_OPENCL
49 
50  const QString openClProgramBaseName() const override
51  {
52  return QStringLiteral( "hillshade" );
53  }
54 #endif
55 
56  float mLightAzimuth;
57  float mLightAngle;
58  // Precalculate for speed:
59  float mCosZenithRad;
60  float mSinZenithRad;
61  float mAzimuthRad;
62 
63 
64 #ifdef HAVE_OPENCL
65  private:
66 
67  void addExtraRasterParams( std::vector<float> &params ) override;
68 #endif
69 
70 };
71 
72 #endif // QGSHILLSHADEFILTER_H
QgsDerivativeFilter
Definition: qgsderivativefilter.h:27
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
Definition: qgshillshadefilter.h:28
QgsHillshadeFilter::lightAzimuth
float lightAzimuth() const
Definition: qgshillshadefilter.h:41
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:43