QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
QgsRendererCategory Class Reference

Represents an individual category (class) from a QgsCategorizedSymbolRenderer. More...

#include <qgscategorizedsymbolrenderer.h>

Public Member Functions

 QgsRendererCategory ()=default
 
 QgsRendererCategory (const QgsRendererCategory &cat)
 
 QgsRendererCategory (const QVariant &value, QgsSymbol *symbol, const QString &label, bool render=true, const QString &uuid=QString())
 Constructor for a new QgsRendererCategory, with the specified value and symbol.
 
 ~QgsRendererCategory ()
 
QString dump () const
 Returns a string representing the categories settings, used for debugging purposes only.
 
QString label () const
 Returns the label for this category, which is used to represent the category within legends and the layer tree.
 
QgsRendererCategoryoperator= (QgsRendererCategory cat)
 
bool renderState () const
 Returns true if the category is currently enabled and should be rendered.
 
void setLabel (const QString &label)
 Sets the label for this category, which is used to represent the category within legends and the layer tree.
 
void setRenderState (bool render)
 Sets whether the category is currently enabled and should be rendered.
 
void setSymbol (QgsSymbol *s)
 Sets the symbol which will be used to render this category.
 
void setValue (const QVariant &value)
 Sets the value corresponding to this category.
 
QgsSymbolsymbol () const
 Returns the symbol which will be used to render this category.
 
void toSld (QDomDocument &doc, QDomElement &element, QVariantMap props) const
 Converts the category to a matching SLD rule, within the specified DOM document and element.
 
QString uuid () const
 Returns the unique identifier for this category.
 
QVariant value () const
 Returns the value corresponding to this category.
 

Protected Attributes

QString mLabel
 
bool mRender = true
 
std::unique_ptr< QgsSymbolmSymbol
 
QString mUuid
 
QVariant mValue
 

Detailed Description

Represents an individual category (class) from a QgsCategorizedSymbolRenderer.

Definition at line 35 of file qgscategorizedsymbolrenderer.h.

Constructor & Destructor Documentation

◆ QgsRendererCategory() [1/3]

QgsRendererCategory::QgsRendererCategory ( )
default

◆ QgsRendererCategory() [2/3]

QgsRendererCategory::QgsRendererCategory ( const QVariant &  value,
QgsSymbol symbol,
const QString &  label,
bool  render = true,
const QString &  uuid = QString() 
)

Constructor for a new QgsRendererCategory, with the specified value and symbol.

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

The ownership of symbol is transferred to the category.

The label argument specifies the label used for this category in legends and the layer tree.

The render argument indicates whether the category should initially be rendered and appear checked in the layer tree.

The optional uuid argument manually set the UUID key identifier for the category (since QGIS 3.34).

Definition at line 49 of file qgscategorizedsymbolrenderer.cpp.

◆ QgsRendererCategory() [3/3]

QgsRendererCategory::QgsRendererCategory ( const QgsRendererCategory cat)

Definition at line 58 of file qgscategorizedsymbolrenderer.cpp.

◆ ~QgsRendererCategory()

QgsRendererCategory::~QgsRendererCategory ( )
default

Member Function Documentation

◆ dump()

QString QgsRendererCategory::dump ( ) const

Returns a string representing the categories settings, used for debugging purposes only.

Definition at line 124 of file qgscategorizedsymbolrenderer.cpp.

◆ label()

QString QgsRendererCategory::label ( ) const

Returns the label for this category, which is used to represent the category within legends and the layer tree.

See also
setLabel()

Definition at line 94 of file qgscategorizedsymbolrenderer.cpp.

◆ operator=()

QgsRendererCategory & QgsRendererCategory::operator= ( QgsRendererCategory  cat)

Definition at line 67 of file qgscategorizedsymbolrenderer.cpp.

◆ renderState()

bool QgsRendererCategory::renderState ( ) const

Returns true if the category is currently enabled and should be rendered.

See also
setRenderState()

Definition at line 99 of file qgscategorizedsymbolrenderer.cpp.

◆ setLabel()

void QgsRendererCategory::setLabel ( const QString &  label)

Sets the label for this category, which is used to represent the category within legends and the layer tree.

See also
label()

Definition at line 114 of file qgscategorizedsymbolrenderer.cpp.

◆ setRenderState()

void QgsRendererCategory::setRenderState ( bool  render)

Sets whether the category is currently enabled and should be rendered.

See also
renderState()

Definition at line 119 of file qgscategorizedsymbolrenderer.cpp.

◆ setSymbol()

void QgsRendererCategory::setSymbol ( QgsSymbol s)

Sets the symbol which will be used to render this category.

Ownership of the symbol is transferred to the category.

See also
symbol()

Definition at line 109 of file qgscategorizedsymbolrenderer.cpp.

◆ setValue()

void QgsRendererCategory::setValue ( const QVariant &  value)

Sets the value corresponding to this category.

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

See also
value()

Definition at line 104 of file qgscategorizedsymbolrenderer.cpp.

◆ symbol()

QgsSymbol * QgsRendererCategory::symbol ( ) const

Returns the symbol which will be used to render this category.

See also
setSymbol()

Definition at line 89 of file qgscategorizedsymbolrenderer.cpp.

◆ toSld()

void QgsRendererCategory::toSld ( QDomDocument &  doc,
QDomElement &  element,
QVariantMap  props 
) const

Converts the category to a matching SLD rule, within the specified DOM document and element.

Definition at line 129 of file qgscategorizedsymbolrenderer.cpp.

◆ uuid()

QString QgsRendererCategory::uuid ( ) const

Returns the unique identifier for this category.

Since
QGIS 3.34

Definition at line 79 of file qgscategorizedsymbolrenderer.cpp.

◆ value()

QVariant QgsRendererCategory::value ( ) const

Returns the value corresponding to this category.

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

See also
setValue()

Definition at line 84 of file qgscategorizedsymbolrenderer.cpp.

Member Data Documentation

◆ mLabel

QString QgsRendererCategory::mLabel
protected

Definition at line 152 of file qgscategorizedsymbolrenderer.h.

◆ mRender

bool QgsRendererCategory::mRender = true
protected

Definition at line 153 of file qgscategorizedsymbolrenderer.h.

◆ mSymbol

std::unique_ptr<QgsSymbol> QgsRendererCategory::mSymbol
protected

Definition at line 151 of file qgscategorizedsymbolrenderer.h.

◆ mUuid

QString QgsRendererCategory::mUuid
protected

Definition at line 154 of file qgscategorizedsymbolrenderer.h.

◆ mValue

QVariant QgsRendererCategory::mValue
protected

Definition at line 150 of file qgscategorizedsymbolrenderer.h.


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