QGIS API Documentation 4.1.0-Master (9af12b5a203)
Loading...
Searching...
No Matches
QgsCategorized3DRenderer Class Reference

Categorized 3D renderer. More...

#include <qgscategorized3drenderer.h>

Inheritance diagram for QgsCategorized3DRenderer:

Public Types

using Categories = Qgs3DCategoryList
using Category = Qgs3DRendererCategory

Public Member Functions

 QgsCategorized3DRenderer (const QString &attributeName=QString(), const Qgs3DCategoryList &categories=Qgs3DCategoryList())
 Construct renderer with the given categories.
void addCategory (const Qgs3DRendererCategory &category)
 Adds a new category to the renderer.
const Qgs3DCategoryListcategories () const
 Returns a list of all categories recognized by the renderer.
QString classAttribute () const
 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.
QgsCategorized3DRendererclone () const override
 Returns a cloned instance.
Qt3DCore::QEntity * createEntity (Qgs3DMapSettings *mapSettings) const override
 Returns a 3D entity that will be used to show renderer's data in 3D scene.
void deleteAllCategories ()
 Deletes all existing categories from the renderer.
bool deleteCategory (int catIndex)
 Deletes the category with the specified index from the renderer.
bool moveCategory (int from, int to)
 Moves an existing category at index position from to index position to.
void readXml (const QDomElement &elem, const QgsReadWriteContext &context) override
 Reads renderer's properties from given XML element.
void setClassAttribute (QString attributeName)
 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.
void setSourceColorRamp (QgsColorRamp *ramp)
 Sets the source color ramp.
void setSourceSymbol (QgsAbstract3DSymbol *symbol)
 Sets the source symbol for the renderer, which is the base symbol used for the each categories' symbol before applying the categories' color.
void sortByValue (Qt::SortOrder order=Qt::AscendingOrder)
 Sorts the existing categories by their value.
QgsColorRampsourceColorRamp ()
 Returns the source color ramp, from which each categories' color is derived.
const QgsColorRampsourceColorRamp () const
 Returns the source color ramp, from which each categories' color is derived.
QgsAbstract3DSymbolsourceSymbol ()
 Returns the renderer's source symbol, which is the base symbol used for the each categories' symbol before applying the categories' color.
const QgsAbstract3DSymbolsourceSymbol () const
 Returns the renderer's source symbol, which is the base symbol used for the each categories' symbol before applying the categories' color.
QString type () const override
 Returns unique identifier of the renderer class (used to identify subclass).
bool updateCategoryRenderState (int catIndex, bool render)
 Changes the render state for the category with the specified index.
bool updateCategorySymbol (int catIndex, QgsAbstract3DSymbol *symbol)
 Changes the symbol for the category with the specified index.
bool updateCategoryValue (int catIndex, const QVariant &value)
 Changes the value for the category with the specified index.
void updateColorRamp (QgsColorRamp *ramp)
 Update the color ramp used and all symbols colors.
void updateSymbols (QgsAbstract3DSymbol *symbol)
 Update all the symbols but leave categories and colors.
void writeXml (QDomElement &elem, const QgsReadWriteContext &context) const override
 Writes renderer's properties to given XML element.
Public Member Functions inherited from QgsAbstractVectorLayer3DRenderer
 QgsAbstractVectorLayer3DRenderer ()
void copyBaseProperties (QgsAbstractVectorLayer3DRenderer *r) const
 Copies common properties of this object to another object.
QgsVectorLayerlayer () const
 Returns vector layer associated with the renderer.
void resolveReferences (const QgsProject &project) override
 Resolves references to other objects - second phase of loading - after readXml().
void setLayer (QgsVectorLayer *layer)
 Sets vector layer associated with the renderer.
void setTilingSettings (const QgsVectorLayer3DTilingSettings &settings)
 Sets tiling settings of the renderer.
QgsVectorLayer3DTilingSettings tilingSettings () const
 Returns tiling settings of the renderer.
Public Member Functions inherited from QgsAbstract3DRenderer
virtual ~QgsAbstract3DRenderer ()=default

Static Public Member Functions

static Qgs3DCategoryList createCategories (const QVariantList &values, const QgsAbstract3DSymbol *symbol, QgsVectorLayer *layer=nullptr, const QString &attributeName=QString())
 Create categories for a list of values.

Additional Inherited Members

Protected Member Functions inherited from QgsAbstractVectorLayer3DRenderer
void readXmlBaseProperties (const QDomElement &elem, const QgsReadWriteContext &context)
 Reads common properties of this object from DOM element.
void writeXmlBaseProperties (QDomElement &elem, const QgsReadWriteContext &context) const
 Writes common properties of this object to DOM element.
Protected Member Functions inherited from QgsAbstract3DRenderer
 QgsAbstract3DRenderer ()=default

Detailed Description

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.
Since
QGIS 4.2

Definition at line 145 of file qgscategorized3drenderer.h.

Member Typedef Documentation

◆ Categories

◆ Category

Constructor & Destructor Documentation

◆ QgsCategorized3DRenderer()

QgsCategorized3DRenderer::QgsCategorized3DRenderer ( const QString & attributeName = QString(),
const Qgs3DCategoryList & categories = Qgs3DCategoryList() )

Construct renderer with the given categories.

Definition at line 100 of file qgscategorized3drenderer.cpp.

Member Function Documentation

◆ addCategory()

void QgsCategorized3DRenderer::addCategory ( const Qgs3DRendererCategory & category)

Adds a new category to the renderer.

See also
categories()

Definition at line 237 of file qgscategorized3drenderer.cpp.

◆ categories()

const Qgs3DCategoryList & QgsCategorized3DRenderer::categories ( ) const
inline

Returns a list of all categories recognized by the renderer.

Definition at line 169 of file qgscategorized3drenderer.h.

◆ classAttribute()

QString QgsCategorized3DRenderer::classAttribute ( ) const
inline

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

Definition at line 178 of file qgscategorized3drenderer.h.

◆ clone()

QgsCategorized3DRenderer * QgsCategorized3DRenderer::clone ( ) const
overridevirtual

Returns a cloned instance.

Implements QgsAbstract3DRenderer.

Definition at line 105 of file qgscategorized3drenderer.cpp.

◆ createCategories()

Qgs3DCategoryList QgsCategorized3DRenderer::createCategories ( const QVariantList & values,
const QgsAbstract3DSymbol * symbol,
QgsVectorLayer * layer = nullptr,
const QString & attributeName = QString() )
static

Create categories for a list of values.

The returned symbols in the category list will be a modification of symbol.

If layer and fieldName are specified it will try to find nicer values to represent the description for the categories based on the respective field configuration.

Definition at line 380 of file qgscategorized3drenderer.cpp.

◆ createEntity()

Qt3DCore::QEntity * QgsCategorized3DRenderer::createEntity ( Qgs3DMapSettings * map) const
overridevirtual

Returns a 3D entity that will be used to show renderer's data in 3D scene.

Implements QgsAbstract3DRenderer.

Definition at line 123 of file qgscategorized3drenderer.cpp.

◆ deleteAllCategories()

void QgsCategorized3DRenderer::deleteAllCategories ( )

Deletes all existing categories from the renderer.

See also
deleteCategory()

Definition at line 253 of file qgscategorized3drenderer.cpp.

◆ deleteCategory()

bool QgsCategorized3DRenderer::deleteCategory ( int catIndex)

Deletes the category with the specified index from the renderer.

See also
deleteAllCategories()

Definition at line 242 of file qgscategorized3drenderer.cpp.

◆ moveCategory()

bool QgsCategorized3DRenderer::moveCategory ( int from,
int to )

Moves an existing category at index position from to index position to.

Definition at line 258 of file qgscategorized3drenderer.cpp.

◆ readXml()

void QgsCategorized3DRenderer::readXml ( const QDomElement & elem,
const QgsReadWriteContext & context )
overridevirtual

Reads renderer's properties from given XML element.

Implements QgsAbstract3DRenderer.

Definition at line 323 of file qgscategorized3drenderer.cpp.

◆ setClassAttribute()

void QgsCategorized3DRenderer::setClassAttribute ( QString attributeName)

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

Definition at line 148 of file qgscategorized3drenderer.cpp.

◆ setSourceColorRamp()

void QgsCategorized3DRenderer::setSourceColorRamp ( QgsColorRamp * ramp)

Sets the source color ramp.

Parameters
rampcolor ramp. Ownership is transferred to the renderer
See also
sourceColorRamp()
setSourceSymbol()

Definition at line 178 of file qgscategorized3drenderer.cpp.

◆ setSourceSymbol()

void QgsCategorized3DRenderer::setSourceSymbol ( QgsAbstract3DSymbol * symbol)

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

Parameters
symbolsource symbol, ownership is transferred to the renderer
See also
sourceSymbol()
setSourceColorRamp()

Definition at line 163 of file qgscategorized3drenderer.cpp.

◆ sortByValue()

void QgsCategorized3DRenderer::sortByValue ( Qt::SortOrder order = Qt::AscendingOrder)

Sorts the existing categories by their value.

Definition at line 269 of file qgscategorized3drenderer.cpp.

◆ sourceColorRamp() [1/2]

QgsColorRamp * QgsCategorized3DRenderer::sourceColorRamp ( )

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

See also
setSourceColorRamp()
sourceSymbol()

Definition at line 168 of file qgscategorized3drenderer.cpp.

◆ sourceColorRamp() [2/2]

const QgsColorRamp * QgsCategorized3DRenderer::sourceColorRamp ( ) const

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

See also
setSourceColorRamp()
sourceSymbol()
Note
Not available in Python bindings.

Definition at line 173 of file qgscategorized3drenderer.cpp.

◆ sourceSymbol() [1/2]

QgsAbstract3DSymbol * QgsCategorized3DRenderer::sourceSymbol ( )

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

See also
setSourceSymbol()
sourceColorRamp()

Definition at line 153 of file qgscategorized3drenderer.cpp.

◆ sourceSymbol() [2/2]

const QgsAbstract3DSymbol * QgsCategorized3DRenderer::sourceSymbol ( ) const

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

See also
setSourceSymbol()
sourceColorRamp()
Note
Not available in Python bindings.

Definition at line 158 of file qgscategorized3drenderer.cpp.

◆ type()

QString QgsCategorized3DRenderer::type ( ) const
inlineoverridevirtual

Returns unique identifier of the renderer class (used to identify subclass).

Implements QgsAbstract3DRenderer.

Definition at line 154 of file qgscategorized3drenderer.h.

◆ updateCategoryRenderState()

bool QgsCategorized3DRenderer::updateCategoryRenderState ( int catIndex,
bool render )

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
updateCategoryValue()
updateCategorySymbol()

Definition at line 226 of file qgscategorized3drenderer.cpp.

◆ updateCategorySymbol()

bool QgsCategorized3DRenderer::updateCategorySymbol ( int catIndex,
QgsAbstract3DSymbol * symbol )

Changes the symbol for the category with the specified index.

Ownership of symbol is transferred to the renderer.

See also
updateCategoryValue()
updateCategoryRenderState()

Definition at line 215 of file qgscategorized3drenderer.cpp.

◆ updateCategoryValue()

bool QgsCategorized3DRenderer::updateCategoryValue ( int catIndex,
const QVariant & value )

Changes the value for the category with the specified index.

If value is a list, then the category will match any of the values from this list.

See also
updateCategorySymbol()
updateCategoryRenderState()

Definition at line 204 of file qgscategorized3drenderer.cpp.

◆ updateColorRamp()

void QgsCategorized3DRenderer::updateColorRamp ( QgsColorRamp * ramp)

Update the color ramp used and all symbols colors.

Parameters
rampcolor ramp. Ownership is transferred to the renderer

Definition at line 183 of file qgscategorized3drenderer.cpp.

◆ updateSymbols()

void QgsCategorized3DRenderer::updateSymbols ( QgsAbstract3DSymbol * symbol)

Update all the symbols but leave categories and colors.

This method also sets the source symbol for the renderer.

Parameters
symbolsource symbol to use for categories. Ownership is not transferred.
See also
setSourceSymbol()

Definition at line 135 of file qgscategorized3drenderer.cpp.

◆ writeXml()

void QgsCategorized3DRenderer::writeXml ( QDomElement & elem,
const QgsReadWriteContext & context ) const
overridevirtual

Writes renderer's properties to given XML element.

Implements QgsAbstract3DRenderer.

Definition at line 277 of file qgscategorized3drenderer.cpp.


The documentation for this class was generated from the following files: