@@ -473,37 +473,20 @@ bool QgsTracer::initGraph()
473
473
474
474
t1.start ();
475
475
int featuresCounted = 0 ;
476
- Q_FOREACH ( QgsVectorLayer *vl, mLayers )
476
+ for ( QgsVectorLayer *vl : qgis::as_const ( mLayers ) )
477
477
{
478
- Q_NOWARN_DEPRECATED_PUSH
479
- QgsCoordinateTransform ct ( vl->crs (), mCRS );
480
- Q_NOWARN_DEPRECATED_POP
481
-
482
478
QgsFeatureRequest request;
483
479
request.setSubsetOfAttributes ( QgsAttributeList () );
480
+ request.setDestinationCrs ( mCRS , mTransformContext );
484
481
if ( !mExtent .isEmpty () )
485
- request.setFilterRect ( ct. transformBoundingBox ( mExtent , QgsCoordinateTransform::ReverseTransform ) );
482
+ request.setFilterRect ( mExtent );
486
483
487
484
QgsFeatureIterator fi = vl->getFeatures ( request );
488
485
while ( fi.nextFeature ( f ) )
489
486
{
490
487
if ( !f.hasGeometry () )
491
488
continue ;
492
489
493
- if ( !ct.isShortCircuited () )
494
- {
495
- try
496
- {
497
- QgsGeometry transformedGeom = f.geometry ();
498
- transformedGeom.transform ( ct );
499
- f.setGeometry ( transformedGeom );
500
- }
501
- catch ( QgsCsException & )
502
- {
503
- continue ; // ignore if the transform failed
504
- }
505
- }
506
-
507
490
extractLinework ( f.geometry (), mpl );
508
491
509
492
++featuresCounted;
@@ -596,12 +579,10 @@ void QgsTracer::setLayers( const QList<QgsVectorLayer *> &layers )
596
579
invalidateGraph ();
597
580
}
598
581
599
- void QgsTracer::setDestinationCrs ( const QgsCoordinateReferenceSystem &crs )
582
+ void QgsTracer::setDestinationCrs ( const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context )
600
583
{
601
- if ( mCRS == crs )
602
- return ;
603
-
604
584
mCRS = crs;
585
+ mTransformContext = context;
605
586
invalidateGraph ();
606
587
}
607
588
0 commit comments