Branch data Line data Source code
1 : : /*************************************************************************** 2 : : qgsfeaturerenderergenerator.h 3 : : ----------------------- 4 : : Date : December 2020 5 : : Copyright : (C) 2020 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 : : 16 : : #ifndef QGSFEATURERENDERERGENERATOR_H 17 : : #define QGSFEATURERENDERERGENERATOR_H 18 : : 19 : : #include "qgis_core.h" 20 : : #include "qgis_sip.h" 21 : : #include <QString> 22 : : 23 : : class QgsFeatureRenderer; 24 : : 25 : : /** 26 : : * \ingroup core 27 : : * \class QgsFeatureRendererGenerator 28 : : * \brief An interface for objects which generate feature renderers for vector layers. 29 : : * \since QGIS 3.18 30 : : */ 31 : : class CORE_EXPORT QgsFeatureRendererGenerator 32 : : { 33 : : public: 34 : : 35 : 0 : virtual ~QgsFeatureRendererGenerator() = default; 36 : : 37 : : /** 38 : : * Returns a unique ID string identifying the renderer generator. 39 : : */ 40 : : virtual QString id() const = 0; 41 : : 42 : : /** 43 : : * Returns a double value which dictates the stacking or z order level associated with 44 : : * the returned renderer. 45 : : * 46 : : * A value > 0 will always be rendered AFTER the normal renderer for a vector layer (i.e. the 47 : : * renderer will be drawn on top of the normal feature renderer), while a value < 0 will always 48 : : * be rendered BEFORE the normal renderer (i.e. the rendered features will be drawn below the 49 : : * normal feature renderer). 50 : : * 51 : : * Since a layer may potentially have multiple extra renderers created by QgsFeatureRendererGenerator 52 : : * subclasses, the level will always be used to control the order that these renderers are drawn. 53 : : * A renderer with a lower level() return value will always be drawn before those with a higher level() 54 : : * value. 55 : : * 56 : : * The default implementation returns 1.0, i.e. features will be rendered ABOVE the normal 57 : : * vector layer renderer. 58 : : * 59 : : * \note If two QgsFeatureRendererGenerator implementations return the same level() value, then their 60 : : * ordering will be unpredictable. 61 : : */ 62 : : virtual double level() const; 63 : : 64 : : /** 65 : : * Creates a new feature renderer to use when rendering a vector layer. 66 : : * 67 : : * Caller takes ownership of the returned renderer. 68 : : */ 69 : : virtual QgsFeatureRenderer *createRenderer() const = 0 SIP_FACTORY; 70 : : }; 71 : : 72 : : #endif // QGSFEATURERENDERERGENERATOR_H