16#ifndef QGSRULEBASEDRENDERER_H
17#define QGSRULEBASEDRENDERER_H
108 QList<QgsRuleBasedRenderer::RenderJob *>
jobs;
115 for (
auto it = rh.
jobs.constBegin(); it != rh.
jobs.constEnd(); ++it )
123 : zIndex( other.zIndex ), jobs()
125 for (
auto it = other.
jobs.constBegin(); it != other.
jobs.constEnd(); ++it )
137 typedef QList<QgsRuleBasedRenderer::Rule *>
RuleList;
162 const QString &label = QString(),
const QString &description = QString(),
bool elseRule =
false );
173 QString
dump(
int indent = 0 )
const;
184 bool needsGeometry()
const;
209 bool isScaleOK(
double scale )
const;
212 QString
label()
const {
return mLabel; }
257 bool active()
const {
return mIsActive; }
271 void setLabel(
const QString &label ) { mLabel = label; }
296 void setFilterExpression(
const QString &filterExp );
303 void setDescription(
const QString &description ) { mDescription = description; }
319 Q_DECL_DEPRECATED
void toSld( QDomDocument &doc, QDomElement &element, QVariantMap props ) const
SIP_DEPRECATED;
333 QDomElement save( QDomDocument &doc,
QgsSymbolMap &symbolMap ) const;
345 bool hasActiveChildren() const;
348 QSet<
int> collectZLevels();
354 void setNormZLevels( const QMap<
int,
int> &zLevelsToNormLevels )
SIP_SKIP;
437 void removeChildAt(
int i );
455 void setIsElse(
bool iselse );
462 bool isElse()
const {
return mElseRule; }
483 Rule *mParent =
nullptr;
484 std::unique_ptr< QgsSymbol > mSymbol;
485 double mMaximumScale = 0;
486 double mMinimumScale = 0;
487 QString mFilterExp, mLabel, mDescription;
488 bool mElseRule =
false;
491 bool mIsActive =
true;
496 std::unique_ptr< QgsExpression > mFilter;
498 QSet<int> mSymbolNormZLevels;
505 void updateElseRules();
527 bool canSkipRender() override;
532 QSet<QString> usedAttributes( const
QgsRenderContext &context ) const override;
534 bool filterNeedsGeometry() const override;
538 Q_DECL_DEPRECATED
void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override
SIP_DEPRECATED;
539 bool toSld( QDomDocument &doc, QDomElement &element,
QgsSldExportContext &context ) const override;
549 bool legendSymbolItemsCheckable() const override;
550 bool legendSymbolItemChecked( const QString &key ) override;
551 void checkLegendSymbolItem( const QString &key,
bool state = true ) override;
552 QString legendKeyToExpression( const QString &key,
QgsVectorLayer *layer,
bool &ok ) const override;
556 QString dump() const override;
587 static
void convertToDataDefinedSymbology(
QgsSymbol *symbol, const QString &sizeScaleField, const QString &rotationField = QString() );
Provides global constants and enumerations for use throughout the application.
QFlags< FeatureRendererFlag > FeatureRendererFlags
Flags controlling behavior of vector feature renderers.
A feature renderer which represents features using a list of renderer categories.
Custom exception class for Coordinate Reference System related exceptions.
Handles parsing and evaluation of expressions (formerly called "search strings").
Abstract base class for all 2D vector feature renderers.
virtual QgsLegendSymbolList legendSymbolItems() const
Returns a list of symbology items for the legend.
virtual QgsSymbolList symbols(QgsRenderContext &context) const
Returns list of symbols used by the renderer.
virtual Qgis::FeatureRendererFlags flags() const
Returns flags associated with the renderer.
QFlags< Capability > Capabilities
virtual bool renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false)
Render a feature using this renderer in the given context.
virtual QString dump() const
Returns debug information about this renderer.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const =0
Returns a list of attributes required by this renderer.
virtual QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const =0
To be overridden.
@ ScaleDependent
Depends on scale if feature will be rendered (rule based )
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Container of fields for a vector layer.
A vector feature renderer which uses numeric attributes to classify features into different ranges.
A container for the context for various read/write operations on objects.
Contains information about the context of a rendering operation.
Represents an individual rule for a rule-based renderer.
QString ruleKey() const
Unique rule identifier (for identification of rule within renderer)
void setDescription(const QString &description)
Set a human readable description for this rule.
bool dependsOnScale() const
RenderResult
The result of rendering a rule.
@ Inactive
The rule is inactive.
double maximumScale() const
Returns the maximum map scale (i.e.
QgsRuleBasedRenderer::Rule * parent()
The parent rule.
bool isElse() const
Check if this rule is an ELSE rule.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
void setActive(bool state)
Sets if this rule is active.
Rule(const Rule &rh)=delete
Rule & operator=(const Rule &rh)=delete
QgsExpression * filter() const
A filter that will check if this rule applies.
double minimumScale() const
Returns the minimum map scale (i.e.
QString description() const
A human readable description for this rule.
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
void setLabel(const QString &label)
void setRuleKey(const QString &key)
Override the assigned rule key (should be used just internally by rule-based renderer)
QString filterExpression() const
A filter that will check if this rule applies.
bool active() const
Returns if this rule is active.
QList< QgsRuleBasedRenderer::RenderLevel > RenderQueue
Rendering queue: a list of rendering levels.
QList< QgsRuleBasedRenderer::Rule * > RuleList
QgsRuleBasedRenderer::Rule * rootRule()
Holds SLD export options and other information related to SLD export of a QGIS layer style.
An interface for classes which can visit style entity (e.g.
Abstract base class for all rendered symbols.
Represents a vector layer which manages a vector based dataset.
#define SIP_THROW(name,...)
QList< QgsLegendSymbolItem > QgsLegendSymbolList
QMap< QString, QgsSymbol * > QgsSymbolMap
QList< QgsSymbol * > QgsSymbolList
Feature for rendering by a QgsRuleBasedRenderer.
FeatureToRender(const QgsFeature &_f, int _flags)
A QgsRuleBasedRenderer rendering job, consisting of a feature to be rendered with a particular symbol...
RenderJob(const QgsRuleBasedRenderer::FeatureToRender &_ftr, QgsSymbol *_s)
Constructor for a render job, with the specified feature to render and symbol.
QgsRuleBasedRenderer::FeatureToRender ftr
Feature to render.
Render level: a list of jobs to be drawn at particular level for a QgsRuleBasedRenderer.
QList< QgsRuleBasedRenderer::RenderJob * > jobs
List of jobs to render, owned by this object.
QgsRuleBasedRenderer::RenderLevel & operator=(const QgsRuleBasedRenderer::RenderLevel &rh)
RenderLevel(const QgsRuleBasedRenderer::RenderLevel &other)