QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 }