Skip to content

Commit b0bc763

Browse files
committed
Bump minimum GDAL version to 2.0, remove old version #ifdefs
1 parent f59acad commit b0bc763

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+18
-512
lines changed

cmake/FindGDAL.cmake

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,9 @@ ELSE(WIN32)
6161
ENDIF (NOT GDAL_VERSION)
6262
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" GDAL_VERSION_MAJOR "${GDAL_VERSION}")
6363
STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" GDAL_VERSION_MINOR "${GDAL_VERSION}")
64-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
65-
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
66-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
67-
68-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
69-
MESSAGE (WARNING "GDAL version is too old (${GDAL_VERSION}) to support GeoPackage. 1.11.0 or higher is recommended.")
70-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
64+
IF (GDAL_VERSION_MAJOR LESS 2)
65+
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
66+
ENDIF (GDAL_VERSION_MAJOR LESS 2)
7167

7268
ENDIF (GDAL_LIBRARY)
7369
SET (CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_save} CACHE STRING "" FORCE)
@@ -105,14 +101,10 @@ ELSE(WIN32)
105101

106102
# check for gdal version
107103
# version 1.2.5 is known NOT to be supported (missing CPL_STDCALL macro)
108-
# According to INSTALL, 1.4.0+ is required
109-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
110-
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 1.4.0 or higher.")
111-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 4))
112-
113-
IF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
114-
MESSAGE (WARNING "GDAL version is too old (${GDAL_VERSION}) to support GeoPackage. 1.11.0 or higher is recommended.")
115-
ENDIF (GDAL_VERSION_MAJOR LESS 1 OR (GDAL_VERSION_MAJOR EQUAL 1 AND GDAL_VERSION_MINOR LESS 11))
104+
# According to INSTALL, 2.0+ is required
105+
IF (GDAL_VERSION_MAJOR LESS 2)
106+
MESSAGE (FATAL_ERROR "GDAL version is too old (${GDAL_VERSION}). Use 2.0 or higher.")
107+
ENDIF (GDAL_VERSION_MAJOR LESS 2)
116108

117109
# set INCLUDE_DIR to prefix+include
118110
EXEC_PROGRAM(${GDAL_CONFIG}

src/analysis/raster/qgskde.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@
2323
#define M_PI 3.14159265358979323846
2424
#endif
2525

26-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
2726
#define TO8F(x) (x).toUtf8().constData()
28-
#else
29-
#define TO8F(x) QFile::encodeName( x ).constData()
30-
#endif
3127

3228
QgsKernelDensityEstimation::QgsKernelDensityEstimation( const QgsKernelDensityEstimation::Parameters& parameters, const QString& outputFile, const QString& outputFormat )
3329
: mInputLayer( parameters.vectorLayer )

src/analysis/raster/qgsninecellfilter.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@
2121
#include <QProgressDialog>
2222
#include <QFile>
2323

24-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
2524
#define TO8F(x) (x).toUtf8().constData()
26-
#else
27-
#define TO8F(x) QFile::encodeName( x ).constData()
28-
#endif
2925

3026
QgsNineCellFilter::QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
3127
: mInputFile( inputFile )

src/analysis/raster/qgsrastercalculator.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,8 @@
2929
#include <cpl_string.h>
3030
#include <gdalwarper.h>
3131

32-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
3332
#define TO8(x) (x).toUtf8().constData()
3433
#define TO8F(x) (x).toUtf8().constData()
35-
#else
36-
#define TO8(x) (x).toLocal8Bit().constData()
37-
#define TO8F(x) QFile::encodeName( x ).constData()
38-
#endif
3934

4035
QgsRasterCalculator::QgsRasterCalculator( const QString& formulaString, const QString& outputFile, const QString& outputFormat,
4136
const QgsRectangle& outputExtent, int nOutputColumns, int nOutputRows, const QVector<QgsRasterCalculatorEntry>& rasterEntries )

src/analysis/raster/qgsrelief.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
#include <QFile>
2929
#include <QTextStream>
3030

31-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
3231
#define TO8F(x) (x).toUtf8().constData()
33-
#else
34-
#define TO8F(x) QFile::encodeName( x ).constData()
35-
#endif
3632

3733
QgsRelief::QgsRelief( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
3834
: mInputFile( inputFile )

src/analysis/vector/qgszonalstatistics.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,7 @@
2828
#include <QProgressDialog>
2929
#include <QFile>
3030

31-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
3231
#define TO8F(x) (x).toUtf8().constData()
33-
#else
34-
#define TO8F(x) QFile::encodeName( x ).constData()
35-
#endif
3632

3733
QgsZonalStatistics::QgsZonalStatistics( QgsVectorLayer* polygonLayer, const QString& rasterFile, const QString& attributePrefix, int rasterBand, Statistics stats )
3834
: mRasterFilePath( rasterFile )

src/app/dwg/qgsdwgimportdialog.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,6 @@ QgsDwgImportDialog::QgsDwgImportDialog( QWidget *parent, Qt::WindowFlags f )
6969
cbMergeLayers->setChecked( s.value( "/DwgImport/lastMergeLayers", false ).toBool() );
7070
cbUseCurves->setChecked( s.value( "/DwgImport/lastUseCurves", true ).toBool() );
7171

72-
#if !defined(GDAL_COMPUTE_VERSION) || GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(2,0,0)
73-
cbUseCurves->setChecked( false );
74-
cbUseCurves->setHidden( true );
75-
#endif
76-
7772
leDrawing->setReadOnly( true );
7873
pbImportDrawing->setHidden( true );
7974
lblMessage->setHidden( true );

src/app/dwg/qgsdwgimporter.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,30 +140,26 @@ void QgsDwgImporter::startTransaction()
140140
{
141141
Q_ASSERT( mDs );
142142

143-
#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,0,0)
144143
mInTransaction = GDALDatasetStartTransaction( mDs, 0 ) == OGRERR_NONE;
145144
if ( !mInTransaction )
146145
{
147146
LOG( QObject::tr( "Could not start transaction\nDatabase:%1\nError:%2" )
148147
.arg( mDatabase )
149148
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
150149
}
151-
#endif
152150
}
153151

154152
void QgsDwgImporter::commitTransaction()
155153
{
156154
Q_ASSERT( mDs != nullptr );
157155

158-
#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,0,0)
159156
if ( mInTransaction && GDALDatasetCommitTransaction( mDs ) != OGRERR_NONE )
160157
{
161158
LOG( QObject::tr( "Could not commit transaction\nDatabase:%1\nError:%2" )
162159
.arg( mDatabase )
163160
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
164161
}
165162
mInTransaction = false;
166-
#endif
167163
}
168164

169165
QgsDwgImporter::~QgsDwgImporter()
@@ -186,13 +182,8 @@ bool QgsDwgImporter::import( const QString &drawing, QString &error, bool doExpa
186182
OGRwkbGeometryType lineGeomType, hatchGeomType;
187183
if ( useCurves )
188184
{
189-
#if !defined(GDAL_COMPUTE_VERSION) || GDAL_VERSION_NUM < GDAL_COMPUTE_VERSION(2,0,0)
190-
error = QObject::tr( "Curves only supported with GDAL2" );
191-
return false;
192-
#else
193185
lineGeomType = wkbCompoundCurveZ;
194186
hatchGeomType = wkbCurvePolygonZ;
195-
#endif
196187
}
197188
else
198189
{

src/app/ogr/qgsnewogrconnection.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@
2626
#include <ogr_api.h>
2727
#include <cpl_error.h>
2828

29-
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800
3029
#define TO8F(x) (x).toUtf8().constData()
31-
#else
32-
#define TO8F(x) QFile::encodeName( x ).constData()
33-
#endif
3430

3531
QgsNewOgrConnection::QgsNewOgrConnection( QWidget *parent, const QString& connType, const QString& connName, Qt::WindowFlags fl )
3632
: QDialog( parent, fl )

src/app/qgisapp.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@
266266
#include <gdal_version.h>
267267
#include <proj_api.h>
268268

269-
#if defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
270269
#define SUPPORT_GEOPACKAGE
271-
#endif
272270

273271
//
274272
// Other includes

0 commit comments

Comments
 (0)