QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
15 #ifndef QGSCATEGORIZEDSYMBOLRENDERER_H
16 #define QGSCATEGORIZEDSYMBOLRENDERER_H
18 #include "qgis_core.h"
71 QVariant value()
const;
84 QString label()
const;
93 void setValue(
const QVariant &value );
109 void setLabel(
const QString &label );
116 bool renderState()
const;
123 void setRenderState(
bool render );
130 QString dump()
const;
135 void toSld( QDomDocument &doc, QDomElement &element, QVariantMap props )
const;
138 SIP_PYOBJECT __repr__();
140 const QString
str = !sipCpp->value().isValid()
141 ? QStringLiteral(
"<QgsRendererCategory>" )
142 : sipCpp->label().isEmpty()
143 ? QStringLiteral(
"<QgsRendererCategory: %1>" ).arg( sipCpp->value().toString() )
144 : QStringLiteral(
"<QgsRendererCategory: %1 (%2)>" ).arg( sipCpp->value().toString(), sipCpp->label() );
145 sipRes = PyUnicode_FromString(
str.toUtf8().constData() );
185 QString
dump()
const override;
187 void toSld( QDomDocument &doc, QDomElement &element,
const QVariantMap &props = QVariantMap() )
const override;
209 int categoryIndexForValue(
const QVariant &val );
215 int categoryIndexForLabel(
const QString &val );
226 bool updateCategoryValue(
int catIndex,
const QVariant &value );
249 bool updateCategoryLabel(
int catIndex,
const QString &label );
263 bool updateCategoryRenderState(
int catIndex,
bool render );
277 bool deleteCategory(
int catIndex );
284 void deleteAllCategories();
289 void moveCategory(
int from,
int to );
296 void sortByValue( Qt::SortOrder order = Qt::AscendingOrder );
303 void sortByLabel( Qt::SortOrder order = Qt::AscendingOrder );
389 bool legendSymbolItemsCheckable() const override;
390 bool legendSymbolItemChecked( const QString &key ) override;
392 void checkLegendSymbolItem( const QString &key,
bool state = true ) override;
393 QString legendClassificationAttribute()
const override {
return classAttribute(); }
441 int matchToSymbols(
QgsStyle *style,
Qgis::SymbolType type,
442 QVariantList &unmatchedCategories
SIP_OUT, QStringList &unmatchedSymbols
SIP_OUT,
bool caseSensitive = true,
bool useTolerantMatch = false );
466 static QString displayString( const QVariant &value,
int precision = -1 );
483 bool mCounting = false;
529 #endif // QGSCATEGORIZEDSYMBOLRENDERER_H
Abstract base class for color ramps.
@ Filter
Features may be filtered, i.e. some features may not be rendered (categorized, rule based ....
virtual QgsSymbol * originalSymbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns symbol for feature.
The class is used as a container of context for various read/write operations on other objects.
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
const QgsCategoryList & categories() const
Returns a list of all categories recognized by the renderer.
Container of fields for a vector layer.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Represents an individual category (class) from a QgsCategorizedSymbolRenderer.
Contains information about the context of a rendering operation.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const =0
Returns a list of attributes required by this renderer.
An interface for classes which can visit style entity (e.g. symbol) nodes (using the visitor pattern)...
virtual QgsLegendSymbolList legendSymbolItems() const
Returns a list of symbology items for the legend.
Abstract base class for all rendered symbols.
void setClassAttribute(const QString &attr)
Sets the class attribute for the renderer, which is the field name or expression string from the laye...
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
virtual QString filter(const QgsFields &fields=QgsFields())
If a renderer does not require all the features this method may be overridden and return an expressio...
std::unique_ptr< GEOSGeometry, GeosDeleter > unique_ptr
Scoped GEOS pointer.
virtual QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context)
Stores renderer properties to an XML element.
virtual bool filterNeedsGeometry() const
Returns true if this renderer requires the geometry to apply the filter.
QList< QgsRendererCategory > QgsCategoryList
QList< QgsSymbol * > QgsSymbolList
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
virtual void toSld(QDomDocument &doc, QDomElement &element, const QVariantMap &props=QVariantMap()) const
used from subclasses to create SLD Rule elements following SLD v1.1 specs
virtual QgsSymbolList symbols(QgsRenderContext &context) const
Returns list of symbols used by the renderer.
virtual QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const =0
To be overridden.
virtual QString legendKeyToExpression(const QString &key, QgsVectorLayer *layer, bool &ok) const
Attempts to convert the specified legend rule key to a QGIS expression matching the features displaye...
QgsFeatureRenderer::Capabilities capabilities() override
Returns details about internals of this renderer.
Represents a vector layer which manages a vector based data sets.
The Qgis class provides global constants for use throughout the application.
virtual QString dump() const
Returns debug information about this renderer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Class for parsing and evaluation of expressions (formerly called "search strings")....
QList< QgsLegendSymbolItem > QgsLegendSymbolList
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
QString classAttribute() const
Returns the class attribute for the renderer, which is the field name or expression string from the l...
virtual QSet< QString > legendKeysForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns legend keys matching a specified feature.
std::unique_ptr< QgsSymbol > mSymbol