Class: QgsCategorized3DRenderer¶
Categorized 3D renderer.
Similar to Categorized 2D renderer and Categorized labeling, it allows specification of rules for 3D symbols.
Warning
This is not considered stable API, and may change in future QGIS releases. It is exposed to the Python bindings as a tech preview only.
Added in version 4.2.
Class Hierarchy¶
Base classes¶
Base class for 3D renderers that are based on vector layers. |
|
Base class for all renderers that participate in 3D views. |
Constructor
Methods
Adds a new category to the renderer. |
|
Returns a list of all categories recognized by the renderer. |
|
Returns the class attribute for the renderer, which is the field name or expression string from the layer which will be matched against the renderer categories. |
|
Deletes all existing categories from the renderer. |
|
Deletes the category with the specified index from the renderer. |
|
Moves an existing category at index position from to index position to. |
|
Sets the class attribute for the renderer, which is the field name or expression string from the layer which will be matched against the renderer categories. |
|
Sets the source color ramp. |
|
Sets the source symbol for the renderer, which is the base symbol used for the each categories' symbol before applying the categories' color. |
|
Sorts the existing categories by their value. |
|
Returns the source color ramp, from which each categories' color is derived. |
|
Returns the renderer's source symbol, which is the base symbol used for the each categories' symbol before applying the categories' color. |
|
Changes the render state for the category with the specified index. |
|
Changes the symbol for the category with the specified index. |
|
Changes the value for the category with the specified index. |
|
Update the color ramp used and all symbols colors. |
|
Update all the symbols but leave categories and colors. |
|
Static Methods
Create categories for a list of values. |
- class qgis._3d.QgsCategorized3DRenderer[source]¶
Bases:
QgsAbstractVectorLayer3DRenderer- __init__(attributeName: str | None = '', categories: Iterable[Qgs3DRendererCategory] = [])¶
Construct renderer with the given categories
- Parameters:
attributeName (Optional[str] = '')
categories (Iterable[Qgs3DRendererCategory] = [])
- addCategory(self, category: Qgs3DRendererCategory)[source]¶
Adds a new
categoryto the renderer.See also
- Parameters:
category (Qgs3DRendererCategory)
- categories(self) list[Qgs3DRendererCategory]¶
Returns a list of all categories recognized by the renderer.
- Return type:
list[Qgs3DRendererCategory]
- classAttribute(self) str[source]¶
Returns the class attribute for the renderer, which is the field name or expression string from the layer which will be matched against the renderer categories.
See also
- Return type:
str
- static createCategories(values: Iterable[Any], symbol: QgsAbstract3DSymbol | None, layer: QgsVectorLayer | None = None, attributeName: str | None = '') list[Qgs3DRendererCategory][source]¶
Create categories for a list of
values. The returned symbols in the category list will be a modification ofsymbol.If
layerandfieldNameare specified it will try to find nicer values to represent the description for the categories based on the respective field configuration.- Parameters:
values (Iterable[Any])
symbol (Optional[QgsAbstract3DSymbol])
layer (Optional[QgsVectorLayer] = None)
attributeName (Optional[str] = '')
- Return type:
list[Qgs3DRendererCategory]
- deleteCategory(self, catIndex: int) bool[source]¶
Deletes the category with the specified index from the renderer.
See also
- Parameters:
catIndex (int)
- Return type:
bool
- moveCategory(self, from_: int, to: int) bool[source]¶
Moves an existing category at index position from to index position to.
- Parameters:
from (int)
to (int)
- Return type:
bool
- readXmlBaseProperties()¶
- setClassAttribute(self, attributeName: str | None)[source]¶
Sets the class attribute for the renderer, which is the field name or expression string from the layer which will be matched against the renderer categories.
See also
- Parameters:
attributeName (Optional[str])
- setSourceColorRamp(self, ramp: QgsColorRamp | None)[source]¶
Sets the source color ramp.
- Parameters:
ramp (Optional[QgsColorRamp]) – color ramp. Ownership is transferred to the renderer
See also
See also
- setSourceSymbol(self, symbol: QgsAbstract3DSymbol | None)[source]¶
Sets the source symbol for the renderer, which is the base symbol used for the each categories’ symbol before applying the categories’ color.
- Parameters:
symbol (Optional[QgsAbstract3DSymbol]) – source symbol, ownership is transferred to the renderer
See also
See also
- sortByValue(self, order: Qt.SortOrder = Qt.AscendingOrder)[source]¶
Sorts the existing categories by their value.
- Parameters:
order (Qt.SortOrder = Qt.AscendingOrder)
- sourceColorRamp(self) QgsColorRamp | None[source]¶
Returns the source color ramp, from which each categories’ color is derived.
See also
See also
- Return type:
- sourceSymbol(self) QgsAbstract3DSymbol | None[source]¶
Returns the renderer’s source symbol, which is the base symbol used for the each categories’ symbol before applying the categories’ color.
See also
See also
- Return type:
- updateCategoryRenderState(self, catIndex: int, render: bool) bool[source]¶
Changes the render state for the category with the specified index.
The render state indicates whether or not the category will be rendered, and is reflected in whether the category is checked with the project’s layer tree.
See also
See also
- Parameters:
catIndex (int)
render (bool)
- Return type:
bool
- updateCategorySymbol(self, catIndex: int, symbol: QgsAbstract3DSymbol | None) bool[source]¶
Changes the
symbolfor the category with the specified index.Ownership of
symbolis transferred to the renderer.See also
See also
- Parameters:
catIndex (int)
symbol (Optional[QgsAbstract3DSymbol])
- Return type:
bool
- updateCategoryValue(self, catIndex: int, value: Any) bool[source]¶
Changes the value for the category with the specified index.
If
valueis a list, then the category will match any of the values from this list.See also
See also
- Parameters:
catIndex (int)
value (Any)
- Return type:
bool
- updateColorRamp(self, ramp: QgsColorRamp | None)[source]¶
Update the color ramp used and all symbols colors.
- Parameters:
ramp (Optional[QgsColorRamp]) – color ramp. Ownership is transferred to the renderer
- updateSymbols(self, symbol: QgsAbstract3DSymbol | None)[source]¶
Update all the symbols but leave categories and colors. This method also sets the source symbol for the renderer.
- Parameters:
symbol (Optional[QgsAbstract3DSymbol]) – source symbol to use for categories. Ownership is not transferred.
See also
- writeXmlBaseProperties()¶