|
QGIS API Documentation
2.14.0-Essen
|
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, Exponential, 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) |
| typedef QVariant(* | FcnEvalContext) (const QVariantList &values, const QgsExpressionContext *context, QgsExpression *parent) |
| Function definition for evaluation against an expression context. More... | |
| 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, double exponent=1) | |
| 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 | exponent () const |
| Returns the exponent of the exponential expression. 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) | |
| Creates a new expression based on the provided string. More... | |
| QgsExpression (const QgsExpression &other) | |
| Create a copy of this expression. More... | |
| ~QgsExpression () | |
| void | acceptVisitor (Visitor &v) const |
| Entry function for the visitor pattern. More... | |
| QgsUnitTypes::AreaUnit | areaUnits () const |
| Returns the desired areal units for calculations involving geomCalculator(), eg "$area". More... | |
| Q_DECL_DEPRECATED int | currentRowNumber () |
| Return the number used for $rownum special column. More... | |
| QGis::UnitType | distanceUnits () const |
| Returns the desired distance units for calculations involving geomCalculator(), eg "$length" and "$perimeter". More... | |
| QString | dump () const |
| Return an expression string, constructed from the internal abstract syntax tree. More... | |
| QString | evalErrorString () const |
| Returns evaluation error. More... | |
| Q_DECL_DEPRECATED QVariant | evaluate (const QgsFeature *f) |
| Evaluate the feature and return the result. More... | |
| Q_DECL_DEPRECATED QVariant | evaluate (const QgsFeature &f) |
| Evaluate the feature and return the result. More... | |
| Q_DECL_DEPRECATED QVariant | evaluate (const QgsFeature *f, const QgsFields &fields) |
| Evaluate the feature and return the result. More... | |
| Q_DECL_DEPRECATED QVariant | evaluate (const QgsFeature &f, const QgsFields &fields) |
| Evaluate the feature and return the result. More... | |
| QVariant | evaluate () |
| Evaluate the feature and return the result. More... | |
| QVariant | evaluate (const QgsExpressionContext *context) |
| Evaluate the expression against the specified context and return the result. More... | |
| QString | expression () const |
| Return the original, unmodified expression string. More... | |
| QgsDistanceArea * | geomCalculator () |
| Return calculator used for distance and area calculations (used by $length, $area and $perimeter functions only) 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... | |
| QgsExpression & | operator= (const QgsExpression &other) |
| Create a copy of this expression. More... | |
| QString | parserErrorString () const |
| Returns parser error. More... | |
| Q_DECL_DEPRECATED bool | prepare (const QgsFields &fields) |
| Get the expression ready for evaluation - find out column indexes. More... | |
| bool | prepare (const QgsExpressionContext *context) |
| 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 | setAreaUnits (QgsUnitTypes::AreaUnit unit) |
| Sets the desired areal units for calculations involving geomCalculator(), eg "$area". More... | |
| Q_DECL_DEPRECATED void | setCurrentRowNumber (int rowNumber) |
| Set the number for $rownum special column. More... | |
| void | setDistanceUnits (QGis::UnitType unit) |
| Sets the desired distance units for calculations involving geomCalculator(), eg "$length" and "$perimeter". More... | |
| void | setEvalErrorString (const QString &str) |
| Set evaluation error (used internally by evaluation functions) More... | |
| void | setGeomCalculator (const QgsDistanceArea &calc) |
| Sets the geometry calculator used for distance and area calculations in expressions. More... | |
| void | setScale (double scale) |
Additional Inherited Members | |
Static Public Member Functions inherited from QgsExpression | |
| static const QStringList & | BuiltinFunctions () |
| static void | cleanRegisteredFunctions () |
| Deletes all registered functions whose ownership have been transferred to the expression engine. More... | |
| 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 QString | formatPreviewString (const QVariant &value) |
| Formats an expression result for friendly display to the user. More... | |
| static int | functionCount () |
| Returns the number of functions defined in the parser. More... | |
| static int | functionIndex (const QString &name) |
| return index of the function in Functions array More... | |
| static const QList< Function * > & | Functions () |
| static QString | group (const QString &group) |
| Returns the translated name for a function group. More... | |
| static bool | hasSpecialColumn (const QString &name) |
| Check whether a special column exists. More... | |
| static QString | helptext (QString name) |
| Returns the help text for a specified function. More... | |
| static bool | isFunctionName (const QString &name) |
| tells whether the identifier is a name of existing function More... | |
| static Q_DECL_DEPRECATED bool | isValid (const QString &text, const QgsFields &fields, QString &errorMessage) |
| static bool | isValid (const QString &text, const QgsExpressionContext *context, QString &errorMessage) |
| Tests whether a string is a valid expression. More... | |
| static QString | quotedColumnRef (QString name) |
| Returns a quoted column reference (in double quotes) More... | |
| static QString | quotedString (QString text) |
| Returns a quoted version of a string (in single quotes) More... | |
| static QString | quotedValue (const QVariant &value) |
| Returns a string representation of a literal value, including appropriate quotations where required. More... | |
| static QString | quotedValue (const QVariant &value, QVariant::Type type) |
| Returns a string representation of a literal value, including appropriate quotations where required. More... | |
| static bool | registerFunction (Function *function, bool transferOwnership=false) |
| Registers a function to the expression engine. More... | |
| static Q_DECL_DEPRECATED QString | replaceExpressionText (const QString &action, const QgsFeature *feat, QgsVectorLayer *layer, const QMap< QString, QVariant > *substitutionMap=nullptr, const QgsDistanceArea *distanceArea=nullptr) |
| 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 QString | replaceExpressionText (const QString &action, const QgsExpressionContext *context, const QMap< QString, QVariant > *substitutionMap=nullptr, const QgsDistanceArea *distanceArea=nullptr) |
| This function replaces each expression between [% and %] in the string with the result of its evaluation with the specified context. More... | |
| static Q_DECL_DEPRECATED void | setSpecialColumn (const QString &name, const QVariant &value) |
| Assign a special column. More... | |
| static Q_DECL_DEPRECATED 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 (const QString &name) |
| Unregisters a function from the expression engine. More... | |
| static Q_DECL_DEPRECATED void | unsetSpecialColumn (const QString &name) |
| Unset a special column. More... | |
| static QString | variableHelpText (const QString &variableName, bool showValue=true, const QVariant &value=QVariant()) |
| Returns the help text for a specified variable. More... | |
Static Public Attributes inherited from QgsExpression | |
| static const char * | BinaryOperatorText [] |
| static QStringList | gmBuiltinFunctions |
| static QList< Function * > | gmFunctions |
| static QList< Function * > | gmOwnedFunctions |
| List of functions owned by the expression engine. More... | |
| static const char * | UnaryOperatorText [] |
Protected Member Functions inherited from QgsExpression | |
| QgsExpression () | |
| Used by QgsOgcUtils to create an empty. More... | |
| void | detach () |
| Helper for implicit sharing. More... | |
| void | initGeomCalculator () |
Static Protected Member Functions inherited from QgsExpression | |
| static void | initFunctionHelp () |
| static void | initVariableHelp () |
Protected Attributes inherited from QgsExpression | |
| QgsExpressionPrivate * | d |
Static Protected Attributes inherited from QgsExpression | |
| static QHash< QString, Help > | gFunctionHelpTexts |
| static QHash< QString, QString > | gGroups |
| static QMap< QString, QString > | gmSpecialColumnGroups |
| static QMap< QString, QVariant > | gmSpecialColumns |
| static QHash< QString, QString > | gVariableHelpTexts |
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 | |
| Exponential | |
| 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, |
||
| double | exponent = 1 |
||
| ) |
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 |
| exponent | to use in case of Exponential type |
Definition at line 34 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 103 of file qgsscaleexpression.h.
|
inline |
Returns the exponent of the exponential expression.
Definition at line 98 of file qgsscaleexpression.h.
|
inline |
Returns the maximum size calculated by the expression.
Definition at line 76 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 88 of file qgsscaleexpression.h.
|
inline |
Returns the minimum size calculated by the expression.
Definition at line 71 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 82 of file qgsscaleexpression.h.
|
inline |
Returns the size value when expression evaluates to NULL.
Definition at line 93 of file qgsscaleexpression.h.
|
inline |
Definition at line 60 of file qgsscaleexpression.h.
| double QgsScaleExpression::size | ( | double | value | ) | const |
Calculates the size corresponding to a specific value.
| value |
Definition at line 155 of file qgsscaleexpression.cpp.
|
inline |
Returns the scale expression's type (method used to calculate the size from a value).
Definition at line 108 of file qgsscaleexpression.h.
1.8.11