Class: QgsLabelingEngineContext

Encapsulates the context for a labeling engine run.

Added in version 3.40.

Methods

extent

Returns the map extent defining the limits for labeling.

mapBoundaryGeometry

Returns the map label boundary geometry, which defines the limits within which labels may be placed in the map.

renderContext

Returns a reference to the context's render context.

setExtent

Sets the map extent defining the limits for labeling.

setMapBoundaryGeometry

Sets the map label boundary geometry, which defines the limits within which labels may be placed in the map.

class qgis.core.QgsLabelingEngineContext[source]

Bases: object

__init__(renderContext: QgsRenderContext)

Constructor for QgsLabelingEngineContext.

Parameters:

renderContext (QgsRenderContext)

extent(self) QgsRectangle[source]

Returns the map extent defining the limits for labeling.

See also

setExtent()

Return type:

QgsRectangle

mapBoundaryGeometry(self) QgsGeometry[source]

Returns the map label boundary geometry, which defines the limits within which labels may be placed in the map.

The map boundary geometry specifies the actual geometry of the map boundary, which will be used to detect whether a label is visible (or partially visible) in the rendered map. This may differ from extent() in the case of rotated or non-rectangular maps.

See also

extent()

Return type:

QgsGeometry

renderContext(self) QgsRenderContext

Returns a reference to the context’s render context.

Return type:

QgsRenderContext

setExtent(self, extent: QgsRectangle)[source]

Sets the map extent defining the limits for labeling.

See also

extent()

Parameters:

extent (QgsRectangle)

setMapBoundaryGeometry(self, geometry: QgsGeometry)[source]

Sets the map label boundary geometry, which defines the limits within which labels may be placed in the map.

The map boundary geometry specifies the actual geometry of the map boundary, which will be used to detect whether a label is visible (or partially visible) in the rendered map. This may differ from extent() in the case of rotated or non-rectangular maps.

See also

setExtent()

Parameters:

geometry (QgsGeometry)