Class: QgsMapClippingUtils¶
- class qgis.core.QgsMapClippingUtils¶
Bases:
sip.wrapper
Utility functions for use when clipping map renders.
New in version 3.16:
Methods
Returns the geometry representing the intersection of clipping
regions
fromcontext
which should be used to clip individual feature geometries prior to rendering.Returns the geometry representing the intersection of clipping
regions
fromcontext
.Returns the geometry representing the intersection of clipping
regions
fromcontext
which should be used to clip individual feature geometries while registering them with labeling engines.Returns a QPainterPath representing the intersection of clipping
regions
fromcontext
which should be used to clip the painter during rendering of a layer of the specifiedlayerType
.Collects the list of map clipping regions from a
context
which apply to a maplayer
.- calculateFeatureIntersectionGeometry(regions: Iterable[QgsMapClippingRegion], context: QgsRenderContext) Tuple[QgsGeometry, bool] ¶
Returns the geometry representing the intersection of clipping
regions
fromcontext
which should be used to clip individual feature geometries prior to rendering.The returned geometry will be automatically reprojected into the same CRS as the source layer, ready for use for clipping features.
- Parameters
regions (Iterable[QgsMapClippingRegion]) – list of clip regions which apply to the layer
context (QgsRenderContext) – a render context
shouldClip – will be set to
True
if layer’s features should be filtered, i.e. one or more clipping regions applies to the layer
- Return type
Tuple[
QgsGeometry
, bool]- Returns
combined clipping region for use when rendering features
- calculateFeatureRequestGeometry(regions: Iterable[QgsMapClippingRegion], context: QgsRenderContext) Tuple[QgsGeometry, bool] ¶
Returns the geometry representing the intersection of clipping
regions
fromcontext
.The returned geometry will be automatically reprojected into the same CRS as the source layer, ready for use for filtering a feature request.
- Parameters
regions (Iterable[QgsMapClippingRegion]) – list of clip regions which apply to the layer
context (QgsRenderContext) – a render context
shouldFilter – will be set to
True
if layer’s features should be filtered, i.e. one or more clipping regions applies to the layer
- Return type
Tuple[
QgsGeometry
, bool]- Returns
combined clipping region for use when filtering features to render
- calculateLabelIntersectionGeometry(regions: Iterable[QgsMapClippingRegion], context: QgsRenderContext) Tuple[QgsGeometry, bool] ¶
Returns the geometry representing the intersection of clipping
regions
fromcontext
which should be used to clip individual feature geometries while registering them with labeling engines.The returned geometry will be automatically reprojected into the same CRS as the source layer, ready for use for clipping features.
- Parameters
regions (Iterable[QgsMapClippingRegion]) – list of clip regions which apply to the layer
context (QgsRenderContext) – a render context
shouldClip – will be set to
True
if layer’s features should be clipped for labeling, i.e. one or more clipping regions applies to the layer
- Return type
Tuple[
QgsGeometry
, bool]- Returns
combined clipping region for use when labeling features
- calculatePainterClipRegion(regions: Iterable[QgsMapClippingRegion], context: QgsRenderContext, layerType: QgsMapLayerType) Tuple[QPainterPath, bool] ¶
Returns a QPainterPath representing the intersection of clipping
regions
fromcontext
which should be used to clip the painter during rendering of a layer of the specifiedlayerType
.The returned coordinates are in painter coordinates for the destination
context
.- Parameters
regions (Iterable[QgsMapClippingRegion]) – list of clip regions which apply to the layer
context (QgsRenderContext) – a render context
shouldClip – will be set to
True
if the clipping path should be appliedlayerType (QgsMapLayerType) –
- Return type
Tuple[QPainterPath, bool]
- Returns
combined painter clipping region for use when rendering maps
- collectClippingRegionsForLayer(context: QgsRenderContext, layer: QgsMapLayer) List[QgsMapClippingRegion] ¶
Collects the list of map clipping regions from a
context
which apply to a maplayer
.- Parameters
context (QgsRenderContext) –
layer (QgsMapLayer) –
- Return type
List[QgsMapClippingRegion]