QGIS API Documentation  3.2.0-Bonn (bc43194)
qgsnullsymbolrenderer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsnullsymbolrenderer.h
3  ---------------------
4  begin : November 2014
5  copyright : (C) 2014 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 QGSNULLSYMBOLRENDERER_H
16 #define QGSNULLSYMBOLRENDERER_H
17 
18 #include "qgis_core.h"
19 #include "qgis.h"
20 #include "qgsrenderer.h"
21 #include "qgssymbol.h"
22 
31 class CORE_EXPORT QgsNullSymbolRenderer : public QgsFeatureRenderer
32 {
33  public:
34 
36 
37  QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
38  QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
39 
40  bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false ) override;
41  void stopRender( QgsRenderContext &context ) override;
42  bool willRenderFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
43 
44  QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
45  QString dump() const override;
46  QgsFeatureRenderer *clone() const override SIP_FACTORY;
47  QgsSymbolList symbols( QgsRenderContext &context ) const override;
48 
55  static QgsFeatureRenderer *create( QDomElement &element, const QgsReadWriteContext &context ) SIP_FACTORY;
56 
57  QDomElement save( QDomDocument &doc, const QgsReadWriteContext &context ) override;
58 
64  static QgsNullSymbolRenderer *convertFromRenderer( const QgsFeatureRenderer *renderer ) SIP_FACTORY;
65 
66  private:
67 
69  std::unique_ptr<QgsSymbol> mSymbol;
70 
71 };
72 
73 #endif // QGSNULLSYMBOLRENDERER_H
The class is used as a container of context for various read/write operations on other objects...
virtual QDomElement save(QDomDocument &doc, const QgsReadWriteContext &context)
store renderer info to XML element
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Definition: qgsfeature.h:62
virtual QgsSymbol * symbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const =0
To be overridden.
virtual QSet< QString > usedAttributes(const QgsRenderContext &context) const =0
Returns a list of attributes required by this renderer.
QList< QgsSymbol * > QgsSymbolList
Definition: qgsrenderer.h:43
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.
Null symbol renderer.
virtual QgsSymbol * originalSymbolForFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns symbol for feature.
Definition: qgsrenderer.cpp:80
#define SIP_FACTORY
Definition: qgis_sip.h:69
Contains information about the context of a rendering operation.
virtual QgsSymbolList symbols(QgsRenderContext &context) const
Returns list of symbols used by the renderer.
virtual void stopRender(QgsRenderContext &context)
Must be called when a render cycle has finished, to allow the renderer to clean up.
virtual bool willRenderFeature(const QgsFeature &feature, QgsRenderContext &context) const
Returns whether the renderer will render a feature or not.
virtual QgsFeatureRenderer * clone() const =0
Create a deep copy of this renderer.
virtual QString dump() const
Returns debug information about this renderer.