Skip to content

Commit 49a807a

Browse files
committed
fix build with GDAL <=1.9
1 parent 9aa4155 commit 49a807a

4 files changed

+18
-8
lines changed

src/providers/ogr/qgsogrfeatureiterator.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,16 @@ bool QgsOgrFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simp
111111
QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType();
112112
Q_UNUSED( methodType);
113113

114-
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
114+
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
115+
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
115116
if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
116117
{
117118
int simplifyFlags = QgsMapToPixelSimplifier::SimplifyGeometry | QgsMapToPixelSimplifier::SimplifyEnvelope;
118119
mGeometrySimplifier = new QgsOgrMapToPixelSimplifier( simplifyFlags, simplifyMethod.tolerance() );
119120
return true;
120121
}
121122
#endif
123+
#endif
122124
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1900
123125
if ( methodType == QgsSimplifyMethod::PreserveTopology )
124126
{
@@ -134,12 +136,14 @@ bool QgsOgrFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simp
134136

135137
bool QgsOgrFeatureIterator::providerCanSimplify( QgsSimplifyMethod::MethodType methodType ) const
136138
{
137-
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
139+
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
140+
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
138141
if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
139142
{
140143
return true;
141144
}
142145
#endif
146+
#endif
143147
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1900
144148
if ( methodType == QgsSimplifyMethod::PreserveTopology )
145149
{

src/providers/ogr/qgsogrgeometrysimplifier.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ bool QgsOgrTopologyPreservingSimplifier::simplifyGeometry( OGRGeometryH geometry
5656

5757
return true;
5858
}
59-
#endif
59+
#endif // GDAL_VERSION_NUM >= 1900
6060

6161
/***************************************************************************/
6262

63-
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
63+
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
64+
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
6465

6566
QgsOgrMapToPixelSimplifier::QgsOgrMapToPixelSimplifier( int simplifyFlags, double map2pixelTol )
6667
: QgsMapToPixelSimplifier( simplifyFlags, map2pixelTol )
@@ -269,4 +270,5 @@ bool QgsOgrMapToPixelSimplifier::simplifyGeometry( OGRGeometryH geometry )
269270
return false;
270271
}
271272

272-
#endif
273+
#endif // GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
274+
#endif // defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)

src/providers/ogr/qgsogrgeometrysimplifier.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class QgsOgrTopologyPreservingSimplifier : public QgsOgrAbstractGeometrySimplifi
5252
};
5353
#endif
5454

55-
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
55+
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
56+
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
5657
/**
5758
* OGR implementation of GeometrySimplifier using the "MapToPixel" algorithm
5859
*
@@ -88,6 +89,7 @@ class QgsOgrMapToPixelSimplifier : public QgsOgrAbstractGeometrySimplifier, QgsM
8889
//! Simplifies the specified geometry
8990
virtual bool simplifyGeometry( OGRGeometryH geometry );
9091
};
91-
#endif
92+
#endif // GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
93+
#endif // defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
9294

9395
#endif // QGSOGRGEOMETRYSIMPLIFIER_H

src/providers/ogr/qgsogrprovider.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -1495,9 +1495,11 @@ int QgsOgrProvider::capabilities() const
14951495
}
14961496

14971497
// supports geometry simplification on provider side
1498-
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
1498+
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
1499+
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
14991500
ability |= QgsVectorDataProvider::SimplifyGeometries;
15001501
#endif
1502+
#endif
15011503
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1900
15021504
ability |= QgsVectorDataProvider::SimplifyGeometriesWithTopologicalValidation;
15031505
#endif

0 commit comments

Comments
 (0)