QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgslegendsymbolitemv2.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslegendsymbolitemv2.h
3  --------------------------------------
4  Date : August 2014
5  Copyright : (C) 2014 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 
16 #ifndef QGSLEGENDSYMBOLITEMV2_H
17 #define QGSLEGENDSYMBOLITEMV2_H
18 
19 #include <QString>
20 
21 class QgsSymbolV2;
22 
30 class CORE_EXPORT QgsLegendSymbolItemV2
31 {
32  public:
36  QgsLegendSymbolItemV2( QgsSymbolV2* symbol, const QString& label, const QString& ruleKey, bool checkable = false, int scaleMinDenom = -1, int scaleMaxDenom = -1, int level = 0, const QString& parentRuleKey = QString() );
39  QgsLegendSymbolItemV2& operator=( const QgsLegendSymbolItemV2& other );
40 
42  QgsSymbolV2* symbol() const { return mSymbol; }
44  QString label() const { return mLabel; }
46  QString ruleKey() const { return mKey; }
48  bool isCheckable() const { return mCheckable; }
49 
51  QgsSymbolV2* legacyRuleKey() const { return mOriginalSymbolPointer; }
52 
54  bool isScaleOK( double scale ) const;
57  int scaleMinDenom() const { return mScaleMinDenom; }
60  int scaleMaxDenom() const { return mScaleMaxDenom; }
61 
63  int level() const { return mLevel; }
64 
67  QString parentRuleKey() const { return mParentKey; }
68 
69  protected:
71  void setSymbol( QgsSymbolV2* s );
72 
73  private:
75  QgsSymbolV2* mSymbol;
77  QString mLabel;
79  QString mKey;
81  bool mCheckable;
82 
83  QgsSymbolV2* mOriginalSymbolPointer;
84 
85  // additional data that may be used for filtering
86 
87  int mScaleMinDenom;
88  int mScaleMaxDenom;
89 
91  int mLevel;
93  QString mParentKey;
94 };
95 
96 
97 typedef QList< QgsLegendSymbolItemV2 > QgsLegendSymbolListV2;
98 
99 #endif // QGSLEGENDSYMBOLITEMV2_H