-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsgdalproviderbase.h
60 lines (44 loc) · 2.44 KB
/
qgsgdalproviderbase.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/***************************************************************************
qgsgdalproviderbase.h - Common base class for GDAL and WCS provider
-------------------
begin : November, 2010
copyright : (C) 2010 by Radim Blazek
email : radim dot blazek at gmail dot com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSGDALPROVIDERBASE_H
#define QGSGDALPROVIDERBASE_H
#include "qgsrasterdataprovider.h"
#include "qgscolorrampshader.h"
#include <QList>
#define CPL_SUPRESS_CPLUSPLUS //#spellok
#include <gdal.h>
/**
\brief Base class for GDAL and WCS providers.
*/
class QgsGdalProviderBase
{
public:
QgsGdalProviderBase();
//! \brief ensures that GDAL drivers are registered, but only once
static void registerGdalDrivers();
//! Wrapper function for GDALOpen to get around possible bugs in GDAL
static GDALDatasetH gdalOpen( const char *pszFilename, GDALAccess eAccess );
//! Wrapper function for GDALRasterIO to get around possible bugs in GDAL
static CPLErr gdalRasterIO( GDALRasterBandH hBand, GDALRWFlag eRWFlag, int nXOff, int nYOff, int nXSize, int nYSize, void *pData, int nBufXSize, int nBufYSize, GDALDataType eBufType, int nPixelSpace, int nLineSpace, QgsRasterBlockFeedback *feedback = nullptr );
//! Wrapper function for GDALRasterIO to get around possible bugs in GDAL
static int gdalGetOverviewCount( GDALRasterBandH hBand );
protected:
Qgis::DataType dataTypeFromGdal( const GDALDataType gdalDataType ) const;
int colorInterpretationFromGdal( const GDALColorInterp gdalColorInterpretation ) const;
QList<QgsColorRampShader::ColorRampItem> colorTable( GDALDatasetH gdalDataset, int bandNo )const;
QgsRectangle extent( GDALDatasetH gdalDataset ) const;
};
#endif