QGIS API Documentation  3.20.0-Odense (decaadbb31)
qgsrastershaderfunction.cpp
Go to the documentation of this file.
1 /* **************************************************************************
2  qgsrastershaderfunction.cpp - description
3  -------------------
4 begin : Fri Dec 28 2007
5 copyright : (C) 2007 by Peter J. Ersts
6 email : [email protected]
7 
8 ****************************************************************************/
9 
10 /* **************************************************************************
11  * *
12  * This program is free software; you can redistribute it and/or modify *
13  * it under the terms of the GNU General Public License as published by *
14  * the Free Software Foundation; either version 2 of the License, or *
15  * (at your option) any later version. *
16  * *
17  ***************************************************************************/
18 #include "qgslogger.h"
19 
21 
22 QgsRasterShaderFunction::QgsRasterShaderFunction( double minimumValue, double maximumValue )
23  : mMaximumValue( maximumValue )
24  , mMinimumValue( minimumValue )
25  , mMinimumMaximumRange( mMaximumValue - mMinimumValue )
26 {
27  QgsDebugMsgLevel( QStringLiteral( "entered." ), 4 );
28 }
29 
31 {
32  QgsDebugMsgLevel( "value = " + QString::number( value ), 4 );
33 
34  mMaximumValue = value;
36 }
37 
39 {
40  QgsDebugMsgLevel( "value = " + QString::number( value ), 4 );
41 
42  mMinimumValue = value;
44 }
45 
46 bool QgsRasterShaderFunction::shade( double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue ) const
47 {
48  Q_UNUSED( value )
49 
50  *returnRedValue = 0;
51  *returnGreenValue = 0;
52  *returnBlueValue = 0;
53  *returnAlphaValue = 0;
54 
55  return false;
56 }
57 
58 bool QgsRasterShaderFunction::shade( double redValue, double greenValue, double blueValue, double alphaValue, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlphaValue ) const
59 {
60  Q_UNUSED( redValue )
61  Q_UNUSED( greenValue )
62  Q_UNUSED( blueValue )
63  Q_UNUSED( alphaValue )
64 
65  *returnRedValue = 0;
66  *returnGreenValue = 0;
67  *returnBlueValue = 0;
68  *returnAlphaValue = 0;
69 
70  return false;
71 }
72 
73 
75 {
76  return mLabelPrecision;
77 }
78 
80 {
82 }
double mMinimumValue
User defineable minimum value for the shading function.
QgsRasterShaderFunction(double minimumValue=0.0, double maximumValue=255.0)
double mMinimumMaximumRange
Minimum maximum range for the shading function.
double mMaximumValue
User defineable maximum value for the shading function.
void setLabelPrecision(int labelPrecision)
Sets label precision to labelPrecision.
virtual bool shade(double value, int *returnRedValue, int *returnGreenValue, int *returnBlueValue, int *returnAlpha) const
Generates an new RGBA value based on one input value.
int labelPrecision() const
Returns label precision.
virtual void setMaximumValue(double value)
Sets the maximum value for the raster shader.
virtual void setMinimumValue(double value)
Sets the minimum value for the raster shader.
int mLabelPrecision
Label precision.
#define QgsDebugMsgLevel(str, level)
Definition: qgslogger.h:39