Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
qgscontrastenhancement.h
Go to the documentation of this file.
1 /* **************************************************************************
2  qgscontrastenhancement.h - description
3  -------------------
4 begin : Mon Oct 22 2007
5 copyright : (C) 2007 by Peter J. Ersts
6 email : ersts@amnh.org
7 
8 This class contains code that was originally part of the larger QgsRasterLayer
9 class originally created circa 2004 by T.Sutton, Gary E.Sherman, Steve Halasz
10 ****************************************************************************/
11 
12 /* **************************************************************************
13  * *
14  * This program is free software; you can redistribute it and/or modify *
15  * it under the terms of the GNU General Public License as published by *
16  * the Free Software Foundation; either version 2 of the License, or *
17  * (at your option) any later version. *
18  * *
19  ***************************************************************************/
20 
21 #ifndef QGSCONTRASTENHANCEMENT_H
22 #define QGSCONTRASTENHANCEMENT_H
23 
24 #include <limits>
25 
27 
33 class CORE_EXPORT QgsContrastEnhancement
34 {
35 
36  public:
37 
40  {
41  NoEnhancement, //this should be the default color scaling algorithm
42  StretchToMinimumMaximum, //linear histogram enhanceContrast
45  UserDefinedEnhancement
46  };
47 
56  {
57  QGS_Unknown = 0, QGS_Byte = 1, QGS_UInt16 = 2, QGS_Int16 = 3, QGS_UInt32 = 4, QGS_Int32 = 5, QGS_Float32 = 6, QGS_Float64 = 7, QGS_CInt16 = 8, QGS_CInt32 = 9, QGS_CFloat32 = 10, QGS_CFloat64 = 11,
69  QGS_TypeCount = 12 /* maximum type # + 1 */
70  };
71 
74 
75  /*
76  *
77  * Static methods
78  *
79  */
81  static double maximumValuePossible( QgsRasterDataType );
82 
84  static double minimumValuePossible( QgsRasterDataType );
85 
86  /*
87  *
88  * Non-Static Inline methods
89  *
90  */
92  double maximumValue() const { return mMaximumValue; }
93 
95  double minimumValue() const { return mMinimumValue; }
96 
97  ContrastEnhancementAlgorithm contrastEnhancementAlgorithm() { return mContrastEnhancementAlgorithm; }
98 
99  /*
100  *
101  * Non-Static methods
102  *
103  */
105  int enhanceContrast( double );
106 
108  bool isValueInDisplayableRange( double );
109 
111  void setContrastEnhancementAlgorithm( ContrastEnhancementAlgorithm, bool generateTable = true );
112 
114  void setContrastEnhancementFunction( QgsContrastEnhancementFunction* );
115 
117  void setMaximumValue( double, bool generateTable = true );
118 
120  void setMinimumValue( double, bool generateTable = true );
121 
122  private:
125 
128 
131 
134 
137 
140 
143 
146 
149 
150 
151 
153  bool generateLookupTable();
154 
156  int calculateContrastEnhancementValue( double );
157 };
158 
159 #endif