QGIS API Documentation  3.4.15-Madeira (e83d02e274)
Public Member Functions | Protected 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
 Constructor for QgsRendererCategory. More...
 
 QgsRendererCategory (const QVariant &value, QgsSymbol *symbol, const QString &label, bool render=true)
 Constructor for a new QgsRendererCategory, with the specified value and symbol. More...
 
 QgsRendererCategory (const QgsRendererCategory &cat)
 Copy constructor. More...
 
QString dump () const
 Returns a string representing the categories settings, used for debugging purposes only. More...
 
QString label () const
 Returns the label for this category, which is used to represent the category within legends and the layer tree. More...
 
QgsRendererCategoryoperator= (QgsRendererCategory cat)
 
bool renderState () const
 Returns true if the category is currently enabled and should be rendered. More...
 
void setLabel (const QString &label)
 Sets the label for this category, which is used to represent the category within legends and the layer tree. More...
 
void setRenderState (bool render)
 Sets whether the category is currently enabled and should be rendered. More...
 
void setSymbol (QgsSymbol *s)
 Sets the symbol which will be used to render this category. More...
 
void setValue (const QVariant &value)
 Sets the value corresponding to this category. More...
 
QgsSymbolsymbol () const
 Returns the symbol which will be used to render this category. More...
 
void toSld (QDomDocument &doc, QDomElement &element, QgsStringMap props) const
 Converts the category to a matching SLD rule, within the specified DOM document and element. More...
 
QVariant value () const
 Returns the value corresponding to this category. More...
 

Protected Member Functions

void swap (QgsRendererCategory &other)
 

Protected Attributes

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

Detailed Description

Represents an individual category (class) from a QgsCategorizedSymbolRenderer.

Definition at line 35 of file qgscategorizedsymbolrenderer.h.

Constructor & Destructor Documentation

QgsRendererCategory::QgsRendererCategory ( )
default

Constructor for QgsRendererCategory.

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

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

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.

Definition at line 38 of file qgscategorizedsymbolrenderer.cpp.

QgsRendererCategory::QgsRendererCategory ( const QgsRendererCategory cat)

Copy constructor.

Definition at line 46 of file qgscategorizedsymbolrenderer.cpp.

Member Function Documentation

QString QgsRendererCategory::dump ( ) const

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

Definition at line 108 of file qgscategorizedsymbolrenderer.cpp.

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 78 of file qgscategorizedsymbolrenderer.cpp.

QgsRendererCategory & QgsRendererCategory::operator= ( QgsRendererCategory  cat)

Definition at line 55 of file qgscategorizedsymbolrenderer.cpp.

bool QgsRendererCategory::renderState ( ) const

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

See also
setRenderState()
Since
QGIS 2.5

Definition at line 83 of file qgscategorizedsymbolrenderer.cpp.

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 98 of file qgscategorizedsymbolrenderer.cpp.

void QgsRendererCategory::setRenderState ( bool  render)

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

See also
renderState()
Since
QGIS 2.5

Definition at line 103 of file qgscategorizedsymbolrenderer.cpp.

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 93 of file qgscategorizedsymbolrenderer.cpp.

void QgsRendererCategory::setValue ( const QVariant &  value)

Sets the value corresponding to this category.

See also
value()

Definition at line 88 of file qgscategorizedsymbolrenderer.cpp.

void QgsRendererCategory::swap ( QgsRendererCategory other)
protected

Definition at line 61 of file qgscategorizedsymbolrenderer.cpp.

QgsSymbol * QgsRendererCategory::symbol ( ) const

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

See also
setSymbol()

Definition at line 73 of file qgscategorizedsymbolrenderer.cpp.

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

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

Definition at line 113 of file qgscategorizedsymbolrenderer.cpp.

QVariant QgsRendererCategory::value ( ) const

Returns the value corresponding to this category.

See also
setValue()

Definition at line 68 of file qgscategorizedsymbolrenderer.cpp.

Member Data Documentation

QString QgsRendererCategory::mLabel
protected

Definition at line 131 of file qgscategorizedsymbolrenderer.h.

bool QgsRendererCategory::mRender = true
protected

Definition at line 132 of file qgscategorizedsymbolrenderer.h.

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

Definition at line 130 of file qgscategorizedsymbolrenderer.h.

QVariant QgsRendererCategory::mValue
protected

Definition at line 129 of file qgscategorizedsymbolrenderer.h.


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