@@ -148,6 +148,27 @@ bool QgsOracleFeatureIterator::nextFeatureFilterExpression( QgsFeature& f )
148
148
return fetchFeature ( f );
149
149
}
150
150
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
+
151
172
bool QgsOracleFeatureIterator::fetchFeature ( QgsFeature& feature )
152
173
{
153
174
feature.setValid ( false );
@@ -316,7 +337,20 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause )
316
337
317
338
if (( mRequest .flags () & QgsFeatureRequest::NoGeometry ) == 0 && !mSource ->mGeometryColumn .isNull () )
318
339
{
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
+ }
320
354
delim = " ," ;
321
355
}
322
356
@@ -377,6 +411,11 @@ bool QgsOracleFeatureIterator::openQuery( QString whereClause )
377
411
return true ;
378
412
}
379
413
414
+ bool QgsOracleFeatureIterator::providerCanSimplify ( QgsSimplifyMethod::MethodType methodType ) const
415
+ {
416
+ return methodType == QgsSimplifyMethod::OptimizeForRendering;
417
+ }
418
+
380
419
// -----------
381
420
382
421
QgsOracleFeatureSource::QgsOracleFeatureSource ( const QgsOracleProvider* p )
0 commit comments