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;
162 int enhanceContrast(
double value );
168 bool isValueInDisplayableRange(
double value );
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 );
220 void toSld( QDomDocument &doc, QDomElement &element )
const;
231 std::unique_ptr< QgsContrastEnhancementFunction > mContrastEnhancementFunction;
234 bool mEnhancementDirty =
false;
237 int *mLookupTable =
nullptr;
240 double mMinimumValue;
243 double mMaximumValue;
249 double mRasterDataTypeRange;
252 double mLookupTableOffset;
255 bool generateLookupTable();
258 int calculateContrastEnhancementValue(
double );
double maximumValue() const
Returns the maximum value for the contrast enhancement range.
Thirty two bit signed integer (qint32)
static double minimumValuePossible(Qgis::DataType dataType)
Helper function that returns the minimum possible value for a GDAL data type.
static double maximumValuePossible(Qgis::DataType dataType)
Helper function that returns the maximum possible value for a GDAL data type.
Thirty two bit unsigned integer (quint32)
DataType
Raster data types.
double minimumValue() const
Returns the minimum value for the contrast enhancement range.
Thirty two bit floating point (float)
Sixteen bit signed integer (qint16)
Sixty four bit floating point (double)
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32_Premultiplied.
Unknown or unspecified type.
A contrast enhancement function is the base class for all raster contrast enhancements.
Sixteen bit unsigned integer (quint16)
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into allowing algorithms to be written in pure substantial changes are required in order to port existing x Processing algorithms for QGIS x The most significant changes are outlined not GeoAlgorithm For algorithms which operate on features one by consider subclassing the QgsProcessingFeatureBasedAlgorithm class This class allows much of the boilerplate code for looping over features from a vector layer to be bypassed and instead requires implementation of a processFeature method Ensure that your algorithm(or algorithm 's parent class) implements the new pure virtual createInstance(self) call
ContrastEnhancementAlgorithm
This enumerator describes the types of contrast enhancement algorithms that can be used...
ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() const
Manipulates raster pixel values so that they enhanceContrast or clip into a specified numerical range...
Eight bit unsigned integer (quint8)
Color, alpha, red, green, blue, 4 bytes the same as QImage::Format_ARGB32.