QGIS API Documentation  2.6.0-Brighton
 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:
35  QgsLegendSymbolItemV2( QgsSymbolV2* symbol, const QString& label, const QString& ruleKey, bool checkable = false, int scaleMinDenom = -1, int scaleMaxDenom = -1, int level = 0 );
38  QgsLegendSymbolItemV2& operator=( const QgsLegendSymbolItemV2& other );
39 
41  QgsSymbolV2* symbol() const { return mSymbol; }
43  QString label() const { return mLabel; }
45  QString ruleKey() const { return mKey; }
47  bool isCheckable() const { return mCheckable; }
48 
50  QgsSymbolV2* legacyRuleKey() const { return mOriginalSymbolPointer; }
51 
53  bool isScaleOK( double scale ) const;
56  int scaleMinDenom() const { return mScaleMinDenom; }
59  int scaleMaxDenom() const { return mScaleMaxDenom; }
60 
62  int level() const { return mLevel; }
63 
64  protected:
66  void setSymbol( QgsSymbolV2* s );
67 
68  private:
70  QgsSymbolV2* mSymbol;
72  QString mLabel;
74  QString mKey;
76  bool mCheckable;
77 
78  QgsSymbolV2* mOriginalSymbolPointer;
79 
80  // additional data that may be used for filtering
81 
82  int mScaleMinDenom;
83  int mScaleMaxDenom;
84 
86  int mLevel;
87 };
88 
89 
90 typedef QList< QgsLegendSymbolItemV2 > QgsLegendSymbolListV2;
91 
92 #endif // QGSLEGENDSYMBOLITEMV2_H