isce3  0.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Pages
IH5Dataset.h
1 //-*- C++ -*-
2 //-*- coding: utf-8 -*-
3 //
4 // Author: Piyush Agram
5 // Copyright 2019
6 
7 #pragma once
8 
9 #include "forward.h"
10 
11 #include <gdal_pam.h>
12 #include <gdal_priv.h>
13 #include <gdal_rat.h>
14 #include "IH5.h"
15 
16 
17 namespace isce3 {
18 namespace io {
19 
20 /************************************************************************/
21 /* IH5Dataset */
22 /************************************************************************/
23 
26 class IH5Dataset final: public GDALDataset
27 {
28  CPL_DISALLOW_COPY_ASSIGN(IH5Dataset)
29 
30  friend class IH5RasterBand;
31 
32  //Standard stuff expected from all formats
33  int bGeoTransformSet;
34  double adfGeoTransform[6];
35 
36  char *pszProjection;
37  CPLString pszGCPProjection;
38  GDAL_GCP *pasGCPList;
39  int nGCPCount;
40  OGRSpatialReference oSRS;
41 
42  //IDataSet from Francois's IH5
43  isce3::io::IDataSet* _dataset;
44  H5::DataType nativeType;
45  H5::DataType actualType;
46  int ndims;
47  int dimensions[3];
48  int chunks[3];
49 
50  protected:
51  CPLErr populateFromDataset();
52 
53  public:
55  IH5Dataset(const hid_t &inputds, GDALAccess eAccess);
56 
58  virtual ~IH5Dataset();
59 
60 #if GDAL_VERSION_MAJOR == 2
61  virtual const char *GetProjectionRef() override;
62  virtual CPLErr SetProjection( const char * ) override;
63  virtual const char *GetGCPProjection() override;
64  virtual CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
65  const char *pszGCPProjection ) override;
66 #elif GDAL_VERSION_MAJOR == 3
67  //https://github.com/OSGeo/gdal/blob/master/gdal/MIGRATION_GUIDE.TXT
68  const char *_GetProjectionRef() override;
69  const OGRSpatialReference* GetSpatialRef() const override {
70  return GetSpatialRefFromOldGetProjectionRef();
71  }
72 
73  CPLErr _SetProjection( const char * ) override;
74  CPLErr SetSpatialRef(const OGRSpatialReference* poSRS) override {
75  return OldSetProjectionFromSetSpatialRef(poSRS);
76  }
77 
78  const char* _GetGCPProjection() override;
79  const OGRSpatialReference* GetGCPSpatialRef() const override {
80  return GetGCPSpatialRefFromOldGetGCPProjection();
81  }
82 
83  CPLErr _SetGCPs(int nGCPCount, const GDAL_GCP *pasGCPList, const char *pszGCPProjection) override;
84  using GDALDataset::SetGCPs;
85  CPLErr SetGCPs( int nGCPCount, const GDAL_GCP *pasGCPList,
86  const OGRSpatialReference* poSRS ) override {
87  return OldSetGCPsFromNew(nGCPCount, pasGCPList, poSRS);
88  }
89 #endif
90 
91  virtual int GetGCPCount() override;
92  virtual const GDAL_GCP *GetGCPs() override;
93 
94  void *GetInternalHandle (const char *) override;
95 
96  virtual CPLErr GetGeoTransform( double *padfTransform ) override;
97  virtual CPLErr SetGeoTransform( double * ) override;
98  static GDALDataset *Open(GDALOpenInfo *info);
99  static int Identify(GDALOpenInfo *info);
100 };
101 
102 
103 /************************************************************************/
104 /* IH5RasterBand */
105 /************************************************************************/
106 
108 class IH5RasterBand : public GDALPamRasterBand
109 {
110  protected:
111  friend class IH5Dataset;
112  bool bNoDataSet;
113  double dfNoData;
114 
115  public:
116  IH5RasterBand(IH5Dataset *ds, int band,
117  GDALDataType eTypeIn);
118 
119  virtual ~IH5RasterBand();
120 
121  virtual CPLErr IReadBlock( int, int, void * ) override;
122  virtual CPLErr IWriteBlock( int, int, void * ) override;
123  virtual double GetNoDataValue( int *pbSuccess = nullptr ) override;
124  virtual CPLErr SetNoDataValue( double ) override;
125 };
126 
127 
129 void GDALRegister_IH5();
130 
131 }} // namespace isce3::io
void GDALRegister_IH5()
Function to register driver with GDAL.
Definition: IH5Dataset.cpp:784
IH5 interface to GDAL Dataset to allow read/write to HDF5 datasets from ISCE.
Definition: IH5Dataset.h:26
Raster band of an IH5 Dataset derived from GDALPamRasterBand.
Definition: IH5Dataset.h:108
IH5Dataset(const hid_t &inputds, GDALAccess eAccess)
Empty constructor.
Definition: IH5Dataset.cpp:290
Our derived dataset structure that includes utility functions.
Definition: IH5.h:44
virtual ~IH5Dataset()
Destructor.
Definition: IH5Dataset.cpp:347

Generated for ISCE3.0 by doxygen 1.8.5.