Class: QgsNullSymbolRenderer

class qgis.core.QgsNullSymbolRenderer

Bases: QgsFeatureRenderer

Null symbol renderer. Renderer which draws no symbols for features by default, but allows for labeling and diagrams for the layer. Selected features will also be drawn with a default symbol.

Methods

clone

rtype:

Optional[QgsFeatureRenderer]

convertFromRenderer

Creates a QgsNullSymbolRenderer from an existing renderer.

convertSymbolRotation

convertSymbolSizeScale

create

Creates a null renderer from XML element.

dump

rtype:

str

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:

saveRendererData

Saves generic renderer data into the specified element.

stopRender

param context:

symbolForFeature

param feature:

symbols

param context:

usedAttributes

param context:

willRenderFeature

param feature:

clone(self) QgsFeatureRenderer | None
Return type:

Optional[QgsFeatureRenderer]

convertFromRenderer(renderer: QgsFeatureRenderer | None) QgsNullSymbolRenderer | None

Creates a QgsNullSymbolRenderer from an existing renderer.

Parameters:

renderer (Optional[QgsFeatureRenderer]) – renderer to convert from

Return type:

Optional[QgsNullSymbolRenderer]

Returns:

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

convertSymbolRotation(symbol: QgsSymbol | None, field: str | None)

Note

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

convertSymbolSizeScale(symbol: QgsSymbol | None, method: Qgis.ScaleMethod, field: str | None)

Note

this function is used to convert old sizeScale expressions to symbol level DataDefined size

create(element: QDomElement, context: QgsReadWriteContext) QgsFeatureRenderer | None

Creates a null renderer from XML element.

Parameters:
Return type:

Optional[QgsFeatureRenderer]

Returns:

new null symbol renderer

dump(self) str
Return type:

str

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

Optional[QgsSymbol]

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

bool

renderFeatureWithSymbol(self, feature: QgsFeature, symbol: QgsSymbol | None, 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: QPointF | QPoint, context: QgsRenderContext)

render editing vertex marker at specified point

renderVertexMarkerPolygon(self, pts: QPolygonF, rings: Iterable[QPolygonF] | None, 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

saveRendererData(self, doc: QDomDocument, element: QDomElement, context: QgsReadWriteContext)

Saves generic renderer data into the specified element.

This method should be called in a subclass’ save() implementation in order to store all common base class properties in the DOM element.

Added in version 3.22.

stopRender(self, context: QgsRenderContext)
Parameters:

context (QgsRenderContext)

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

Optional[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]

willRenderFeature(self, feature: QgsFeature, context: QgsRenderContext) bool
Parameters:
Return type:

bool