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

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]