1
/* **************************************************************************
2
qgscliptominmaxenhancement.cpp - description
4
begin : Fri Nov 16 2007
5
copyright : (C) 2007 by Peter J. Ersts
8
****************************************************************************/
10
/* **************************************************************************
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. *
17
***************************************************************************/
19
#include "qgscliptominmaxenhancement.h"
21
QgsClipToMinMaxEnhancement::QgsClipToMinMaxEnhancement( QgsContrastEnhancement::QgsRasterDataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
25
int QgsClipToMinMaxEnhancement::enhance( double theValue )
27
if ( theValue < mMinimumValue || theValue > mMaximumValue )
32
if ( mQgsRasterDataType == QgsContrastEnhancement::QGS_Byte )
34
return static_cast<int>( theValue );
38
return static_cast<int>(((( theValue - QgsContrastEnhancement::minimumValuePossible( mQgsRasterDataType ) ) / ( QgsContrastEnhancement::maximumValuePossible( mQgsRasterDataType ) - QgsContrastEnhancement::minimumValuePossible( mQgsRasterDataType ) ) )*255.0 ) );
42
bool QgsClipToMinMaxEnhancement::isValueInDisplayableRange( double theValue )
44
if ( theValue < mMinimumValue || theValue > mMaximumValue )