|
| 1 | + |
| 2 | +class QgsContrastEnhancement |
| 3 | +{ |
| 4 | +%TypeHeaderCode |
| 5 | +#include <qgscontrastenhancement.h> |
| 6 | +%End |
| 7 | + |
| 8 | +public: |
| 9 | + |
| 10 | + /** \brief This enumerator describes the types of contrast enhancement algorithms that can be used. */ |
| 11 | + enum CONTRAST_ENHANCEMENT_ALGORITHM |
| 12 | + { |
| 13 | + NO_STRETCH, //this should be the default color scaling algorithm |
| 14 | + STRETCH_TO_MINMAX, //linear histogram stretch |
| 15 | + STRETCH_AND_CLIP_TO_MINMAX, |
| 16 | + CLIP_TO_MINMAX, |
| 17 | + USER_DEFINED |
| 18 | + }; |
| 19 | + |
| 20 | + /*! These are exactly the same as GDAL pixel data types */ |
| 21 | + enum QgsRasterDataType { |
| 22 | + QGS_Unknown = 0, |
| 23 | + /*! Eight bit unsigned integer */ QGS_Byte = 1, |
| 24 | + /*! Sixteen bit unsigned integer */ QGS_UInt16 = 2, |
| 25 | + /*! Sixteen bit signed integer */ QGS_Int16 = 3, |
| 26 | + /*! Thirty two bit unsigned integer */ QGS_UInt32 = 4, |
| 27 | + /*! Thirty two bit signed integer */ QGS_Int32 = 5, |
| 28 | + /*! Thirty two bit floating point */ QGS_Float32 = 6, |
| 29 | + /*! Sixty four bit floating point */ QGS_Float64 = 7, |
| 30 | + /*! Complex Int16 */ QGS_CInt16 = 8, |
| 31 | + /*! Complex Int32 */ QGS_CInt32 = 9, |
| 32 | + /*! Complex Float32 */ QGS_CFloat32 = 10, |
| 33 | + /*! Complex Float64 */ QGS_CFloat64 = 11, |
| 34 | + QGS_TypeCount = 12 /* maximum type # + 1 */ |
| 35 | + }; |
| 36 | + |
| 37 | + QgsContrastEnhancement(QgsContrastEnhancement::QgsRasterDataType theDatatype=QGS_Byte); |
| 38 | + ~QgsContrastEnhancement(); |
| 39 | + |
| 40 | + /* |
| 41 | + * |
| 42 | + * Static methods |
| 43 | + * |
| 44 | + */ |
| 45 | + /** \brief Helper function that returns the maximum possible value for a GDAL data type */ |
| 46 | + static double getMaximumPossibleValue(QgsRasterDataType); |
| 47 | + /** \brief Helper function that returns the minimum possible value for a GDAL data type */ |
| 48 | + static double getMinimumPossibleValue(QgsRasterDataType); |
| 49 | + |
| 50 | + /* |
| 51 | + * |
| 52 | + * Non-Static Inline methods |
| 53 | + * |
| 54 | + */ |
| 55 | + /** \brief Return the maximum value for the contrast enhancement range. */ |
| 56 | + double getMaximumValue(); |
| 57 | + |
| 58 | + /** \brief Return the minimum value for the contrast enhancement range. */ |
| 59 | + double getMinimumValue(); |
| 60 | + |
| 61 | + CONTRAST_ENHANCEMENT_ALGORITHM getContrastEnhancementAlgorithm(); |
| 62 | + |
| 63 | + /* |
| 64 | + * |
| 65 | + * Non-Static methods |
| 66 | + * |
| 67 | + */ |
| 68 | + /** \brief Return true if pixel is in stretable range, false if pixel is outside of range (i.e., clipped) */ |
| 69 | + bool isValueInDisplayableRange(double); |
| 70 | + /** \brief Set the contrast enhancement algorithm */ |
| 71 | + void setContrastEnhancementAlgorithm(CONTRAST_ENHANCEMENT_ALGORITHM, bool generateTable=true); |
| 72 | + /** \brief A public method that allows the user to set their own custom contrast enhancment function */ |
| 73 | + void setContrastEnhancementFunction(QgsContrastEnhancementFunction*); |
| 74 | + /** \brief Set the maximum value for the contrast enhancement range. */ |
| 75 | + void setMaximumValue(double, bool generateTable=true); |
| 76 | + /** \brief Return the minimum value for the contrast enhancement range. */ |
| 77 | + void setMinimumValue(double, bool generateTable=true); |
| 78 | + /** \brief Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed */ |
| 79 | + int stretch(double); |
| 80 | + |
| 81 | +}; |
| 82 | + |
| 83 | +class QgsContrastEnhancement |
| 84 | +{ |
| 85 | +%TypeHeaderCode |
| 86 | +#include <qgscontrastenhancement.h> |
| 87 | +%End |
| 88 | + |
| 89 | +public: |
| 90 | + |
| 91 | + /** \brief This enumerator describes the types of contrast enhancement algorithms that can be used. */ |
| 92 | + enum CONTRAST_ENHANCEMENT_ALGORITHM |
| 93 | + { |
| 94 | + NO_STRETCH, //this should be the default color scaling algorithm |
| 95 | + STRETCH_TO_MINMAX, //linear histogram stretch |
| 96 | + STRETCH_AND_CLIP_TO_MINMAX, |
| 97 | + CLIP_TO_MINMAX, |
| 98 | + USER_DEFINED |
| 99 | + }; |
| 100 | + |
| 101 | + /*! These are exactly the same as GDAL pixel data types */ |
| 102 | + enum QgsRasterDataType { |
| 103 | + QGS_Unknown = 0, |
| 104 | + /*! Eight bit unsigned integer */ QGS_Byte = 1, |
| 105 | + /*! Sixteen bit unsigned integer */ QGS_UInt16 = 2, |
| 106 | + /*! Sixteen bit signed integer */ QGS_Int16 = 3, |
| 107 | + /*! Thirty two bit unsigned integer */ QGS_UInt32 = 4, |
| 108 | + /*! Thirty two bit signed integer */ QGS_Int32 = 5, |
| 109 | + /*! Thirty two bit floating point */ QGS_Float32 = 6, |
| 110 | + /*! Sixty four bit floating point */ QGS_Float64 = 7, |
| 111 | + /*! Complex Int16 */ QGS_CInt16 = 8, |
| 112 | + /*! Complex Int32 */ QGS_CInt32 = 9, |
| 113 | + /*! Complex Float32 */ QGS_CFloat32 = 10, |
| 114 | + /*! Complex Float64 */ QGS_CFloat64 = 11, |
| 115 | + QGS_TypeCount = 12 /* maximum type # + 1 */ |
| 116 | + }; |
| 117 | + |
| 118 | + QgsContrastEnhancement(QgsContrastEnhancement::QgsRasterDataType theDatatype=QGS_Byte); |
| 119 | + ~QgsContrastEnhancement(); |
| 120 | + |
| 121 | + /* |
| 122 | + * |
| 123 | + * Static methods |
| 124 | + * |
| 125 | + */ |
| 126 | + /** \brief Helper function that returns the maximum possible value for a GDAL data type */ |
| 127 | + static double getMaximumPossibleValue(QgsRasterDataType); |
| 128 | + /** \brief Helper function that returns the minimum possible value for a GDAL data type */ |
| 129 | + static double getMinimumPossibleValue(QgsRasterDataType); |
| 130 | + |
| 131 | + /* |
| 132 | + * |
| 133 | + * Non-Static Inline methods |
| 134 | + * |
| 135 | + */ |
| 136 | + /** \brief Return the maximum value for the contrast enhancement range. */ |
| 137 | + double getMaximumValue(); |
| 138 | + |
| 139 | + /** \brief Return the minimum value for the contrast enhancement range. */ |
| 140 | + double getMinimumValue(); |
| 141 | + |
| 142 | + CONTRAST_ENHANCEMENT_ALGORITHM getContrastEnhancementAlgorithm(); |
| 143 | + |
| 144 | + /* |
| 145 | + * |
| 146 | + * Non-Static methods |
| 147 | + * |
| 148 | + */ |
| 149 | + /** \brief Return true if pixel is in stretable range, false if pixel is outside of range (i.e., clipped) */ |
| 150 | + bool isValueInDisplayableRange(double); |
| 151 | + /** \brief Set the contrast enhancement algorithm */ |
| 152 | + void setContrastEnhancementAlgorithm(CONTRAST_ENHANCEMENT_ALGORITHM, bool generateTable=true); |
| 153 | + /** \brief A public method that allows the user to set their own custom contrast enhancment function */ |
| 154 | + void setContrastEnhancementFunction(QgsContrastEnhancementFunction*); |
| 155 | + /** \brief Set the maximum value for the contrast enhancement range. */ |
| 156 | + void setMaximumValue(double, bool generateTable=true); |
| 157 | + /** \brief Return the minimum value for the contrast enhancement range. */ |
| 158 | + void setMinimumValue(double, bool generateTable=true); |
| 159 | + /** \brief Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed */ |
| 160 | + int stretch(double); |
| 161 | + |
| 162 | +}; |
| 163 | + |
| 164 | +class QgsContrastEnhancement |
| 165 | +{ |
| 166 | +%TypeHeaderCode |
| 167 | +#include <qgscontrastenhancement.h> |
| 168 | +%End |
| 169 | + |
| 170 | +public: |
| 171 | + |
| 172 | + /** \brief This enumerator describes the types of contrast enhancement algorithms that can be used. */ |
| 173 | + enum CONTRAST_ENHANCEMENT_ALGORITHM |
| 174 | + { |
| 175 | + NO_STRETCH, //this should be the default color scaling algorithm |
| 176 | + STRETCH_TO_MINMAX, //linear histogram stretch |
| 177 | + STRETCH_AND_CLIP_TO_MINMAX, |
| 178 | + CLIP_TO_MINMAX, |
| 179 | + USER_DEFINED |
| 180 | + }; |
| 181 | + |
| 182 | + /*! These are exactly the same as GDAL pixel data types */ |
| 183 | + enum QgsRasterDataType { |
| 184 | + QGS_Unknown = 0, |
| 185 | + /*! Eight bit unsigned integer */ QGS_Byte = 1, |
| 186 | + /*! Sixteen bit unsigned integer */ QGS_UInt16 = 2, |
| 187 | + /*! Sixteen bit signed integer */ QGS_Int16 = 3, |
| 188 | + /*! Thirty two bit unsigned integer */ QGS_UInt32 = 4, |
| 189 | + /*! Thirty two bit signed integer */ QGS_Int32 = 5, |
| 190 | + /*! Thirty two bit floating point */ QGS_Float32 = 6, |
| 191 | + /*! Sixty four bit floating point */ QGS_Float64 = 7, |
| 192 | + /*! Complex Int16 */ QGS_CInt16 = 8, |
| 193 | + /*! Complex Int32 */ QGS_CInt32 = 9, |
| 194 | + /*! Complex Float32 */ QGS_CFloat32 = 10, |
| 195 | + /*! Complex Float64 */ QGS_CFloat64 = 11, |
| 196 | + QGS_TypeCount = 12 /* maximum type # + 1 */ |
| 197 | + }; |
| 198 | + |
| 199 | + QgsContrastEnhancement(QgsContrastEnhancement::QgsRasterDataType theDatatype=QGS_Byte); |
| 200 | + ~QgsContrastEnhancement(); |
| 201 | + |
| 202 | + /* |
| 203 | + * |
| 204 | + * Static methods |
| 205 | + * |
| 206 | + */ |
| 207 | + /** \brief Helper function that returns the maximum possible value for a GDAL data type */ |
| 208 | + static double getMaximumPossibleValue(QgsRasterDataType); |
| 209 | + /** \brief Helper function that returns the minimum possible value for a GDAL data type */ |
| 210 | + static double getMinimumPossibleValue(QgsRasterDataType); |
| 211 | + |
| 212 | + /* |
| 213 | + * |
| 214 | + * Non-Static Inline methods |
| 215 | + * |
| 216 | + */ |
| 217 | + /** \brief Return the maximum value for the contrast enhancement range. */ |
| 218 | + double getMaximumValue(); |
| 219 | + |
| 220 | + /** \brief Return the minimum value for the contrast enhancement range. */ |
| 221 | + double getMinimumValue(); |
| 222 | + |
| 223 | + CONTRAST_ENHANCEMENT_ALGORITHM getContrastEnhancementAlgorithm(); |
| 224 | + |
| 225 | + /* |
| 226 | + * |
| 227 | + * Non-Static methods |
| 228 | + * |
| 229 | + */ |
| 230 | + /** \brief Return true if pixel is in stretable range, false if pixel is outside of range (i.e., clipped) */ |
| 231 | + bool isValueInDisplayableRange(double); |
| 232 | + /** \brief Set the contrast enhancement algorithm */ |
| 233 | + void setContrastEnhancementAlgorithm(CONTRAST_ENHANCEMENT_ALGORITHM, bool generateTable=true); |
| 234 | + /** \brief A public method that allows the user to set their own custom contrast enhancment function */ |
| 235 | + void setContrastEnhancementFunction(QgsContrastEnhancementFunction*); |
| 236 | + /** \brief Set the maximum value for the contrast enhancement range. */ |
| 237 | + void setMaximumValue(double, bool generateTable=true); |
| 238 | + /** \brief Return the minimum value for the contrast enhancement range. */ |
| 239 | + void setMinimumValue(double, bool generateTable=true); |
| 240 | + /** \brief Apply the contrast enhancement to a value. Return values are 0 - 254, -1 means the pixel was clipped and should not be displayed */ |
| 241 | + int stretch(double); |
| 242 | + |
| 243 | +}; |
0 commit comments