Class: QgsSingleSymbolRenderer

class qgis.core.QgsSingleSymbolRenderer(symbol: QgsSymbol)

Bases: QgsFeatureRenderer

Constructor for QgsSingleSymbolRenderer.

The same symbol will be used to render every feature. Ownership of symbol is transferred to the renderer.

Parameters

symbol

accept(self, visitor: QgsStyleEntityVisitorInterface) → bool
Parameters

visitor (QgsStyleEntityVisitorInterface) –

Return type

bool

capabilities(self) → QgsFeatureRenderer.Capabilities
Return type

QgsFeatureRenderer.Capabilities

clone(self) → QgsSingleSymbolRenderer
Return type

QgsSingleSymbolRenderer

convertFromRenderer(renderer: QgsFeatureRenderer) → QgsSingleSymbolRenderer

Creates a new single symbol renderer from an existing renderer.

Return type

QgsSingleSymbolRenderer

Returns

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

New in version 2.5.

Parameters

renderer (QgsFeatureRenderer) –

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

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

The caller takes ownership of the returned renderer.

Parameters
Return type

QgsFeatureRenderer

createFromSld(element: QDomElement, geomType: QgsWkbTypes.GeometryType) → QgsFeatureRenderer

Creates a new single symbol renderer from an SLD element.

The geometry type for features to be rendered must be specified via the geomType argument.

The caller takes ownership of the returned renderer.

Parameters
Return type

QgsFeatureRenderer

dataDefinedSizeLegend(self) → QgsDataDefinedSizeLegend

Returns configuration of appearance of legend when using data-defined size for marker symbols. Will return None if the functionality is disabled.

New in version 3.0.

Return type

QgsDataDefinedSizeLegend

dump(self) → str
Return type

str

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

Set[str]

legendSymbolItems(self) → List[QgsLegendSymbolItem]
Return type

List[QgsLegendSymbolItem]

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

QgsSymbol

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

QDomElement

setDataDefinedSizeLegend(self, settings: QgsDataDefinedSizeLegend)

Configures appearance of legend when renderer is configured to use data-defined size for marker symbols. This allows configuring which values (symbol sizes) should be shown in the legend, whether to display different symbol sizes collapsed in one legend node or separated across multiple legend nodes etc.

When renderer does not use data-defined size or does not use marker symbols, these settings will be ignored. Takes ownership of the passed settings objects. None is a valid input that disables data-defined size legend.

New in version 3.0.

Parameters

settings (QgsDataDefinedSizeLegend) –

setLegendSymbolItem(self, key: str, symbol: QgsSymbol)
Parameters
setSymbol(self, s: QgsSymbol)

Sets the symbol which will be rendered for every feature. Ownership of the symbol is transferred to the renderer.

See also

symbol()

Parameters

s (QgsSymbol) –

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

context (QgsRenderContext) –

symbol(self) → QgsSymbol

Returns the symbol which will be rendered for every feature.

See also

setSymbol()

Return type

QgsSymbol

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

QgsSymbol

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

context (QgsRenderContext) –

Return type

List[QgsSymbol]

toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str] = {})
Parameters
  • doc (QDomDocument) –

  • element (QDomElement) –

  • props (Dict[str) –

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

context (QgsRenderContext) –

Return type

Set[str]