Skip to content
Permalink
Browse files
Fixes #37945 : Take tile_buffer parameter into consideration when
rendering labels
  • Loading branch information
troopa81 authored and github-actions committed Jul 6, 2021
1 parent d046e8f commit d73ee555f72257ee2e100b3d146d8f2cc0927193
@@ -443,7 +443,10 @@ bool QgsPalLayerSettings::prepare( QgsRenderContext &context, QSet<QString> &att
ptOne = xform->toMapCoordinates( 1, 0 );

// rect for clipping
extentGeom = QgsGeometry::fromRect( mapSettings.visibleExtent() );
QgsRectangle r1 = mapSettings.visibleExtent();
r1.grow( mapSettings.extentBuffer() );
extentGeom = QgsGeometry::fromRect( r1 );

if ( !qgsDoubleNear( mapSettings.rotation(), 0.0 ) )
{
//PAL features are prerotated, so extent also needs to be unrotated
@@ -616,7 +616,11 @@ LabelRenderJob QgsMapRendererJob::prepareLabelingJob( QPainter *painter, QgsLabe
job.context = QgsRenderContext::fromMapSettings( mSettings );
job.context.setPainter( painter );
job.context.setLabelingEngine( labelingEngine2 );

QgsRectangle r1 = mSettings.visibleExtent();
r1.grow( mSettings.extentBuffer() );
job.context.setExtent( mSettings.visibleExtent() );

job.context.setFeatureFilterProvider( mFeatureFilterProvider );

// if we can use the cache, let's do it and avoid rendering!
@@ -1768,6 +1768,44 @@ def test_wms_getmap_tile_buffer(self):
r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Tiled_True")

# Check with labels and tiled=false
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(
os.path.join(self.testdata_path, 'wms_tile_buffer.qgs')),
"SERVICE": "WMS",
"VERSION": "1.3.0",
"REQUEST": "GetMap",
"BBOX": "310187,6163153,324347,6177313",
"CRS": "EPSG:3857",
"WIDTH": "512",
"HEIGHT": "512",
"LAYERS": "wms_tile_buffer_labels",
"FORMAT": "image/png",
"TILED": "false"
}.items())])

r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Tiled_Labels_False")

# Check with labels and tiled=true
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(
os.path.join(self.testdata_path, 'wms_tile_buffer.qgs')),
"SERVICE": "WMS",
"VERSION": "1.3.0",
"REQUEST": "GetMap",
"BBOX": "310187,6163153,324347,6177313",
"CRS": "EPSG:3857",
"WIDTH": "512",
"HEIGHT": "512",
"LAYERS": "wms_tile_buffer_labels",
"FORMAT": "image/png",
"TILED": "true"
}.items())])

r, h = self._result(self._execute_request(qs))
self._img_diff_error(r, h, "WMS_GetMap_Tiled_Labels_True")

@unittest.skipIf(os.getenv('QGIS_CONTINUOUS_INTEGRATION_RUN'), "This tests fails on GH workflow")
def test_mode8bit_with_transparency(self):
# 8 bits
Binary file not shown.
Binary file not shown.

0 comments on commit d73ee55

Please sign in to comment.