QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgsscaleexpression.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsscaleexpression.h
3  ---------------------
4  begin : November 2014
5  copyright : (C) 2014 by Vincent Mora
6  email : vincent dor mora at oslandia 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 QGSSCALEEXPRESSION_H
17 #define QGSSCALEEXPRESSION_H
18 
19 #include "qgsexpression.h"
20 
28 class CORE_EXPORT QgsScaleExpression : public QgsExpression
29 {
30  public:
31 
32  enum Type
33  {
39  };
40 
45  QgsScaleExpression( const QString &expression );
46 
58  QgsScaleExpression( Type type, const QString& baseExpression, double minValue, double maxValue, double minSize, double maxSize, double nullSize = 0, double exponent = 1 );
59 
60  operator bool() const { return ! mExpression.isEmpty(); }
61 
66  double size( double value ) const;
67 
71  double minSize() const { return mMinSize; }
72 
76  double maxSize() const { return mMaxSize; }
77 
82  double minValue() const { return mMinValue; }
83 
88  double maxValue() const { return mMaxValue; }
89 
93  double nullSize() const { return mNullSize; }
94 
98  double exponent() const { return mExponent; }
99 
103  QString baseExpression() const { return mExpression; }
104 
108  Type type() const { return mType; }
109 
110  private:
111  QString mExpression;
112  Type mType;
113  double mMinSize;
114  double mMaxSize;
115  double mMinValue;
116  double mMaxValue;
117  double mNullSize;
118  double mExponent;
119 
120  void init();
121  static QString createExpression( Type type, const QString& baseExpr, double minValue, double maxValue, double minSize, double maxSize, double nullSize, double exponent );
122 
123 };
124 
125 #endif
126 
127 
128 
Class for parsing and evaluation of expressions (formerly called "search strings").
Class storing parameters of a scale expression, which is a subclass of QgsExpression for expressions ...
double exponent() const
Returns the exponent of the exponential expression.
QString baseExpression() const
Returns the base expression string (or field reference) used for calculating the values to be mapped ...
double maxValue() const
Returns the maximum value expected by the expression.
double maxSize() const
Returns the maximum size calculated by the expression.
double minValue() const
Returns the minimum value expected by the expression.
Type type() const
Returns the scale expression's type (method used to calculate the size from a value).
double nullSize() const
Returns the size value when expression evaluates to NULL.
double minSize() const
Returns the minimum size calculated by the expression.