Class: QgsMergedFeatureRenderer

class qgis.core.QgsMergedFeatureRenderer(embeddedRenderer: QgsFeatureRenderer)

Bases: QgsFeatureRenderer

Constructor for QgsMergedFeatureRenderer.

Parameters

embeddedRenderer (QgsFeatureRenderer) – optional embeddedRenderer. Ownership will be transferred.

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

Parameters
  • type – renderer ID string

  • embeddedRenderer – optional embeddedRenderer. Ownership will be transferred.

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.

Methods

accept

param visitor

capabilities

rtype

QgsFeatureRenderer.Capabilities

checkLegendSymbolItem

param key

clone

rtype

QgsMergedFeatureRenderer

convertFromRenderer

Creates a QgsMergedFeatureRenderer 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

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

renderFeature

Renders a given feature.

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

setEmbeddedRenderer

param subRenderer

setLegendSymbolItem

param key

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

Attributes

InvertOnly

Merge

MergeAndInvert

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

convertSymbolRotation(symbol: QgsSymbol, field: str)

Note

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

convertSymbolSizeScale(symbol: QgsSymbol, method: QgsSymbol.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

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

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

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