Skip to content

Commit 89b8386

Browse files
author
gsherman
committed
new files from raster transparency branch
git-svn-id: http://svn.osgeo.org/qgis/trunk@7927 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent c73ffbe commit 89b8386

27 files changed

+4031
-0
lines changed
+243
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,243 @@
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+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
2+
class QgsContrastEnhancementFunction
3+
{
4+
%TypeHeaderCode
5+
#include <qgscontrastenhancement.h>
6+
#include <qgscontrastenhancementfunction.h>
7+
%End
8+
9+
public:
10+
QgsContrastEnhancementFunction(QgsContrastEnhancement::QgsRasterDataType, double, double);
11+
virtual ~QgsContrastEnhancementFunction();
12+
13+
/** \brief Mustator for the maximum value */
14+
void setMaximumValue(double);
15+
/** \brief Mutator for the minimum value */
16+
void setMinimumValue(double);
17+
18+
/** \brief A customizable method that takes in a double and returns a int between 0 and 255 */
19+
virtual int enhanceValue(double);
20+
/** \brief A customicable method to indicate if the pixels is displayable */
21+
virtual bool isValueInDisplayableRange(double);
22+
23+
};
24+
25+
class QgsContrastEnhancementFunction
26+
{
27+
%TypeHeaderCode
28+
#include <qgscontrastenhancement.h>
29+
#include <qgscontrastenhancementfunction.h>
30+
%End
31+
32+
public:
33+
QgsContrastEnhancementFunction(QgsContrastEnhancement::QgsRasterDataType, double, double);
34+
virtual ~QgsContrastEnhancementFunction();
35+
36+
/** \brief Mustator for the maximum value */
37+
void setMaximumValue(double);
38+
/** \brief Mutator for the minimum value */
39+
void setMinimumValue(double);
40+
41+
/** \brief A customizable method that takes in a double and returns a int between 0 and 255 */
42+
virtual int enhanceValue(double);
43+
/** \brief A customicable method to indicate if the pixels is displayable */
44+
virtual bool isValueInDisplayableRange(double);
45+
46+
};
47+
48+
class QgsContrastEnhancementFunction
49+
{
50+
%TypeHeaderCode
51+
#include <qgscontrastenhancement.h>
52+
#include <qgscontrastenhancementfunction.h>
53+
%End
54+
55+
public:
56+
QgsContrastEnhancementFunction(QgsContrastEnhancement::QgsRasterDataType, double, double);
57+
virtual ~QgsContrastEnhancementFunction();
58+
59+
/** \brief Mustator for the maximum value */
60+
void setMaximumValue(double);
61+
/** \brief Mutator for the minimum value */
62+
void setMinimumValue(double);
63+
64+
/** \brief A customizable method that takes in a double and returns a int between 0 and 255 */
65+
virtual int enhanceValue(double);
66+
/** \brief A customicable method to indicate if the pixels is displayable */
67+
virtual bool isValueInDisplayableRange(double);
68+
69+
};

0 commit comments

Comments
 (0)