Class: QgsInvertedPolygonRenderer

class qgis.core.QgsInvertedPolygonRenderer

Bases: QgsMergedFeatureRenderer

QgsInvertedPolygonRenderer is a polygon-only feature renderer used to display features inverted, where the exterior is turned to an interior and where the exterior theoretically spans the entire plane, allowing to mask the surroundings of some features.

It is designed on top of another feature renderer, which is called “embedded” Most of the methods are then only proxies to the embedded renderer.

Features are collected to form one “inverted” polygon during renderFeature() and rendered on stopRender().

New in version 2.4.

QgsInvertedPolygonRenderer(embeddedRenderer: QgsFeatureRenderer = None) Constructor

Parameters

embeddedRenderer

optional embeddedRenderer. If None, a default one will be assigned.

Ownership will be transferred.

Methods

clone

Direct copies are forbidden.

convertFromRenderer

Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.

convertSymbolRotation

convertSymbolSizeScale

copyRendererData

Clones generic renderer data to another renderer.

create

Creates a renderer out of an XML, for loading

dump

rtype

str

preprocessingEnabled

rtype

bool

renderFeatureWithSymbol

Render the feature with the symbol using context.

renderVertexMarker

render editing vertex marker at specified point

renderVertexMarkerPolygon

render editing vertex marker for a polygon

renderVertexMarkerPolyline

render editing vertex marker for a polyline

save

param doc

setPreprocessingEnabled

type enabled

bool

clone(self)QgsInvertedPolygonRenderer

Direct copies are forbidden. Use clone() instead.

Return type

QgsInvertedPolygonRenderer

convertFromRenderer(renderer: QgsFeatureRenderer)QgsInvertedPolygonRenderer

Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.

Return type

QgsInvertedPolygonRenderer

Returns

a new renderer if the conversion was possible, otherwise None.

New in version 2.5.

Parameters

renderer (QgsFeatureRenderer) –

convertSymbolRotation(symbol: QgsSymbol, field: str)

Note

this function is used to convert old rotations expressions to symbol level DataDefined angle

convertSymbolSizeScale(symbol: QgsSymbol, method: Qgis.ScaleMethod, field: str)

Note

this function is used to convert old sizeScale expressions to symbol level DataDefined size

copyRendererData(self, destRenderer: QgsFeatureRenderer)

Clones generic renderer data to another renderer. Currently clones

  • Order By

  • Paint Effect

Parameters

destRenderer – destination renderer for copied effect

create(element: QDomElement, context: QgsReadWriteContext)QgsFeatureRenderer

Creates a renderer out of an XML, for loading

Parameters
Return type

QgsFeatureRenderer

dump(self)str
Return type

str

preprocessingEnabled(self)bool
Return type

bool

Returns

True if the geometries are to be preprocessed (merged with an union) before rendering.

renderFeatureWithSymbol(self, feature: QgsFeature, symbol: QgsSymbol, context: QgsRenderContext, layer: int, selected: bool, drawVertexMarker: bool)

Render the feature with the symbol using context. Use layer to specify the symbol layer, selected to specify if it should be rendered as selected and drawVertexMarker to specify if vertex markers should be rendered.

renderVertexMarker(self, pt: Union[QPointF, QPoint], context: QgsRenderContext)

render editing vertex marker at specified point

renderVertexMarkerPolygon(self, pts: QPolygonF, rings: Iterable[QPolygonF], context: QgsRenderContext)

render editing vertex marker for a polygon

renderVertexMarkerPolyline(self, pts: QPolygonF, context: QgsRenderContext)

render editing vertex marker for a polyline

save(self, doc: QDomDocument, context: QgsReadWriteContext)QDomElement
Parameters
Return type

QDomElement

setPreprocessingEnabled(self, enabled: bool)
Parameters

enabled (bool) – enables or disables the preprocessing. When enabled, geometries will be merged with an union before being rendered. It allows fixing some rendering artifacts (when rendering overlapping polygons for instance). This will involve some CPU-demanding computations and is thus disabled by default.