1
/* **************************************************************************
2
qgslinearminmaxenhancementwithclip.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 "qgslinearminmaxenhancementwithclip.h"
21
QgsLinearMinMaxEnhancementWithClip::QgsLinearMinMaxEnhancementWithClip( QgsContrastEnhancement::QgsRasterDataType theQgsRasterDataType, double theMinimumValue, double theMaximumValue ) : QgsContrastEnhancementFunction( theQgsRasterDataType, theMinimumValue, theMaximumValue )
25
int QgsLinearMinMaxEnhancementWithClip::enhance( double theValue )
27
if ( theValue < mMinimumValue || theValue > mMaximumValue )
32
int myStretchedValue = static_cast<int>((( theValue - mMinimumValue ) / ( mMinimumMaximumRange ) ) * 255.0 );
33
if ( myStretchedValue < 0 )
37
else if ( myStretchedValue > 255 )
42
return myStretchedValue;
45
bool QgsLinearMinMaxEnhancementWithClip::isValueInDisplayableRange( double theValue )
47
if ( theValue < mMinimumValue || theValue > mMaximumValue )