Project: QGIS

Version: 3.16

Feature: Add API to QgsMapSettings for specifying clipping regions to apply while rendering maps

This is currently API only functionality, but functionality has been added which provide the backend capabilities to specify clipping regions which may be used during map render operations.

Although primarily introduced in order to provide functionality which allows the automatic clipping of map elements to the current atlas feature geometry in print layouts, the API has been deliberately implemented in a manner that's very flexible to allow various use cases which require the clipping of regions during map render operations.

For non-vector layers, the clipping is applied through a QPainter clipping path. For vector layers, the API exposes various options in how the clipping should be applied:

  1. As an "intersects" style test only: All vector features which intersect the path are rendered, without actually clipping the feature's geometry

  2. By modifying the feature's geometry and clipping the geometry to the region: Any stroke or outline settings for the symbol will be rendered along the boundary of the clipping region, even if the feature actually partially falls outside this region.

or

  1. Using a painter clip path: Features are clipped to the region, but only at painter time. Boundaries of the feature which fall outside the clip region will not be visible.

This feature was funded by City of Canning

This feature was developed by Nyall Dawson