Class: QgsEmbeddedSymbolRenderer

class qgis.core.QgsEmbeddedSymbolRenderer

Bases: QgsFeatureRenderer

A vector feature renderer which uses embedded feature symbology to render per-feature symbols.

This renderer can be used for vector layers with a data provider which supports the QgsVectorDataProvider.FeatureSymbology capability, where the dataset has embedded information on how each feature should be rendered.

New in version 3.20.

QgsEmbeddedSymbolRenderer(defaultSymbol: QgsSymbol) Constructor for QgsEmbeddedSymbolRenderer.

The defaultSymbol will be used to render any feature without embedded symbology. Ownership of defaultSymbol is transferred to the renderer.

Methods

capabilities

rtype

QgsFeatureRenderer.Capabilities

clone

rtype

QgsEmbeddedSymbolRenderer

convertFromRenderer

Creates a QgsEmbeddedSymbolRenderer from an existing renderer.

convertSymbolRotation

convertSymbolSizeScale

copyRendererData

Clones generic renderer data to another renderer.

create

Creates a new embedded symbol renderer from an XML element, using the supplied read/write context.

defaultSymbol

Returns the default symbol which will be rendered for any feature which does not have embedded symbology.

originalSymbolForFeature

param feature

renderFeature

param 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

setDefaultSymbol

Sets the default symbol which will be rendered for any feature which does not have embedded symbology.

startRender

param context

stopRender

param context

symbolForFeature

param feature

symbols

param context

usedAttributes

param context

usesEmbeddedSymbols

rtype

bool

capabilities(self)QgsFeatureRenderer.Capabilities
Return type

QgsFeatureRenderer.Capabilities

clone(self)QgsEmbeddedSymbolRenderer
Return type

QgsEmbeddedSymbolRenderer

convertFromRenderer(renderer: QgsFeatureRenderer)QgsEmbeddedSymbolRenderer

Creates a QgsEmbeddedSymbolRenderer from an existing renderer.

Return type

QgsEmbeddedSymbolRenderer

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: 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 new embedded symbol renderer from an XML element, using the supplied read/write context.

The caller takes ownership of the returned renderer.

Parameters
Return type

QgsFeatureRenderer

defaultSymbol(self)QgsSymbol

Returns the default symbol which will be rendered for any feature which does not have embedded symbology.

Return type

QgsSymbol

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

QgsSymbol

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

  • context (QgsRenderContext) –

  • layer (int = -1) –

  • selected (bool = False) –

  • drawVertexMarker (bool = False) –

Return type

bool

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

setDefaultSymbol(self, symbol: QgsSymbol)

Sets the default symbol which will be rendered for any feature which does not have embedded symbology.

Ownership of symbol is transferred to the renderer.

See also

defaultSymbol()

Parameters

symbol (QgsSymbol) –

startRender(self, context: QgsRenderContext, fields: QgsFields)
Parameters
stopRender(self, context: QgsRenderContext)
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]

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

context (QgsRenderContext) –

Return type

Set[str]

usesEmbeddedSymbols(self)bool
Return type

bool