|
QGIS API Documentation 3.99.0-Master (2fe06baccd8)
|
Handles contrast enhancement and clipping. More...
#include <qgscontrastenhancement.h>
Public Types | |
| enum | ContrastEnhancementAlgorithm { NoEnhancement , StretchToMinimumMaximum , StretchAndClipToMinimumMaximum , ClipToMinimumMaximum , UserDefinedEnhancement } |
| This enumerator describes the types of contrast enhancement algorithms that can be used. More... | |
Public Member Functions | |
| QgsContrastEnhancement (const QgsContrastEnhancement &ce) | |
| QgsContrastEnhancement (Qgis::DataType datatype=Qgis::DataType::Byte) | |
| Constructor for QgsContrastEnhancement, for the specified data type. | |
| ~QgsContrastEnhancement () | |
| ContrastEnhancementAlgorithm | contrastEnhancementAlgorithm () const |
| int | enhanceContrast (double value) |
| Applies the contrast enhancement to a value. | |
| bool | isValueInDisplayableRange (double value) |
Returns true if a pixel value is in displayable range, false if pixel is outside of range (i.e. | |
| double | maximumValue () const |
| Returns the maximum value for the contrast enhancement range. | |
| double | minimumValue () const |
| Returns the minimum value for the contrast enhancement range. | |
| const QgsContrastEnhancement & | operator= (const QgsContrastEnhancement &)=delete |
| void | readXml (const QDomElement &elem) |
| void | setContrastEnhancementAlgorithm (ContrastEnhancementAlgorithm algorithm, bool generateTable=true) |
| Sets the contrast enhancement algorithm. | |
| void | setContrastEnhancementFunction (QgsContrastEnhancementFunction *function) |
| Allows the user to set their own custom contrast enhancement function. | |
| void | setMaximumValue (double value, bool generateTable=true) |
| Sets the maximum value for the contrast enhancement range. | |
| void | setMinimumValue (double value, bool generateTable=true) |
| Sets the minimum value for the contrast enhancement range. | |
| void | toSld (QDomDocument &doc, QDomElement &element) const |
| Write ContrastEnhancement tags following SLD v1.0 specs SLD1.0 is limited to the parameters listed in: https://docs.geoserver.org/stable/en/user/styling/sld/reference/rastersymbolizer.html#contrastenhancement Btw only sld:Normalize + vendor options are supported because there is no clear mapping of ContrastEnhancement parameters to support sld:Histogram or sld:GammaValue. | |
| void | writeXml (QDomDocument &doc, QDomElement &parentElem) const |
Static Public Member Functions | |
| static ContrastEnhancementAlgorithm | contrastEnhancementAlgorithmFromString (const QString &contrastEnhancementString) |
| Deserialize ContrastEnhancementAlgorithm. | |
| static QString | contrastEnhancementAlgorithmString (ContrastEnhancementAlgorithm algorithm) |
| Returns a string to serialize ContrastEnhancementAlgorithm. | |
| static double | maximumValuePossible (Qgis::DataType dataType) |
| Helper function that returns the maximum possible value for a data type. | |
| static double | minimumValuePossible (Qgis::DataType dataType) |
| Helper function that returns the minimum possible value for a data type. | |
Handles contrast enhancement and clipping.
Manipulates raster or point cloud pixel values so that they enhance contrast or clip into a specified numerical range according to the specified ContrastEnhancementAlgorithm.
Definition at line 44 of file qgscontrastenhancement.h.
This enumerator describes the types of contrast enhancement algorithms that can be used.
| Enumerator | |
|---|---|
| NoEnhancement | Default color scaling algorithm, no scaling is applied. |
| StretchToMinimumMaximum | Linear histogram. |
| StretchAndClipToMinimumMaximum | |
| ClipToMinimumMaximum | |
| UserDefinedEnhancement | |
Definition at line 50 of file qgscontrastenhancement.h.
| QgsContrastEnhancement::QgsContrastEnhancement | ( | Qgis::DataType | datatype = Qgis::DataType::Byte | ) |
Constructor for QgsContrastEnhancement, for the specified data type.
Definition at line 35 of file qgscontrastenhancement.cpp.
| QgsContrastEnhancement::QgsContrastEnhancement | ( | const QgsContrastEnhancement & | ce | ) |
Definition at line 51 of file qgscontrastenhancement.cpp.
| QgsContrastEnhancement::~QgsContrastEnhancement | ( | ) |
Definition at line 70 of file qgscontrastenhancement.cpp.
|
inline |
Definition at line 166 of file qgscontrastenhancement.h.
|
static |
Deserialize ContrastEnhancementAlgorithm.
Definition at line 385 of file qgscontrastenhancement.cpp.
|
static |
Returns a string to serialize ContrastEnhancementAlgorithm.
Definition at line 367 of file qgscontrastenhancement.cpp.
| int QgsContrastEnhancement::enhanceContrast | ( | double | value | ) |
Applies the contrast enhancement to a value.
Return values are 0 - 255, -1 means the pixel was clipped and should not be displayed.
Definition at line 75 of file qgscontrastenhancement.cpp.
| bool QgsContrastEnhancement::isValueInDisplayableRange | ( | double | value | ) |
Returns true if a pixel value is in displayable range, false if pixel is outside of range (i.e.
clipped).
Definition at line 146 of file qgscontrastenhancement.cpp.
|
inline |
Returns the maximum value for the contrast enhancement range.
Definition at line 161 of file qgscontrastenhancement.h.
|
inlinestatic |
Helper function that returns the maximum possible value for a data type.
Definition at line 71 of file qgscontrastenhancement.h.
|
inline |
Returns the minimum value for the contrast enhancement range.
Definition at line 164 of file qgscontrastenhancement.h.
|
inlinestatic |
Helper function that returns the minimum possible value for a data type.
Definition at line 112 of file qgscontrastenhancement.h.
|
delete |
| void QgsContrastEnhancement::readXml | ( | const QDomElement & | elem | ) |
Definition at line 271 of file qgscontrastenhancement.cpp.
| void QgsContrastEnhancement::setContrastEnhancementAlgorithm | ( | ContrastEnhancementAlgorithm | algorithm, |
| bool | generateTable = true ) |
Sets the contrast enhancement algorithm.
The generateTable parameter is optional and is for performance improvements. If you know you are immediately going to set the Minimum or Maximum value, you can elect to not generate the lookup tale. By default it will be generated.
Definition at line 156 of file qgscontrastenhancement.cpp.
| void QgsContrastEnhancement::setContrastEnhancementFunction | ( | QgsContrastEnhancementFunction * | function | ) |
Allows the user to set their own custom contrast enhancement function.
Ownership of function is transferred.
Definition at line 186 of file qgscontrastenhancement.cpp.
| void QgsContrastEnhancement::setMaximumValue | ( | double | value, |
| bool | generateTable = true ) |
Sets the maximum value for the contrast enhancement range.
The generateTable parameter is optional and is for performance improvements. If you know you are immediately going to set the minimum value or the contrast enhancement algorithm, you can elect to not generate the lookup table. By default it will be generated.
Definition at line 198 of file qgscontrastenhancement.cpp.
| void QgsContrastEnhancement::setMinimumValue | ( | double | value, |
| bool | generateTable = true ) |
Sets the minimum value for the contrast enhancement range.
The generateTable parameter is optional and is for performance improvements. If you know you are immediately going to set the maximum value or the contrast enhancement algorithm, you can elect to not generate the lookup table. By default it will be generated.
Definition at line 224 of file qgscontrastenhancement.cpp.
| void QgsContrastEnhancement::toSld | ( | QDomDocument & | doc, |
| QDomElement & | element ) const |
Write ContrastEnhancement tags following SLD v1.0 specs SLD1.0 is limited to the parameters listed in: https://docs.geoserver.org/stable/en/user/styling/sld/reference/rastersymbolizer.html#contrastenhancement Btw only sld:Normalize + vendor options are supported because there is no clear mapping of ContrastEnhancement parameters to support sld:Histogram or sld:GammaValue.
Definition at line 318 of file qgscontrastenhancement.cpp.
| void QgsContrastEnhancement::writeXml | ( | QDomDocument & | doc, |
| QDomElement & | parentElem ) const |
Definition at line 250 of file qgscontrastenhancement.cpp.