@@ -402,25 +402,19 @@ void QgsMapRendererJob::drawOldLabeling( const QgsMapSettings& settings, QgsRend
402
402
if ( ml->hasScaleBasedVisibility () && ( settings.scale () < ml->minimumScale () || settings.scale () > ml->maximumScale () ) )
403
403
continue ;
404
404
405
- bool split = false ;
406
405
const QgsCoordinateTransform* ct = 0 ;
407
406
QgsRectangle r1 = settings.visibleExtent (), r2;
408
407
409
408
if ( settings.hasCrsTransformEnabled () )
410
409
{
411
410
ct = QgsCoordinateTransformCache::instance ()->transform ( ml->crs ().authid (), settings.destinationCrs ().authid () );
412
- split = reprojectToLayerExtent ( ct, ml->crs ().geographicFlag (), r1, r2 );
411
+ reprojectToLayerExtent ( ct, ml->crs ().geographicFlag (), r1, r2 );
413
412
}
414
413
415
414
renderContext.setCoordinateTransform ( ct );
416
415
renderContext.setExtent ( r1 );
417
416
418
417
ml->drawLabels ( renderContext );
419
- if ( split )
420
- {
421
- renderContext.setExtent ( r2 );
422
- ml->drawLabels ( renderContext );
423
- }
424
418
}
425
419
}
426
420
@@ -498,10 +492,14 @@ bool QgsMapRendererJob::reprojectToLayerExtent( const QgsCoordinateTransform* ct
498
492
499
493
if ( ll.x () > ur.x () )
500
494
{
501
- r2 = extent;
502
- extent.setXMinimum ( splitCoord );
503
- r2.setXMaximum ( splitCoord );
504
- split = true ;
495
+ // the coordinates projected in reverse order than what one would expect.
496
+ // we are probably looking at an area that includes longitude of 180 degrees.
497
+ // we need to take into account coordinates from two intervals: (-180,x1) and (x2,180)
498
+ // so let's use (-180,180). This hopefully does not add too much overhead. It is
499
+ // more straightforward than rendering with two separate extents and more consistent
500
+ // for rendering, labeling and caching as everything is rendered just in one go
501
+ extent.setXMinimum ( -splitCoord );
502
+ extent.setXMaximum ( splitCoord );
505
503
}
506
504
}
507
505
else // can't cross 180
@@ -574,8 +572,7 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin
574
572
{
575
573
ct = QgsCoordinateTransformCache::instance ()->transform ( ml->crs ().authid (), mSettings .destinationCrs ().authid () );
576
574
reprojectToLayerExtent ( ct, ml->crs ().geographicFlag (), r1, r2 );
577
- QgsDebugMsg ( " extent 1: " + r1.toString () );
578
- QgsDebugMsg ( " extent 2: " + r2.toString () );
575
+ QgsDebugMsg ( " extent: " + r1.toString () );
579
576
if ( !r1.isFinite () || !r2.isFinite () )
580
577
{
581
578
mErrors .append ( Error ( layerId, " There was a problem transforming layer's' extent. Layer skipped." ) );
@@ -649,14 +646,6 @@ LayerRenderJobs QgsMapRendererJob::prepareJobs( QPainter* painter, QgsPalLabelin
649
646
}
650
647
}
651
648
652
- #if 0
653
- // TODO: split extent
654
- if ( split )
655
- {
656
- mRenderContext.setExtent( r2 );
657
- ml->draw( mRenderContext );
658
- }
659
- #endif
660
649
} // while (li.hasPrevious())
661
650
662
651
return layerJobs;
0 commit comments