QGIS API Documentation  2.12.0-Lyon
qgsraster.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsraster.cpp - Raster namespace
3  --------------------------------------
4  Date : Apr, 2013
5  Copyright : (C) 2013 by Radim Blazek
6  email : radim dot blazek at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsraster.h"
19 
21 {
22  switch ( theLimits )
23  {
25  return "MinMax";
26  break;
28  return "StdDev";
29  break;
31  return "CumulativeCut";
32  break;
33  default:
34  break;
35  }
36  return "None";
37 }
38 
40 {
41  if ( theLimits == "MinMax" )
42  {
44  }
45  else if ( theLimits == "StdDev" )
46  {
48  }
49  else if ( theLimits == "CumulativeCut" )
50  {
52  }
54 }
55 
56 double QgsRaster::representableValue( double value, QGis::DataType dataType )
57 {
58  switch ( dataType )
59  {
60  case QGis::Byte:
61  return static_cast<quint8>( value );
62  case QGis::UInt16:
63  return static_cast<quint16>( value );
64  case QGis::Int16:
65  return static_cast<qint16>( value );
66  case QGis::UInt32:
67  return static_cast<quint32>( value );
68  case QGis::Int32:
69  return static_cast<qint32>( value );
70  case QGis::Float32:
71  return static_cast<float>( value );
72  default:
73  break;
74  }
75  return value;
76 }
Sixteen bit signed integer (qint16)
Definition: qgis.h:127
ContrastEnhancementLimits
Contrast enhancement limits.
Definition: qgsraster.h:86
Eight bit unsigned integer (quint8)
Definition: qgis.h:125
Sixteen bit unsigned integer (quint16)
Definition: qgis.h:126
static double representableValue(double value, QGis::DataType dataType)
Get value representable by given data type.
Definition: qgsraster.cpp:56
static ContrastEnhancementLimits contrastEnhancementLimitsFromString(const QString &theLimits)
Definition: qgsraster.cpp:39
Thirty two bit floating point (float)
Definition: qgis.h:130
DataType
Raster data types.
Definition: qgis.h:122
static QString contrastEnhancementLimitsAsString(QgsRaster::ContrastEnhancementLimits theLimits)
Definition: qgsraster.cpp:20
Thirty two bit signed integer (qint32)
Definition: qgis.h:129
Thirty two bit unsigned integer (quint32)
Definition: qgis.h:128