21 #ifndef QGSCONTRASTENHANCEMENT_H
22 #define QGSCONTRASTENHANCEMENT_H
24 #include "qgis_core.h"
54 UserDefinedEnhancement
71 return std::numeric_limits<unsigned char>::max();
73 return std::numeric_limits<unsigned short>::max();
75 return std::numeric_limits<short>::max();
77 return std::numeric_limits<unsigned int>::max();
79 return std::numeric_limits<int>::max();
81 return std::numeric_limits<float>::max();
83 return std::numeric_limits<double>::max();
85 return std::numeric_limits<short>::max();
87 return std::numeric_limits<int>::max();
89 return std::numeric_limits<float>::max();
91 return std::numeric_limits<double>::max();
99 return std::numeric_limits<double>::max();
110 return std::numeric_limits<unsigned char>::min();
112 return std::numeric_limits<unsigned short>::min();
114 return std::numeric_limits<short>::min();
116 return std::numeric_limits<unsigned int>::min();
118 return std::numeric_limits<int>::min();
120 return std::numeric_limits<float>::max() * -1.0;
122 return std::numeric_limits<double>::max() * -1.0;
124 return std::numeric_limits<short>::min();
126 return std::numeric_limits<int>::min();
128 return std::numeric_limits<float>::max() * -1.0;
130 return std::numeric_limits<double>::max() * -1.0;
138 return std::numeric_limits<double>::max() * -1.0;
144 static QString contrastEnhancementAlgorithmString( ContrastEnhancementAlgorithm
algorithm );
149 static ContrastEnhancementAlgorithm contrastEnhancementAlgorithmFromString(
const QString &contrastEnhancementString );
162 int enhanceContrast(
double value );
168 bool isValueInDisplayableRange(
double value );
177 void setContrastEnhancementAlgorithm( ContrastEnhancementAlgorithm
algorithm,
bool generateTable =
true );
195 void setMaximumValue(
double value,
bool generateTable =
true );
207 void setMinimumValue(
double value,
bool generateTable =
true );
209 void writeXml( QDomDocument &doc, QDomElement &parentElem )
const;
211 void readXml(
const QDomElement &elem );
221 void toSld( QDomDocument &doc, QDomElement &element )
const;
229 ContrastEnhancementAlgorithm mContrastEnhancementAlgorithm = NoEnhancement;
232 std::unique_ptr< QgsContrastEnhancementFunction > mContrastEnhancementFunction;
235 bool mEnhancementDirty =
false;
238 int *mLookupTable =
nullptr;
241 double mMinimumValue;
244 double mMaximumValue;
250 double mRasterDataTypeRange;
253 double mLookupTableOffset;
256 bool generateLookupTable();
259 int calculateContrastEnhancementValue(
double );