Skip to content

Commit

Permalink
fix build with GDAL <=1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jan 23, 2014
1 parent 9aa4155 commit 49a807a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/providers/ogr/qgsogrfeatureiterator.cpp
Expand Up @@ -111,14 +111,16 @@ bool QgsOgrFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simp
QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType();
Q_UNUSED( methodType);

#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
{
int simplifyFlags = QgsMapToPixelSimplifier::SimplifyGeometry | QgsMapToPixelSimplifier::SimplifyEnvelope;
mGeometrySimplifier = new QgsOgrMapToPixelSimplifier( simplifyFlags, simplifyMethod.tolerance() );
return true;
}
#endif
#endif
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1900
if ( methodType == QgsSimplifyMethod::PreserveTopology )
{
Expand All @@ -134,12 +136,14 @@ bool QgsOgrFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simp

bool QgsOgrFeatureIterator::providerCanSimplify( QgsSimplifyMethod::MethodType methodType ) const
{
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
{
return true;
}
#endif
#endif
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1900
if ( methodType == QgsSimplifyMethod::PreserveTopology )
{
Expand Down
8 changes: 5 additions & 3 deletions src/providers/ogr/qgsogrgeometrysimplifier.cpp
Expand Up @@ -56,11 +56,12 @@ bool QgsOgrTopologyPreservingSimplifier::simplifyGeometry( OGRGeometryH geometry

return true;
}
#endif
#endif // GDAL_VERSION_NUM >= 1900

/***************************************************************************/

#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)

QgsOgrMapToPixelSimplifier::QgsOgrMapToPixelSimplifier( int simplifyFlags, double map2pixelTol )
: QgsMapToPixelSimplifier( simplifyFlags, map2pixelTol )
Expand Down Expand Up @@ -269,4 +270,5 @@ bool QgsOgrMapToPixelSimplifier::simplifyGeometry( OGRGeometryH geometry )
return false;
}

#endif
#endif // GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
#endif // defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
6 changes: 4 additions & 2 deletions src/providers/ogr/qgsogrgeometrysimplifier.h
Expand Up @@ -52,7 +52,8 @@ class QgsOgrTopologyPreservingSimplifier : public QgsOgrAbstractGeometrySimplifi
};
#endif

#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
/**
* OGR implementation of GeometrySimplifier using the "MapToPixel" algorithm
*
Expand Down Expand Up @@ -88,6 +89,7 @@ class QgsOgrMapToPixelSimplifier : public QgsOgrAbstractGeometrySimplifier, QgsM
//! Simplifies the specified geometry
virtual bool simplifyGeometry( OGRGeometryH geometry );
};
#endif
#endif // GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
#endif // defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)

#endif // QGSOGRGEOMETRYSIMPLIFIER_H
4 changes: 3 additions & 1 deletion src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -1495,9 +1495,11 @@ int QgsOgrProvider::capabilities() const
}

// supports geometry simplification on provider side
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION) && GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
#if defined(GDAL_VERSION_NUM) && defined(GDAL_COMPUTE_VERSION)
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(1,11,0)
ability |= QgsVectorDataProvider::SimplifyGeometries;
#endif
#endif
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1900
ability |= QgsVectorDataProvider::SimplifyGeometriesWithTopologicalValidation;
#endif
Expand Down

0 comments on commit 49a807a

Please sign in to comment.