QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgssinglesymbolrenderer.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssinglesymbolrenderer.h
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSSINGLESYMBOLRENDERER_H
16#define QGSSINGLESYMBOLRENDERER_H
17
18#include "qgis_core.h"
19#include "qgis.h"
20#include "qgsrenderer.h"
21
23class QgsSymbol;
24
30{
31 public:
32
41
42 Qgis::FeatureRendererFlags flags() const override;
43 QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
44 QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
45 void startRender( QgsRenderContext &context, const QgsFields &fields ) override;
46 void stopRender( QgsRenderContext &context ) override;
47 QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
48 bool accept( QgsStyleEntityVisitorInterface *visitor ) const override;
49
54 QgsSymbol *symbol() const;
55
61 void setSymbol( QgsSymbol *s SIP_TRANSFER );
62
63 QString dump() const override;
64
66
67 void toSld( QDomDocument &doc, QDomElement &element, const QVariantMap &props = QVariantMap() ) const override;
68
76 static QgsFeatureRenderer *createFromSld( QDomElement &element, Qgis::GeometryType geomType ) SIP_FACTORY;
77
78 QgsFeatureRenderer::Capabilities capabilities() override { return SymbolLevels; }
79 QgsSymbolList symbols( QgsRenderContext &context ) const override;
80
86 static QgsFeatureRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
87
88 QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) override;
90 QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
91 QString legendKeyToExpression( const QString &key, QgsVectorLayer *layer, bool &ok ) const override;
92 void setLegendSymbolItem( const QString &key, QgsSymbol *symbol SIP_TRANSFER ) override;
93
98 static QgsSingleSymbolRenderer *convertFromRenderer( const QgsFeatureRenderer *renderer ) SIP_FACTORY;
99
109 void setDataDefinedSizeLegend( QgsDataDefinedSizeLegend *settings SIP_TRANSFER );
110
115 QgsDataDefinedSizeLegend *dataDefinedSizeLegend() const;
116
117 protected:
118 std::unique_ptr<QgsSymbol> mSymbol;
119 std::unique_ptr<QgsDataDefinedSizeLegend> mDataDefinedSizeLegend;
120
121 private:
122#ifdef SIP_RUN
125#endif
126
127};
128
129
130#endif // QGSSINGLESYMBOLRENDERER_H
The Qgis class provides global constants for use throughout the application.
Definition qgis.h:54
QFlags< FeatureRendererFlag > FeatureRendererFlags
Flags controlling behavior of vector feature renderers.
Definition qgis.h:772
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Abstract base class for all 2D vector feature renderers.
virtual QgsLegendSymbolList legendSymbolItems() const
Returns a list of symbology items for the legend.
virtual void setLegendSymbolItem(const QString &key, QgsSymbol *symbol)
Sets the symbol to be used for a legend symbol item.
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.
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
QFlags< Capability > Capabilities
virtual QSet< QString > legendKeysForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns legend keys matching a specified feature.
virtual QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context)
Stores renderer properties to an XML element.
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.
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...
@ SymbolLevels
Rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
virtual bool accept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified symbology visitor, causing it to visit all symbols associated with the renderer...
virtual QgsSymbol * originalSymbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns symbol for feature.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
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...
Definition qgsfeature.h:58
Container of fields for a vector layer.
Definition qgsfields.h:46
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
std::unique_ptr< QgsSymbol > mSymbol
~QgsSingleSymbolRenderer() override
std::unique_ptr< QgsDataDefinedSizeLegend > mDataDefinedSizeLegend
An interface for classes which can visit style entity (e.g.
Abstract base class for all rendered symbols.
Definition qgssymbol.h:231
Represents a vector layer which manages a vector based data sets.
#define SIP_TRANSFER
Definition qgis_sip.h:36
#define SIP_FACTORY
Definition qgis_sip.h:76
QList< QgsLegendSymbolItem > QgsLegendSymbolList
QList< QgsSymbol * > QgsSymbolList
Definition qgsrenderer.h:47