Class: QgsMergedFeatureRenderer

class qgis.core.QgsMergedFeatureRenderer

Bases: QgsFeatureRenderer

QgsMergedFeatureRenderer is a polygon or line-only feature renderer used to renderer a set of features merged (or dissolved) into a single geometry.

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. E.g. if the embedded renderer is a categorized renderer, then all the matching features for each categorized class will be dissolved together. Features from different classes will NOT be dissolved together.

New in version 3.18.

QgsMergedFeatureRenderer(embeddedRenderer: QgsFeatureRenderer) Constructor for QgsMergedFeatureRenderer.

Parameters

embeddedRenderer – optional embeddedRenderer. Ownership will be transferred.

QgsMergedFeatureRenderer(type: str, embeddedRenderer: QgsFeatureRenderer) Constructor for QgsMergedFeatureRenderer.

Parameters
class GeometryOperation

Bases: int

InvertOnly = 1
Merge = 0
MergeAndInvert = 2
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) QgsMergedFeatureRenderer
Return type

QgsMergedFeatureRenderer

convertFromRenderer(renderer: QgsFeatureRenderer) QgsMergedFeatureRenderer

Creates a QgsMergedFeatureRenderer by a conversion from an existing renderer.

Return type

QgsMergedFeatureRenderer

Returns

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

Parameters

renderer (QgsFeatureRenderer) –

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]

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

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