Skip to content

Commit b662077

Browse files
committedDec 17, 2012
Removed GDAL dependencies where easily possible
1 parent d435bfc commit b662077

File tree

10 files changed

+32
-53
lines changed

10 files changed

+32
-53
lines changed
 

‎src/core/raster/qgsrasterblock.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -527,34 +527,33 @@ QByteArray QgsRasterBlock::valueBytes( QGis::DataType theDataType, double theVal
527527
QByteArray ba;
528528
ba.resize(( int )size );
529529
char * data = ba.data();
530-
unsigned char uc;
531-
unsigned short us;
532-
short s;
533-
unsigned int ui;
534-
int i;
530+
quint8 uc;
531+
quint16 us;
532+
qint16 s;
533+
quint32 ui;
534+
qint32 i;
535535
float f;
536536
double d;
537-
// TODO: define correct data types (typedef) like in GDAL
538537
switch ( theDataType )
539538
{
540539
case QGis::Byte:
541-
uc = ( unsigned char )theValue;
540+
uc = ( quint8 )theValue;
542541
memcpy( data, &uc, size );
543542
break;
544543
case QGis::UInt16:
545-
us = ( unsigned short )theValue;
544+
us = ( quint16 )theValue;
546545
memcpy( data, &us, size );
547546
break;
548547
case QGis::Int16:
549-
s = ( short )theValue;
548+
s = ( qint16 )theValue;
550549
memcpy( data, &s, size );
551550
break;
552551
case QGis::UInt32:
553-
ui = ( unsigned int )theValue;
552+
ui = ( quint32 )theValue;
554553
memcpy( data, &ui, size );
555554
break;
556555
case QGis::Int32:
557-
i = ( int )theValue;
556+
i = ( qint32 )theValue;
558557
memcpy( data, &i, size );
559558
break;
560559
case QGis::Float32:

‎src/core/raster/qgsrasterblock.h

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
#include "qgslogger.h"
2525
#include "qgsrectangle.h"
2626

27-
#include "gdal.h" // only for data types for now
28-
2927
/** \ingroup core
3028
* Raster data container.
3129
*/
@@ -332,19 +330,19 @@ inline double QgsRasterBlock::readValue( void *data, QGis::DataType type, size_t
332330
switch ( type )
333331
{
334332
case QGis::Byte:
335-
return ( double )(( GByte * )data )[index];
333+
return ( double )(( quint8 * )data )[index];
336334
break;
337335
case QGis::UInt16:
338-
return ( double )(( GUInt16 * )data )[index];
336+
return ( double )(( quint16 * )data )[index];
339337
break;
340338
case QGis::Int16:
341-
return ( double )(( GInt16 * )data )[index];
339+
return ( double )(( qint16 * )data )[index];
342340
break;
343341
case QGis::UInt32:
344-
return ( double )(( GUInt32 * )data )[index];
342+
return ( double )(( quint32 * )data )[index];
345343
break;
346344
case QGis::Int32:
347-
return ( double )(( GInt32 * )data )[index];
345+
return ( double )(( qint32 * )data )[index];
348346
break;
349347
case QGis::Float32:
350348
return ( double )(( float * )data )[index];
@@ -369,19 +367,19 @@ inline void QgsRasterBlock::writeValue( void *data, QGis::DataType type, size_t
369367
switch ( type )
370368
{
371369
case QGis::Byte:
372-
(( GByte * )data )[index] = ( GByte ) value;
370+
(( quint8 * )data )[index] = ( quint8 ) value;
373371
break;
374372
case QGis::UInt16:
375-
(( GUInt16 * )data )[index] = ( GUInt16 ) value;
373+
(( quint16 * )data )[index] = ( quint16 ) value;
376374
break;
377375
case QGis::Int16:
378-
(( GInt16 * )data )[index] = ( GInt16 ) value;
376+
(( qint16 * )data )[index] = ( qint16 ) value;
379377
break;
380378
case QGis::UInt32:
381-
(( GUInt32 * )data )[index] = ( GUInt32 ) value;
379+
(( quint32 * )data )[index] = ( quint32 ) value;
382380
break;
383381
case QGis::Int32:
384-
(( GInt32 * )data )[index] = ( GInt32 ) value;
382+
(( qint32 * )data )[index] = ( qint32 ) value;
385383
break;
386384
case QGis::Float32:
387385
(( float * )data )[index] = ( float ) value;

‎src/core/raster/qgsrasterfilewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include <QTextStream>
2727
#include <QMessageBox>
2828

29-
#include "gdal.h"
30-
3129
QgsRasterFileWriter::QgsRasterFileWriter( const QString& outputUrl ):
3230
mOutputUrl( outputUrl ), mOutputProviderKey( "gdal" ), mOutputFormat( "GTiff" ),
3331
mTiledMode( false ), mMaxTileWidth( 500 ), mMaxTileHeight( 500 ),
@@ -726,6 +724,7 @@ void QgsRasterFileWriter::buildPyramids( const QString& filename )
726724
}
727725
}
728726

727+
#if 0
729728
int QgsRasterFileWriter::pyramidsProgress( double dfComplete, const char *pszMessage, void* pData )
730729
{
731730
Q_UNUSED( pszMessage );
@@ -743,6 +742,7 @@ int QgsRasterFileWriter::pyramidsProgress( double dfComplete, const char *pszMes
743742
}
744743
return 1;
745744
}
745+
#endif
746746

747747
void QgsRasterFileWriter::createVRT( int xSize, int ySize, const QgsCoordinateReferenceSystem& crs, double* geoTransform )
748748
{

‎src/core/raster/qgsrasterfilewriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class CORE_EXPORT QgsRasterFileWriter
116116
void addToVRT( const QString& filename, int band, int xSize, int ySize, int xOffset, int yOffset );
117117
void buildPyramids( const QString& filename );
118118

119-
static int pyramidsProgress( double dfComplete, const char *pszMessage, void* pData );
119+
//static int pyramidsProgress( double dfComplete, const char *pszMessage, void* pData );
120120

121121
/**Create provider and datasource for a part image (vrt mode)*/
122122
QgsRasterDataProvider* createPartProvider( const QgsRectangle& extent, int nCols, int iterCols, int iterRows,

‎src/core/raster/qgsrasterinterface.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
#include "qgsrasterblock.h"
2727
#include "qgsrectangle.h"
2828

29-
#include "gdal.h"
30-
3129
/** \ingroup core
3230
* Base class for processing modules.
3331
*/

‎src/gui/qgsrasterpyramidsoptionswidget.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
#include "qgslogger.h"
2020
#include "qgsdialog.h"
2121

22-
#include "gdal.h"
23-
#include "cpl_string.h"
24-
#include "cpl_conv.h"
25-
#include "cpl_minixml.h"
26-
2722
#include <QSettings>
2823
#include <QInputDialog>
2924
#include <QMessageBox>

‎src/plugins/grass/qgsgrassmodule.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extern "C"
5151
#include <grass/glocale.h>
5252
}
5353

54-
#include <gdal.h> // to collect version information
54+
//#include <gdal.h> // to collect version information
5555

5656
bool QgsGrassModule::mExecPathInited = 0;
5757
QStringList QgsGrassModule::mExecPath;

‎src/providers/wcs/qgswcsprovider.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@
6060
#include "cpl_conv.h"
6161
#include "cpl_string.h"
6262

63+
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
64+
#define TO8F(x) (x).toUtf8().constData()
65+
#define FROM8(x) QString::fromUtf8(x)
66+
#else
67+
#define TO8F(x) QFile::encodeName( x ).constData()
68+
#define FROM8(x) QString::fromLocal8Bit(x)
69+
#endif
70+
6371
#define ERR(message) QGS_ERROR_MESSAGE(message,"WCS provider")
6472
#define SRVERR(message) QGS_ERROR_MESSAGE(message,"WCS server")
6573

‎src/providers/wcs/qgswcsprovider.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ class QNetworkRequest;
4545
#define CPL_SUPRESS_CPLUSPLUS
4646
#include <gdal.h>
4747

48-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
49-
#define TO8F(x) (x).toUtf8().constData()
50-
#define FROM8(x) QString::fromUtf8(x)
51-
#else
52-
#define TO8F(x) QFile::encodeName( x ).constData()
53-
#define FROM8(x) QString::fromLocal8Bit(x)
54-
#endif
55-
5648
/**
5749
5850
\brief Data provider for OGC WCS layers.

‎src/providers/wcs/qgswcssourceselect.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@
2727

2828
#include <QWidget>
2929

30-
#define CPL_SUPRESS_CPLUSPLUS
31-
#include <gdal.h>
32-
33-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
34-
#define TO8F(x) (x).toUtf8().constData()
35-
#define FROM8(x) QString::fromUtf8(x)
36-
#else
37-
#define TO8F(x) QFile::encodeName( x ).constData()
38-
#define FROM8(x) QString::fromLocal8Bit(x)
39-
#endif
40-
4130
QgsWCSSourceSelect::QgsWCSSourceSelect( QWidget * parent, Qt::WFlags fl, bool managerMode, bool embeddedMode )
4231
: QgsOWSSourceSelect( "WCS", parent, fl, managerMode, embeddedMode )
4332
{

0 commit comments

Comments
 (0)
Please sign in to comment.