QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
70  void setSymbol( QgsSymbolV2* s );
71 
72  private:
74  QgsSymbolV2* mSymbol;
76  QString mLabel;
78  QString mKey;
80  bool mCheckable;
81 
82  QgsSymbolV2* mOriginalSymbolPointer;
83 
84  // additional data that may be used for filtering
85 
86  int mScaleMinDenom;
87  int mScaleMaxDenom;
88 
90  int mLevel;
92  QString mParentKey;
93 };
94 
95 
97 
98 #endif // QGSLEGENDSYMBOLITEMV2_H
int scaleMinDenom() const
Min scale denominator of the scale range.
QString ruleKey() const
Return unique identifier of the rule for identification of the item within renderer.
QString parentRuleKey() const
Key of the parent legend node.
bool isCheckable() const
Return whether the item is user-checkable - whether renderer supports enabling/disabling it...
QString label() const
Return text label.
int scaleMaxDenom() const
Max scale denominator of the scale range.
QgsSymbolV2 * symbol() const
Return associated symbol. May be null.
QgsSymbolV2 * legacyRuleKey() const
Used for older code that identifies legend entries from symbol pointer within renderer.
QList< QgsLegendSymbolItemV2 > QgsLegendSymbolListV2
int level() const
Identation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0...
The class stores information about one class/rule of a vector layer renderer in a unified way that ca...