Class: QgsInvertedPolygonRenderer

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

Bases: QgsFeatureRenderer

Constructor

Parameters

embeddedRenderer (QgsFeatureRenderer = None) – 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().

Methods

accept

param visitor

capabilities

rtype

QgsFeatureRenderer.Capabilities

checkLegendSymbolItem

param key

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

rtype

str

embeddedRenderer

rtype

QgsFeatureRenderer

filterNeedsGeometry

rtype

bool

legendKeysForFeature

param feature

legendSymbolItemChecked

param key

legendSymbolItems

rtype

List[QgsLegendSymbolItem]

legendSymbolItemsCheckable

rtype

bool

originalSymbolForFeature

param feature

originalSymbolsForFeature

param feature

preprocessingEnabled

rtype

bool

renderFeature

Renders a given feature.

renderFeatureWithSymbol

renderVertexMarker

renderVertexMarkerPolygon

renderVertexMarkerPolyline

save

param doc

setEmbeddedRenderer

param subRenderer

setLegendSymbolItem

param key

setPreprocessingEnabled

type enabled

bool

startRender

param context

stopRender

The actual rendering will take place here.

symbolForFeature

param feature

symbols

param context

symbolsForFeature

param feature

usedAttributes

param context

willRenderFeature

param feature

accept(self, visitor: QgsStyleEntityVisitorInterface) → bool
Parameters

visitor (QgsStyleEntityVisitorInterface) –

Return type

bool

capabilities(self) → QgsFeatureRenderer.Capabilities
Return type

QgsFeatureRenderer.Capabilities

checkLegendSymbolItem(self, key: str, state: bool = True)
Parameters
  • key (str) –

  • state (bool = True) –

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 0.

New in version 2.5.

Parameters

renderer (QgsFeatureRenderer) –

convertSymbolRotation()
convertSymbolSizeScale()
copyRendererData()
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

embeddedRenderer(self) → QgsFeatureRenderer
Return type

QgsFeatureRenderer

filterNeedsGeometry(self) → bool
Return type

bool

legendKeysForFeature(self, feature: QgsFeature, context: QgsRenderContext) → Set[str]
Parameters
Return type

Set[str]

legendSymbolItemChecked(self, key: str) → bool
Parameters

key (str) –

Return type

bool

legendSymbolItems(self) → List[QgsLegendSymbolItem]
Return type

List[QgsLegendSymbolItem]

legendSymbolItemsCheckable(self) → bool
Return type

bool

originalSymbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
Parameters
Return type

QgsSymbol

originalSymbolsForFeature(self, feature: QgsFeature, context: QgsRenderContext) → List[QgsSymbol]
Parameters
Return type

List[QgsSymbol]

preprocessingEnabled(self) → bool
Return type

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 (QgsFeature) – the feature to render

  • context (QgsRenderContext) – the rendering context

  • layer (int = -1) – the symbol layer to render, if that makes sense

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

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

Return type

bool

Returns

True if the rendering was OK

renderFeatureWithSymbol()
renderVertexMarker()
renderVertexMarkerPolygon()
renderVertexMarkerPolyline()
save(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement
Parameters
Return type

QDomElement

setEmbeddedRenderer(self, subRenderer: QgsFeatureRenderer)
Parameters

subRenderer (QgsFeatureRenderer) –

setLegendSymbolItem(self, key: str, symbol: QgsSymbol)
Parameters
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.

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

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

Parameters

context (QgsRenderContext) –

symbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
Parameters
Return type

QgsSymbol

symbols(self, context: QgsRenderContext) → List[QgsSymbol]
Parameters

context (QgsRenderContext) –

Return type

List[QgsSymbol]

symbolsForFeature(self, feature: QgsFeature, context: QgsRenderContext) → List[QgsSymbol]
Parameters
Return type

List[QgsSymbol]

usedAttributes(self, context: QgsRenderContext) → Set[str]
Parameters

context (QgsRenderContext) –

Return type

Set[str]

willRenderFeature(self, feature: QgsFeature, context: QgsRenderContext) → bool
Parameters
Return type

bool