16 #ifndef QGSRULEBASEDRENDERER_H 17 #define QGSRULEBASEDRENDERER_H 19 #include "qgis_core.h" 91 QList<QgsRuleBasedRenderer::RenderJob *>
jobs;
106 : zIndex( other.zIndex )
120 typedef QList<QgsRuleBasedRenderer::Rule *>
RuleList;
144 const QString &label = QString(),
const QString &description = QString(),
bool elseRule =
false );
150 Rule &operator=(
const Rule &rh ) =
delete;
157 QString dump(
int indent = 0 )
const;
168 bool needsGeometry()
const;
192 bool isScaleOK(
double scale )
const;
195 QString
label()
const {
return mLabel; }
242 bool active()
const {
return mIsActive; }
257 void setSymbol(
QgsSymbol *sym SIP_TRANSFER );
258 void setLabel(
const QString &label ) { mLabel = label; }
283 void setFilterExpression(
const QString &filterExp );
290 void setDescription(
const QString &description ) { mDescription = description; }
301 void toSld( QDomDocument &doc, QDomElement &element,
QgsStringMap props )
const;
308 QDomElement save( QDomDocument &doc,
QgsSymbolMap &symbolMap )
const;
314 QSet<int> collectZLevels();
320 void setNormZLevels(
const QMap<int, int> &zLevelsToNormLevels )
SIP_SKIP;
403 void removeChildAt(
int i );
422 void setIsElse(
bool iselse );
429 bool isElse()
const {
return mElseRule; }
439 Rule *mParent =
nullptr;
440 std::unique_ptr< QgsSymbol > mSymbol;
441 double mMaximumScale = 0;
442 double mMinimumScale = 0;
443 QString mFilterExp, mLabel, mDescription;
444 bool mElseRule =
false;
447 bool mIsActive =
true;
452 std::unique_ptr< QgsExpression > mFilter;
454 QSet<int> mSymbolNormZLevels;
455 RuleList mActiveChildren;
461 void updateElseRules();
487 QSet<QString> usedAttributes(
const QgsRenderContext &context )
const override;
489 bool filterNeedsGeometry()
const override;
500 bool legendSymbolItemsCheckable()
const override;
501 bool legendSymbolItemChecked(
const QString &key )
override;
502 void checkLegendSymbolItem(
const QString &key,
bool state =
true )
override;
504 void setLegendSymbolItem(
const QString &key,
QgsSymbol *symbol SIP_TRANSFER )
override;
506 QString dump()
const override;
511 QgsFeatureRenderer::Capabilities
capabilities()
override {
return MoreSymbolsPerFeature | Filter | ScaleDependent; }
534 static void convertToDataDefinedSymbology(
QgsSymbol *symbol,
const QString &sizeScaleField,
const QString &rotationField = QString() );
553 #endif // QGSRULEBASEDRENDERER_H Class for parsing and evaluation of expressions (formerly called "search strings").
The class is used as a container of context for various read/write operations on other objects...
RenderLevel(const QgsRuleBasedRenderer::RenderLevel &other)
void setDescription(const QString &description)
Set a human readable description for this rule.
QList< QgsLegendSymbolItem > QgsLegendSymbolList
Abstract base class for all rendered symbols.
QList< QgsRuleBasedRenderer::RenderLevel > RenderQueue
Rendering queue: a list of rendering levels.
const QgsRuleBasedRenderer::RuleList & children()
Returns all children rules of this rule.
This class keeps data about a rules for rule-based renderer.
QString ruleKey() const
Unique rule identifier (for identification of rule within renderer)
void setRuleKey(const QString &key)
Override the assigned rule key (should be used just internally by rule-based renderer) ...
void setMinimumScale(double scale)
Sets the minimum map scale (i.e.
QgsRuleBasedRenderer::FeatureToRender & ftr
Feature to render.
Container of fields for a vector layer.
bool dependsOnScale() const
QList< FeatureToRender > mCurrentFeatures
QgsRuleBasedRenderer::RenderLevel & operator=(const QgsRuleBasedRenderer::RenderLevel &rh)
double maximumScale() const
Returns the maximum map scale (i.e.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QString description() const
A human readable description for this rule.
QMap< QString, QString > QgsStringMap
bool isElse() const
Check if this rule is an ELSE rule.
bool active() const
Returns if this rule is active.
QList< QgsRuleBasedRenderer::Rule * > RuleList
RenderResult
The result of rendering a rule.
QList< QgsSymbol * > QgsSymbolList
A QgsRuleBasedRenderer rendering job, consisting of a feature to be rendered with a particular symbol...
QgsExpression * filter() const
A filter that will check if this rule applies.
When drawing a vector layer with rule-based renderer, it goes through the rules and draws features wi...
QgsRuleBasedRenderer::Rule * rootRule()
QList< QgsRuleBasedRenderer::RenderJob * > jobs
List of jobs to render, owned by this object.
FeatureToRender(const QgsFeature &_f, int _flags)
QgsFeatureRenderer::Capabilities capabilities() override
Returns details about internals of this renderer.
double minimumScale() const
Returns the minimum map scale (i.e.
Render level: a list of jobs to be drawn at particular level for a QgsRuleBasedRenderer.
void setMaximumScale(double scale)
Sets the maximum map scale (i.e.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
void setActive(bool state)
Sets if this rule is active.
Contains information about the context of a rendering operation.
void setLabel(const QString &label)
QMap< QString, QgsSymbol *> QgsSymbolMap
RenderJob(QgsRuleBasedRenderer::FeatureToRender &_ftr, QgsSymbol *_s)
Custom exception class for Coordinate Reference System related exceptions.
Feature for rendering by a QgsRuleBasedRenderer.
QString filterExpression() const
A filter that will check if this rule applies.
QgsRuleBasedRenderer::Rule * parent()
The parent rule.