Class: QgsMapClippingRegion

class qgis.core.QgsMapClippingRegion(geometry: QgsGeometry)

Bases: sip.wrapper

Constructor for a map clipping region, with the specified geometry in the destination map CRS.

QgsMapClippingRegion(QgsMapClippingRegion)

A map clipping region (in map coordinates and CRS).

New in version 3.16.

Parameters

geometry

class FeatureClippingType(value)

Bases: enum.IntEnum

Feature clipping behavior, which controls how features from vector layers will be clipped.

  • ClipToIntersection: Clip the geometry of these features to the region prior to rendering (i.e. feature boundaries will follow the clip region)

  • ClipPainterOnly: Applying clipping on the painter only (i.e. feature boundaries will be unchanged, but may be invisible where the feature falls outside the clipping region)

  • NoClipping: Only render features which intersect the clipping region, but do not clip these features to the region

ClipPainterOnly = 1
ClipToIntersection = 0
NoClipping = 2
appliesToLayer(self, layer: QgsMapLayer) → bool

Returns True if the clipping region should be applied to the specified map layer.

Parameters

layer (QgsMapLayer) –

Return type

bool

featureClip(self)QgsMapClippingRegion.FeatureClippingType

Returns the feature clipping type.

This setting is only used while rendering vector layers, for other layer types it is ignored.

See also

setFeatureClip()

Return type

QgsMapClippingRegion.FeatureClippingType

geometry(self)QgsGeometry

Returns the geometry of the clipping region (in the destination map CRS).

See also

setGeometry()

Return type

QgsGeometry

restrictToLayers(self) → bool

Returns True if clipping should be restricted to a subset of layers.

Return type

bool

restrictedLayers(self) → List[QgsMapLayer]

Returns the list of layers to restrict the clipping region effects to.

If the list is empty then the clipping will be applied to all layers.

Note

This setting is only used if restrictToLayers() is True.

Return type

List[QgsMapLayer]

setFeatureClip(self, type: QgsMapClippingRegion.FeatureClippingType)

Sets the feature clipping type.

This setting is only used while rendering vector layers, for other layer types it is ignored.

See also

featureClip()

Parameters

type (QgsMapClippingRegion.FeatureClippingType) –

setGeometry(self, geometry: QgsGeometry)

Sets the clipping region geometry (in the destination map CRS).

See also

geometry()

Parameters

geometry (QgsGeometry) –

setRestrictToLayers(self, enabled: bool)

Sets whether clipping should be restricted to a subset of layers.

Parameters

enabled (bool) –

setRestrictedLayers(self, layers: Iterable[QgsMapLayer])

Sets a list of layers to restrict the clipping region effects to.

By default the clipping region applies to all layers.

Note

This setting is only used if restrictToLayers() is True.

Parameters

layers (Iterable[QgsMapLayer]) –