Subgroup: other

Class: QgsCategorizedSymbolRenderer

class qgis.core.QgsCategorizedSymbolRenderer(attrName: str = '', categories: object = QgsCategoryList())

Bases: qgis._core.QgsFeatureRenderer

Methods

addCategory
capabilities
categories
categoryIndexForLabel return index of category with specified label (-1 if not found or not unique)
categoryIndexForValue return index of category with specified value (-1 if not found)
checkLegendSymbolItem
classAttribute
clone
convertFromRenderer creates a QgsCategorizedSymbolRenderer from an existing renderer.
convertSymbolRotation
convertSymbolSizeScale
copyRendererData
create create renderer from XML element
dataDefinedSizeLegend Returns configuration of appearance of legend when using data-defined size for marker symbols.
defaultRenderer return a new renderer - used by default in vector layers
deleteAllCategories
deleteCategory
dump
embeddedRenderer Returns the current embedded renderer (subrenderer) for this feature renderer.
filter
filterNeedsGeometry Returns true if this renderer requires the geometry to apply the filter.
forceRasterRender Returns whether the renderer must render as a raster.
legendClassificationAttribute
legendKeysForFeature
legendSymbolItemChecked
legendSymbolItems
legendSymbolItemsCheckable
load create a renderer from XML element
loadSld Create a new renderer according to the information contained in
modifyRequestExtent Allows for a renderer to modify the extent of a feature request prior to rendering
moveCategory Moves the category at index position from to index position to.
orderBy Get the order in which features shall be processed by this renderer.
orderByEnabled Returns whether custom ordering will be applied before features are processed by this renderer.
originalSymbolForFeature
originalSymbolsForFeature Equivalent of originalSymbolsForFeature() call
paintEffect Returns the current paint effect for the renderer.
rebuildHash hashtable for faster access to symbols
renderFeature Render a feature using this renderer in the given context.
renderFeatureWithSymbol
renderVertexMarker
renderVertexMarkerPolygon
renderVertexMarkerPolyline
save
setClassAttribute
setDataDefinedSizeLegend Configures appearance of legend when renderer is configured to use data-defined size for marker symbols.
setEmbeddedRenderer Sets an embedded renderer (subrenderer) for this feature renderer.
setForceRasterRender Sets whether the renderer should be rendered to a raster destination.
setLegendSymbolItem
setOrderBy Define the order in which features shall be processed by this renderer.
setOrderByEnabled Sets whether custom ordering should be applied before features are processed by this renderer.
setPaintEffect Sets the current paint effect for the renderer.
setSourceColorRamp Sets the source color ramp.
setSourceSymbol Sets the source symbol for the renderer, which is the base symbol used for the each categories’ symbol before applying the categories’ color.
setUsingSymbolLevels
setVertexMarkerAppearance set type and size of editing vertex markers for subsequent rendering
skipRender
sortByLabel
sortByValue
sourceColorRamp Returns the source color ramp, from which each categories’ color is derived.
sourceSymbol Returns the renderer’s source symbol, which is the base symbol used for the each categories’ symbol before applying the categories’ color.
startRender
stopRender
symbolForFeature
symbolForValue
symbols
symbolsForFeature Returns list of symbols used for rendering the feature.
toSld
type
updateCategoryLabel
updateCategoryRenderState

New in version 2.5.

updateCategorySymbol
updateCategoryValue
updateColorRamp Update the color ramp used and all symbols colors.
updateSymbols Update all the symbols but leave categories and colors.
usedAttributes
usingSymbolLevels
willRenderFeature Returns whether the renderer will render a feature or not.
writeSld create the SLD UserStyle element following the SLD v1.1 specs with the given name

Attributes

Filter
MoreSymbolsPerFeature
ScaleDependent
SymbolLevels
addCategory(self, category: QgsRendererCategory)
capabilities(self) → QgsFeatureRenderer.Capabilities
categories(self) → object
categoryIndexForLabel(self, val: str) → int

return index of category with specified label (-1 if not found or not unique)

New in version 2.5.

categoryIndexForValue(self, val: Any) → int

return index of category with specified value (-1 if not found)

checkLegendSymbolItem(self, key: str, state: bool = True)
classAttribute(self) → str
clone(self) → QgsCategorizedSymbolRenderer
convertFromRenderer(renderer: QgsFeatureRenderer) → QgsCategorizedSymbolRenderer

creates a QgsCategorizedSymbolRenderer from an existing renderer.

Returns:a new renderer if the conversion was possible, otherwise 0.

New in version 2.5.

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

create renderer from XML element

dataDefinedSizeLegend(self) → QgsDataDefinedSizeLegend

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

New in version 3.0.

deleteAllCategories(self)
deleteCategory(self, catIndex: int) → bool
dump(self) → str
filter(self, fields: QgsFields = QgsFields()) → str
legendClassificationAttribute(self) → str
legendKeysForFeature(self, feature: QgsFeature, context: QgsRenderContext) → Set[str]
legendSymbolItemChecked(self, key: str) → bool
legendSymbolItems(self) → object
legendSymbolItemsCheckable(self) → bool
moveCategory(self, from_: int, to: int)

Moves the category at index position from to index position to.

originalSymbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
rebuildHash(self)

hashtable for faster access to symbols

renderFeatureWithSymbol()
renderVertexMarker()
renderVertexMarkerPolygon()
renderVertexMarkerPolyline()
save(self, doc: QDomDocument, context: QgsReadWriteContext) → QDomElement
setClassAttribute(self, attr: str)
setDataDefinedSizeLegend(self, settings: QgsDataDefinedSizeLegend)

Configures appearance of legend when renderer is configured to use data-defined size for marker symbols. This allows configuring for 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. Null pointer is a valid input that disables data-defined size legend.

New in version 3.0.

setLegendSymbolItem(self, key: str, symbol: QgsSymbol)
setSourceColorRamp(self, ramp: QgsColorRamp)

Sets the source color ramp.

Parameters:ramp – color ramp. Ownership is transferred to the renderer
setSourceSymbol(self, sym: QgsSymbol)

Sets the source symbol for the renderer, which is the base symbol used for the each categories’ symbol before applying the categories’ color.

Parameters:sym – source symbol, ownership is transferred to the renderer

See also

sourceSymbol()

skipRender(self) → QgsSymbol
sortByLabel(self, order: Qt.SortOrder = Qt.AscendingOrder)
sortByValue(self, order: Qt.SortOrder = Qt.AscendingOrder)
sourceColorRamp(self) → QgsColorRamp

Returns the source color ramp, from which each categories’ color is derived.

See also

sourceSymbol()

sourceSymbol(self) → QgsSymbol

Returns the renderer’s source symbol, which is the base symbol used for the each categories’ symbol before applying the categories’ color.

startRender(self, context: QgsRenderContext, fields: QgsFields)
stopRender(self, context: QgsRenderContext)
symbolForFeature(self, feature: QgsFeature, context: QgsRenderContext) → QgsSymbol
symbolForValue(self, value: Any) → QgsSymbol
symbols(self, context: QgsRenderContext) → object
toSld(self, doc: QDomDocument, element: QDomElement, props: Dict[str, str] = {})
updateCategoryLabel(self, catIndex: int, label: str) → bool
updateCategoryRenderState(self, catIndex: int, render: bool) → bool

New in version 2.5.

updateCategorySymbol(self, catIndex: int, symbol: QgsSymbol) → bool
updateCategoryValue(self, catIndex: int, value: Any) → bool
updateColorRamp(self, ramp: QgsColorRamp)

Update the color ramp used and all symbols colors.

Parameters:ramp – color ramp. Ownership is transferred to the renderer

New in version 2.5.

updateSymbols(self, sym: QgsSymbol)

Update all the symbols but leave categories and colors. This method also sets the source symbol for the renderer.

Parameters:sym – source symbol to use for categories. Ownership is not transferred.
usedAttributes(self, context: QgsRenderContext) → Set[str]