QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsembeddedsymbolrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsembeddedsymbolrenderer.h
3  ---------------------
4  begin : March 2021
5  copyright : (C) 2021 by Nyall Dawson
6  email : nyall dot dawson 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 QGSEMBEDDEDSYMBOLRENDERER_H
16 #define QGSEMBEDDEDSYMBOLRENDERER_H
17 
18 #include "qgis_core.h"
19 #include "qgis.h"
20 #include "qgsrenderer.h"
21 
36 {
37  public:
38 
46  ~QgsEmbeddedSymbolRenderer() override;
47 
48  QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
49  QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
50  void startRender( QgsRenderContext &context, const QgsFields &fields ) override;
51  bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false ) SIP_THROW( QgsCsException ) override;
52  void stopRender( QgsRenderContext &context ) override;
53  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
54  bool usesEmbeddedSymbols() const override;
56  QgsFeatureRenderer::Capabilities capabilities() override;
57  QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) override;
58  QgsSymbolList symbols( QgsRenderContext &context ) const override;
59 
64  QgsSymbol *defaultSymbol() const;
65 
73  void setDefaultSymbol( QgsSymbol *symbol SIP_TRANSFER );
74 
80  static QgsFeatureRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
81 
86  static QgsEmbeddedSymbolRenderer *convertFromRenderer( const QgsFeatureRenderer *renderer ) SIP_FACTORY;
87 
88  private:
89 #ifdef SIP_RUN
92 #endif
93 
94  std::unique_ptr<QgsSymbol> mDefaultSymbol;
95 
96 };
97 
98 
99 #endif // QGSEMBEDDEDSYMBOLRENDERER_H
QgsFeatureRenderer::originalSymbolForFeature
virtual QgsSymbol * originalSymbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns symbol for feature.
Definition: qgsrenderer.cpp:84
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:34
QgsFeatureRenderer::capabilities
virtual QgsFeatureRenderer::Capabilities capabilities()
Returns details about internals of this renderer.
Definition: qgsrenderer.h:283
QgsFields
Container of fields for a vector layer.
Definition: qgsfields.h:44
qgis.h
QgsRenderContext
Contains information about the context of a rendering operation.
Definition: qgsrendercontext.h:59
QgsFeatureRenderer::usedAttributes
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const =0
Returns a list of attributes required by this renderer.
QgsSymbol
Abstract base class for all rendered symbols.
Definition: qgssymbol.h:92
QgsFeatureRenderer::stopRender
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
Definition: qgsrenderer.cpp:110
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsFeatureRenderer::usesEmbeddedSymbols
virtual bool usesEmbeddedSymbols() const
Returns true if the renderer uses embedded symbols for features.
Definition: qgsrenderer.cpp:117
QgsFeatureRenderer::save
virtual QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context)
Stores renderer properties to an XML element.
Definition: qgsrenderer.cpp:193
QgsCsException
Custom exception class for Coordinate Reference System related exceptions.
Definition: qgsexception.h:65
SIP_THROW
#define SIP_THROW(name)
Definition: qgis_sip.h:198
QgsSymbolList
QList< QgsSymbol * > QgsSymbolList
Definition: qgsrenderer.h:44
QgsFeatureRenderer::clone
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
SIP_TRANSFER
#define SIP_TRANSFER
Definition: qgis_sip.h:36
QgsFeatureRenderer::symbols
virtual QgsSymbolList symbols(QgsRenderContext &context) const
Returns list of symbols used by the renderer.
Definition: qgsrenderer.cpp:151
QgsFeatureRenderer::symbolForFeature
virtual QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const =0
To be overridden.
qgsrenderer.h
QgsFeatureRenderer
Definition: qgsrenderer.h:101
QgsEmbeddedSymbolRenderer
A vector feature renderer which uses embedded feature symbology to render per-feature symbols.
Definition: qgsembeddedsymbolrenderer.h:35
QgsFeatureRenderer::renderFeature
virtual bool renderFeature(const QgsFeature &feature, QgsRenderContext &context, int layer=-1, bool selected=false, bool drawVertexMarker=false) SIP_THROW(QgsCsException)
Render a feature using this renderer in the given context.
Definition: qgsrenderer.cpp:127
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:55
QgsFeatureRenderer::startRender
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)
Must be called when a new render cycle is started.
Definition: qgsrenderer.cpp:96