Class: QgsInvertedPolygonRenderer

class qgis.core.QgsInvertedPolygonRenderer(embeddedRenderer: QgsFeatureRenderer = None)

Bases: qgis._core.QgsFeatureRenderer

Constructor

Parameters

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

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: Enums

Methods

accept

capabilities

checkLegendSymbolItem

clone

Direct copies are forbidden.

convertFromRenderer

Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.

convertSymbolRotation

convertSymbolSizeScale

copyRendererData

create

Creates a renderer out of an XML, for loading

dump

embeddedRenderer

filterNeedsGeometry

legendSymbolItemChecked

legendSymbolItems

legendSymbolItemsCheckable

originalSymbolForFeature

originalSymbolsForFeature

preprocessingEnabled

return

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

renderFeature

Renders a given feature.

renderFeatureWithSymbol

renderVertexMarker

renderVertexMarkerPolygon

renderVertexMarkerPolyline

save

setEmbeddedRenderer

setLegendSymbolItem

setPreprocessingEnabled

param enabled

enables or disables the preprocessing.

startRender

stopRender

The actual rendering will take place here.

symbolForFeature

symbols

symbolsForFeature

usedAttributes

willRenderFeature

Signals

Attributes

accept(self, visitor: QgsStyleEntityVisitorInterface) → bool
capabilities(self) → QgsFeatureRenderer.Capabilities
checkLegendSymbolItem(self, key: str, state: bool = True)
clone(self) → QgsInvertedPolygonRenderer

Direct copies are forbidden. Use clone() instead.

convertFromRenderer(renderer: QgsFeatureRenderer) → QgsInvertedPolygonRenderer

Creates a QgsInvertedPolygonRenderer by a conversion from an existing renderer.

Returns

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

New in version 2.5.

convertSymbolRotation()
convertSymbolSizeScale()
copyRendererData()
create(element: QDomElement, context: QgsReadWriteContext) → QgsFeatureRenderer

Creates a renderer out of an XML, for loading

dump(self) → str
embeddedRenderer(self) → QgsFeatureRenderer
filterNeedsGeometry(self) → bool
legendSymbolItemChecked(self, key: str) → bool
legendSymbolItems(self) → List[QgsLegendSymbolItem]
legendSymbolItemsCheckable(self) → bool
originalSymbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
originalSymbolsForFeature(self, feature: QgsFeature, context: QgsRenderContext) → List[QgsSymbol]
preprocessingEnabled(self) → bool
Returns

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

renderFeature(self, feature: QgsFeature, context: QgsRenderContext, layer: int = -1, selected: bool = False, drawVertexMarker: bool = False) → bool

Renders a given feature. This will here collect features. The actual rendering will be postponed to stopRender()

Parameters
  • feature – the feature to render

  • context – the rendering context

  • layer – the symbol layer to render, if that makes sense

  • selected – whether this feature has been selected (this will add decorations)

  • drawVertexMarker – whether this feature has vertex markers (in edit mode usually)

Returns

True if the rendering was OK

renderFeatureWithSymbol()
renderVertexMarker()
renderVertexMarkerPolygon()
renderVertexMarkerPolyline()
save(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement
setEmbeddedRenderer(self, subRenderer: QgsFeatureRenderer)
setLegendSymbolItem(self, key: str, symbol: QgsSymbol)
setPreprocessingEnabled(self, enabled: bool)
Parameters

enabled – 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.

startRender(self, context: QgsRenderContext, fields: QgsFields)
stopRender(self, context: QgsRenderContext)

The actual rendering will take place here. Features collected during renderFeature() are rendered using the embedded feature renderer

symbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
symbols(self, context: QgsRenderContext) → List[QgsSymbol]
symbolsForFeature(self, feature: QgsFeature, context: QgsRenderContext) → List[QgsSymbol]
usedAttributes(self, context: QgsRenderContext) → Set[str]
willRenderFeature(self, feature: QgsFeature, context: QgsRenderContext) → bool