QGIS API Documentation
2.10.1-Pisa
|
Class storing parameters of a scale expression, which is a subclass of QgsExpression for expressions which return a size or width. More...
#include <qgsscaleexpression.h>
Public Types | |
enum | Type { Linear, Area, Flannery, Unknown } |
Public Types inherited from QgsExpression | |
enum | BinaryOperator { boOr, boAnd, boEQ, boNE, boLE, boGE, boLT, boGT, boRegexp, boLike, boNotLike, boILike, boNotILike, boIs, boIsNot, boPlus, boMinus, boMul, boDiv, boIntDiv, boMod, boPow, boConcat } |
list of binary operators More... | |
typedef QVariant(* | FcnEval )(const QVariantList &values, const QgsFeature *f, QgsExpression *parent) |
enum | NodeType { ntUnaryOperator, ntBinaryOperator, ntInOperator, ntFunction, ntLiteral, ntColumnRef, ntCondition } |
enum | SpatialOperator { soBbox, soIntersects, soContains, soCrosses, soEquals, soDisjoint, soOverlaps, soTouches, soWithin } |
enum | UnaryOperator { uoNot, uoMinus } |
list of unary operators More... | |
typedef QList< WhenThen * > | WhenThenList |
Public Member Functions | |
QgsScaleExpression (const QString &expression) | |
Constructor for QgsScaleExpression which parses an expression string to determine whether it's a scale expression. More... | |
QgsScaleExpression (Type type, const QString &baseExpression, double minValue, double maxValue, double minSize, double maxSize, double nullSize=0) | |
Constructor for QgsScaleExpression which creates an expression from specified parameters. More... | |
QString | baseExpression () const |
Returns the base expression string (or field reference) used for calculating the values to be mapped to a size. More... | |
double | maxSize () const |
Returns the maximum size calculated by the expression. More... | |
double | maxValue () const |
Returns the maximum value expected by the expression. More... | |
double | minSize () const |
Returns the minimum size calculated by the expression. More... | |
double | minValue () const |
Returns the minimum value expected by the expression. More... | |
double | nullSize () const |
Returns the size value when expression evaluates to NULL. More... | |
operator bool () const | |
double | size (double value) const |
Calculates the size corresponding to a specific value. More... | |
Type | type () const |
Returns the scale expression's type (method used to calculate the size from a value). More... | |
Public Member Functions inherited from QgsExpression | |
QgsExpression (const QString &expr) | |
~QgsExpression () | |
void | acceptVisitor (Visitor &v) const |
entry function for the visitor pattern More... | |
int | currentRowNumber () |
Return the number used for $rownum special column. More... | |
QString | dump () const |
Return the expression string that represents this QgsExpression. More... | |
QString | evalErrorString () const |
Returns evaluation error. More... | |
QVariant | evaluate (const QgsFeature *f=NULL) |
Evaluate the feature and return the result. More... | |
QVariant | evaluate (const QgsFeature &f) |
Evaluate the feature and return the result. More... | |
QVariant | evaluate (const QgsFeature *f, const QgsFields &fields) |
Evaluate the feature and return the result. More... | |
QVariant | evaluate (const QgsFeature &f, const QgsFields &fields) |
Evaluate the feature and return the result. More... | |
const QString | expression () const |
Alias for dump() More... | |
QgsDistanceArea * | geomCalculator () |
Return calculator used for distance and area calculations (used by internal functions) More... | |
bool | hasEvalError () const |
Returns true if an error occurred when evaluating last input. More... | |
bool | hasParserError () const |
Returns true if an error occurred when parsing the input expression. More... | |
bool | isField () const |
Checks whether an expression consists only of a single field reference. More... | |
bool | needsGeometry () const |
Returns true if the expression uses feature geometry for some computation. More... | |
QString | parserErrorString () const |
Returns parser error. More... | |
bool | prepare (const QgsFields &fields) |
Get the expression ready for evaluation - find out column indexes. More... | |
QStringList | referencedColumns () const |
Get list of columns referenced by the expression. More... | |
const Node * | rootNode () const |
Returns root node of the expression. Root node is null is parsing has failed. More... | |
double | scale () |
void | setCurrentRowNumber (int rowNumber) |
Set the number for $rownum special column. More... | |
void | setEvalErrorString (QString str) |
Set evaluation error (used internally by evaluation functions) More... | |
void | setGeomCalculator (const QgsDistanceArea &calc) |
Sets the geometry calculator used in evaluation of expressions,. More... | |
void | setScale (double scale) |
Additional Inherited Members | |
Static Public Member Functions inherited from QgsExpression | |
static const QStringList & | BuiltinFunctions () |
static double | evaluateToDouble (const QString &text, const double fallbackValue) |
Attempts to evaluate a text string as an expression to a resultant double value. More... | |
static int | functionCount () |
Returns the number of functions defined in the parser. More... | |
static int | functionIndex (const QString &name) |
static const QList< Function * > & | Functions () |
static QString | group (QString group) |
static bool | hasSpecialColumn (const QString &name) |
Check whether a special column exists. More... | |
static QString | helptext (QString name) |
static bool | isFunctionName (QString name) |
static bool | isValid (const QString &text, const QgsFields &fields, QString &errorMessage) |
static QString | quotedColumnRef (QString name) |
return quoted column reference (in double quotes) More... | |
static QString | quotedString (QString text) |
return quoted string (in single quotes) More... | |
static bool | registerFunction (Function *function) |
static QString | replaceExpressionText (const QString &action, const QgsFeature *feat, QgsVectorLayer *layer, const QMap< QString, QVariant > *substitutionMap=0, const QgsDistanceArea *distanceArea=0) |
This function currently replaces each expression between [% and %] in the string with the result of its evaluation on the feature passed as argument. More... | |
static void | setSpecialColumn (const QString &name, QVariant value) |
Assign a special column. More... | |
static QVariant | specialColumn (const QString &name) |
Return the value of the given special column or a null QVariant if undefined. More... | |
static QList< Function * > | specialColumns () |
Returns a list of special Column definitions. More... | |
static bool | unregisterFunction (QString name) |
static void | unsetSpecialColumn (const QString &name) |
Unset a special column. More... | |
Static Public Attributes inherited from QgsExpression | |
static const char * | BinaryOperatorText [] |
static QStringList | gmBuiltinFunctions |
static QList< Function * > | gmFunctions |
static const char * | UnaryOperatorText [] |
Protected Member Functions inherited from QgsExpression | |
QgsExpression () | |
Used by QgsOgcUtils to create an empty. More... | |
void | initGeomCalculator () |
Static Protected Member Functions inherited from QgsExpression | |
static void | initFunctionHelp () |
Protected Attributes inherited from QgsExpression | |
QgsDistanceArea * | mCalc |
QString | mEvalErrorString |
QString | mExp |
QString | mParserErrorString |
Node * | mRootNode |
int | mRowNumber |
double | mScale |
Static Protected Attributes inherited from QgsExpression | |
static QHash< QString, QString > | gFunctionHelpTexts |
static QHash< QString, QString > | gGroups |
static QMap< QString, QString > | gmSpecialColumnGroups |
static QMap< QString, QVariant > | gmSpecialColumns |
Class storing parameters of a scale expression, which is a subclass of QgsExpression for expressions which return a size or width.
Definition at line 28 of file qgsscaleexpression.h.
Enumerator | |
---|---|
Linear | |
Area | |
Flannery | |
Unknown |
Definition at line 32 of file qgsscaleexpression.h.
QgsScaleExpression::QgsScaleExpression | ( | const QString & | expression | ) |
Constructor for QgsScaleExpression which parses an expression string to determine whether it's a scale expression.
expression | expression string |
Definition at line 21 of file qgsscaleexpression.cpp.
QgsScaleExpression::QgsScaleExpression | ( | Type | type, |
const QString & | baseExpression, | ||
double | minValue, | ||
double | maxValue, | ||
double | minSize, | ||
double | maxSize, | ||
double | nullSize = 0 |
||
) |
Constructor for QgsScaleExpression which creates an expression from specified parameters.
type | scale method |
baseExpression | expression (or field) used for value |
minValue | minimum value, corresponds to specified minimum size |
maxValue | maximum value, corresponds to specified maximum size |
minSize | minimum size |
maxSize | maximum size |
nullSize | size in case expression evaluates to NULL |
Definition at line 33 of file qgsscaleexpression.cpp.
|
inline |
Returns the base expression string (or field reference) used for calculating the values to be mapped to a size.
Definition at line 96 of file qgsscaleexpression.h.
|
inline |
Returns the maximum size calculated by the expression.
Definition at line 74 of file qgsscaleexpression.h.
|
inline |
Returns the maximum value expected by the expression.
The maximum value corresponds to the expression's maximum size.
Definition at line 86 of file qgsscaleexpression.h.
|
inline |
Returns the minimum size calculated by the expression.
Definition at line 69 of file qgsscaleexpression.h.
|
inline |
Returns the minimum value expected by the expression.
The minimum value corresponds to the expression's minimum size.
Definition at line 80 of file qgsscaleexpression.h.
|
inline |
Returns the size value when expression evaluates to NULL.
Definition at line 91 of file qgsscaleexpression.h.
|
inline |
Definition at line 58 of file qgsscaleexpression.h.
double QgsScaleExpression::size | ( | double | value | ) | const |
Calculates the size corresponding to a specific value.
value |
Definition at line 139 of file qgsscaleexpression.cpp.
|
inline |
Returns the scale expression's type (method used to calculate the size from a value).
Definition at line 101 of file qgsscaleexpression.h.