Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgsrastershader.cpp
Go to the documentation of this file.
1 /* **************************************************************************
2  qgsrastershader.cpp - description
3  -------------------
4 begin : Fri Dec 28 2007
5 copyright : (C) 2007 by Peter J. Ersts
6 email : ersts@amnh.org
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 
19 #include "qgslogger.h"
20 
21 #include "qgsrastershader.h"
22 
23 QgsRasterShader::QgsRasterShader( double theMinimumValue, double theMaximumValue )
24 {
25  QgsDebugMsg( "called." );
26 
27  mMinimumValue = theMinimumValue;
28  mMaximumValue = theMaximumValue;
30 }
31 
33 {
34  delete mRasterShaderFunction;
35 }
36 
46 bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
47 {
48  if ( 0 != mRasterShaderFunction )
49  {
50  return mRasterShaderFunction->shade( theValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue );
51  }
52 
53  return false;
54 }
67 bool QgsRasterShader::shade( double theRedValue, double theGreenValue, double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
68 {
69  if ( 0 != mRasterShaderFunction )
70  {
71  return mRasterShaderFunction->shade( theRedValue, theGreenValue, theBlueValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue );
72  }
73 
74  return false;
75 }
76 
83 {
84  QgsDebugMsg( "called." );
85 
86  if ( mRasterShaderFunction == theFunction )
87  return;
88 
89  if ( 0 != theFunction )
90  {
91  delete mRasterShaderFunction;
92  mRasterShaderFunction = theFunction;
93  }
94 }
95 
101 void QgsRasterShader::setMaximumValue( double theValue )
102 {
103  QgsDebugMsg( "Value = " + QString::number( theValue ) );
104 
105  mMaximumValue = theValue;
106  if ( 0 != mRasterShaderFunction )
107  {
109  }
110 }
111 
117 void QgsRasterShader::setMinimumValue( double theValue )
118 {
119  QgsDebugMsg( "Value = " + QString::number( theValue ) );
120 
121  mMinimumValue = theValue;
122  if ( 0 != mRasterShaderFunction )
123  {
125  }
126 }