bool QgsPostgresFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod ) { // setup simplification of geometries to fetch if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && !simplifyMethod.forceLocalOptimization() ) { QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType(); if ( methodType == QgsSimplifyMethod::OptimizeForRendering || methodType == QgsSimplifyMethod::PreserveTopology ) { return true; } else { QgsDebugMsg( QString( "Simplification method type (%1) is not recognised by PostgresFeatureIterator" ).arg( methodType ) ); } } return QgsAbstractFeatureIterator::prepareSimplification( simplifyMethod ); }
bool QgsOgrFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod ) { delete mGeometrySimplifier; mGeometrySimplifier = NULL; // setup simplification of OGR-geometries fetched if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && !simplifyMethod.forceLocalOptimization() ) { QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType(); Q_UNUSED( methodType ); #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 ) { mGeometrySimplifier = new QgsOgrTopologyPreservingSimplifier( simplifyMethod.tolerance() ); return true; } #endif QgsDebugMsg( QString( "Simplification method type (%1) is not recognised by OgrFeatureIterator class" ).arg( methodType ) ); } return QgsAbstractFeatureIterator::prepareSimplification( simplifyMethod ); }
bool QgsAbstractFeatureIterator::prepareSimplification( const QgsSimplifyMethod& simplifyMethod ) { mLocalSimplification = false; delete mGeometrySimplifier; mGeometrySimplifier = NULL; // setup the simplification of geometries to fetch if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && ( simplifyMethod.forceLocalOptimization() || !providerCanSimplify( simplifyMethod.methodType() ) ) ) { mGeometrySimplifier = QgsSimplifyMethod::createGeometrySimplifier( simplifyMethod ); mLocalSimplification = mGeometrySimplifier != NULL; return mLocalSimplification; } return false; }