00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "qgslogger.h"
00020
00021 #include "qgsrastershader.h"
00022
00023 QgsRasterShader::QgsRasterShader( double theMinimumValue, double theMaximumValue )
00024 {
00025 QgsDebugMsg( "called." );
00026
00027 mMinimumValue = theMinimumValue;
00028 mMaximumValue = theMaximumValue;
00029 mRasterShaderFunction = new QgsRasterShaderFunction( mMinimumValue, mMaximumValue );
00030 }
00031
00032 QgsRasterShader::~QgsRasterShader()
00033 {
00034 delete mRasterShaderFunction;
00035 }
00036
00046 bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
00047 {
00048 if ( 0 != mRasterShaderFunction )
00049 {
00050 return mRasterShaderFunction->shade( theValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue );
00051 }
00052
00053 return false;
00054 }
00067 bool QgsRasterShader::shade( double theRedValue, double theGreenValue, double theBlueValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue )
00068 {
00069 if ( 0 != mRasterShaderFunction )
00070 {
00071 return mRasterShaderFunction->shade( theRedValue, theGreenValue, theBlueValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue );
00072 }
00073
00074 return false;
00075 }
00076
00082 void QgsRasterShader::setRasterShaderFunction( QgsRasterShaderFunction* theFunction )
00083 {
00084 QgsDebugMsg( "called." );
00085
00086 if ( mRasterShaderFunction == theFunction )
00087 return;
00088
00089 if ( 0 != theFunction )
00090 {
00091 delete mRasterShaderFunction;
00092 mRasterShaderFunction = theFunction;
00093 }
00094 }
00095
00101 void QgsRasterShader::setMaximumValue( double theValue )
00102 {
00103 QgsDebugMsg( "Value = " + QString::number( theValue ) );
00104
00105 mMaximumValue = theValue;
00106 if ( 0 != mRasterShaderFunction )
00107 {
00108 mRasterShaderFunction->setMaximumValue( theValue );
00109 }
00110 }
00111
00117 void QgsRasterShader::setMinimumValue( double theValue )
00118 {
00119 QgsDebugMsg( "Value = " + QString::number( theValue ) );
00120
00121 mMinimumValue = theValue;
00122 if ( 0 != mRasterShaderFunction )
00123 {
00124 mRasterShaderFunction->setMinimumValue( theValue );
00125 }
00126 }