QGIS API Documentation  2.14.0-Essen
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";
27  return "StdDev";
29  return "CumulativeCut";
30  default:
31  break;
32  }
33  return "None";
34 }
35 
37 {
38  if ( theLimits == "MinMax" )
39  {
41  }
42  else if ( theLimits == "StdDev" )
43  {
45  }
46  else if ( theLimits == "CumulativeCut" )
47  {
49  }
51 }
52 
53 double QgsRaster::representableValue( double value, QGis::DataType dataType )
54 {
55  switch ( dataType )
56  {
57  case QGis::Byte:
58  return static_cast<quint8>( value );
59  case QGis::UInt16:
60  return static_cast<quint16>( value );
61  case QGis::Int16:
62  return static_cast<qint16>( value );
63  case QGis::UInt32:
64  return static_cast<quint32>( value );
65  case QGis::Int32:
66  return static_cast<qint32>( value );
67  case QGis::Float32:
68  return static_cast<float>( value );
69  default:
70  break;
71  }
72  return value;
73 }
Eight bit unsigned integer (quint8)
Definition: qgis.h:132
Thirty two bit floating point (float)
Definition: qgis.h:137
static double representableValue(double value, QGis::DataType dataType)
Get value representable by given data type.
Definition: qgsraster.cpp:53
static ContrastEnhancementLimits contrastEnhancementLimitsFromString(const QString &theLimits)
Definition: qgsraster.cpp:36
Sixteen bit unsigned integer (quint16)
Definition: qgis.h:133
Thirty two bit signed integer (qint32)
Definition: qgis.h:136
ContrastEnhancementLimits
Contrast enhancement limits.
Definition: qgsraster.h:86
Thirty two bit unsigned integer (quint32)
Definition: qgis.h:135
static QString contrastEnhancementLimitsAsString(QgsRaster::ContrastEnhancementLimits theLimits)
Definition: qgsraster.cpp:20
Sixteen bit signed integer (qint16)
Definition: qgis.h:134
DataType
Raster data types.
Definition: qgis.h:129