@@ -148,6 +148,27 @@ bool QgsOracleFeatureIterator::nextFeatureFilterExpression( QgsFeature& f )
148148 return fetchFeature ( f );
149149}
150150
151+ bool QgsOracleFeatureIterator::prepareSimplification ( const QgsSimplifyMethod& simplifyMethod )
152+ {
153+ // setup simplification of geometries to fetch
154+ if ( !( mRequest .flags () & QgsFeatureRequest::NoGeometry ) &&
155+ simplifyMethod.methodType () != QgsSimplifyMethod::NoSimplification &&
156+ !simplifyMethod.forceLocalOptimization () )
157+ {
158+ QgsSimplifyMethod::MethodType methodType = simplifyMethod.methodType ();
159+
160+ if ( methodType == QgsSimplifyMethod::OptimizeForRendering )
161+ {
162+ return true ;
163+ }
164+ else
165+ {
166+ QgsDebugMsg ( QString ( " Simplification method type (%1) is not recognised by OracleFeatureIterator" ).arg ( methodType ) );
167+ }
168+ }
169+ return QgsAbstractFeatureIterator::prepareSimplification ( simplifyMethod );
170+ }
171+
151172bool QgsOracleFeatureIterator::fetchFeature ( QgsFeature& feature )
152173{
153174 feature.setValid ( false );
@@ -316,7 +337,20 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause )
316337
317338 if (( mRequest .flags () & QgsFeatureRequest::NoGeometry ) == 0 && !mSource ->mGeometryColumn .isNull () )
318339 {
319- query += QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn );
340+ if ( !mRequest .simplifyMethod ().forceLocalOptimization () &&
341+ mRequest .simplifyMethod ().methodType () == QgsSimplifyMethod::OptimizeForRendering &&
342+ QGis::flatType ( QGis::singleType ( mSource ->mRequestedGeomType != QGis::WKBUnknown
343+ ? mSource ->mRequestedGeomType
344+ : mSource ->mDetectedGeomType ) ) != QGis::WKBPoint )
345+ {
346+ query += QString ( " SDO_UTIL.SIMPLIFY( %1, %2 )" )
347+ .arg ( QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn ) )
348+ .arg ( mRequest .simplifyMethod ().tolerance () * 0.7 ); // -> We use a smaller tolerance than pre-filtering to be on the safe side
349+ }
350+ else
351+ {
352+ query += QgsOracleProvider::quotedIdentifier ( mSource ->mGeometryColumn );
353+ }
320354 delim = " ," ;
321355 }
322356
@@ -377,6 +411,11 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause )
377411 return true ;
378412}
379413
414+ bool QgsOracleFeatureIterator::providerCanSimplify ( QgsSimplifyMethod::MethodType methodType ) const
415+ {
416+ return methodType == QgsSimplifyMethod::OptimizeForRendering;
417+ }
418+
380419// -----------
381420
382421QgsOracleFeatureSource::QgsOracleFeatureSource ( const QgsOracleProvider* p )
0 commit comments