OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimGdalType.cpp
Go to the documentation of this file.
1 //------------------------------------------------------------------------
2 // License: LGPL
3 //
4 // See LICENSE.txt file in the top level directory for more details.
5 //
6 // Author: Garrett Potts
7 //
8 // $Id: ossimGdalType.cpp 14786 2009-06-26 13:35:45Z dburken $
9 //------------------------------------------------------------------------
10 
11 #include "ossimGdalType.h"
12 #include <ossim/base/ossimCommon.h>
13 
14 ossimScalarType ossimGdalType::toOssim(GDALDataType gdalType)const
15 {
16  switch(gdalType)
17  {
18  case GDT_Byte:
19  {
20  return OSSIM_UCHAR;
21  }
22  case GDT_UInt16:
23  {
24  return OSSIM_USHORT16;
25  }
26  case GDT_Int16:
27  {
28  return OSSIM_SSHORT16;
29  }
30  case GDT_Int32:
31  {
32  ossim_int32 sizeType = GDALGetDataTypeSize(gdalType)/8;
33  if(sizeType == 2)
34  {
35  return OSSIM_SSHORT16;
36  }
37  break;
38  }
39  case GDT_Float32:
40  {
41  return OSSIM_FLOAT;
42  break;
43  }
44  case GDT_Float64:
45  {
46  return OSSIM_DOUBLE;
47  break;
48  }
49  default:
50  break;
51  }
52 
53  return OSSIM_SCALAR_UNKNOWN;
54 }
55 
56 GDALDataType ossimGdalType::toGdal(ossimScalarType ossimType)const
57 {
58  switch(ossimType)
59  {
60  case OSSIM_UCHAR:
61  {
62  return GDT_Byte;
63  }
64  case OSSIM_USHORT11:
65  case OSSIM_USHORT16:
66  {
67  return GDT_UInt16;
68  }
69  case OSSIM_SSHORT16:
70  {
71  return GDT_Int16;
72  break;
73  }
74  case OSSIM_FLOAT:
76  {
77  return GDT_Float32;
78  }
79  case OSSIM_DOUBLE:
81  {
82  return GDT_Float64;
83  }
85  {
86  break;
87  }
88  default:
89  break;
90  }
91 
92  return GDT_Unknown;
93 }
ossimScalarType toOssim(GDALDataType gdalType) const
32 bit normalized floating point
ossimScalarType
64 bit normalized floating point
16 bit unsigned integer (11 bits used)
GDALDataType toGdal(ossimScalarType) const
32 bit floating point
16 bit unsigned iteger
64 bit floating point
16 bit signed integer
8 bit unsigned iteger
int ossim_int32