QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgseffectstack.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgseffectstack.h
3  ----------------
4  begin : December 2014
5  copyright : (C) 2014 Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef QGSEFFECTSTACK_H
18 #define QGSEFFECTSTACK_H
19 
20 #include "qgspainteffect.h"
21 
41 class CORE_EXPORT QgsEffectStack : public QgsPaintEffect
42 {
43 
44  public:
45 
51  static QgsPaintEffect* create( const QgsStringMap& map );
52 
54  QgsEffectStack( const QgsEffectStack& other );
55 
61  explicit QgsEffectStack( const QgsPaintEffect& effect );
62 
63  virtual ~QgsEffectStack();
64 
65  virtual QString type() const override { return QString( "effectStack" ); }
66  virtual QgsEffectStack* clone() const override;
67  virtual bool saveProperties( QDomDocument& doc, QDomElement& element ) const override;
68  virtual bool readProperties( const QDomElement& element ) override;
69 
72  virtual QgsStringMap properties() const override;
73 
76  virtual void readProperties( const QgsStringMap& props ) override;
77 
83  void appendEffect( QgsPaintEffect* effect );
84 
91  bool insertEffect( const int index, QgsPaintEffect* effect );
92 
98  bool changeEffect( const int index, QgsPaintEffect *effect );
99 
103  QgsPaintEffect* takeEffect( const int index );
104 
109  QList< QgsPaintEffect* >* effectList();
110 
114  int count() const { return mEffectList.count(); }
115 
120  QgsPaintEffect* effect( int index ) const;
121 
122  QgsEffectStack& operator=( const QgsEffectStack& rhs );
123 
124  protected:
125 
126  virtual void draw( QgsRenderContext& context ) override;
127 
128  private:
129 
130  QList< QgsPaintEffect* > mEffectList;
131 
132  void clearStack();
133 };
134 
135 #endif // QGSEFFECTSTACK_H
136 
static unsigned index
virtual QgsStringMap properties() const =0
Returns the properties describing the paint effect encoded in a string format.
Base class for visual effects which can be applied to QPicture drawings.
virtual QString type() const override
Returns the effect type.
virtual QgsPaintEffect * clone() const =0
Duplicates an effect by creating a deep copy of the effect.
int count() const
Returns count of effects contained by the stack.
A paint effect which consists of a stack of other chained paint effects.
virtual void readProperties(const QgsStringMap &props)=0
Reads a string map of an effect&#39;s properties and restores the effect to the state described by the pr...
Contains information about the context of a rendering operation.
friend class QgsEffectStack
virtual void draw(QgsRenderContext &context)=0
Handles drawing of the effect&#39;s result on to the specified render context.
virtual bool saveProperties(QDomDocument &doc, QDomElement &element) const
Saves the current state of the effect to a DOM element.