QGIS API Documentation 3.39.0-Master (3783037d301)
|
QgsPropertyTransformer subclass for scaling an input numeric value into an output numeric value. More...
#include <qgspropertytransformer.h>
Public Member Functions | |
QgsGenericNumericTransformer (double minValue=0.0, double maxValue=1.0, double minOutput=0.0, double maxOutput=1.0, double nullOutput=0.0, double exponent=1.0) | |
Constructor for QgsGenericNumericTransformer. | |
QgsGenericNumericTransformer * | clone () const override |
Returns a clone of the transformer. | |
double | exponent () const |
Returns the exponent for an exponential expression. | |
bool | loadVariant (const QVariant &definition) override |
Loads this transformer from a QVariantMap, wrapped in a QVariant. | |
double | maxOutputValue () const |
Returns the maximum calculated size. | |
double | minOutputValue () const |
Returns the minimum calculated size. | |
double | nullOutputValue () const |
Returns the size value when an expression evaluates to NULL. | |
void | setExponent (double exponent) |
Sets the exponent for an exponential expression. | |
void | setMaxOutputValue (double size) |
Sets the maximum calculated size. | |
void | setMinOutputValue (double size) |
Sets the minimum calculated size. | |
void | setNullOutputValue (double size) |
Sets the size value for when an expression evaluates to NULL. | |
QString | toExpression (const QString &baseExpression) const override |
Converts the transformer to a QGIS expression string. | |
QVariant | toVariant () const override |
Saves this transformer to a QVariantMap, wrapped in a QVariant. | |
QVariant | transform (const QgsExpressionContext &context, const QVariant &value) const override |
Calculates the transform of a value. | |
Type | transformerType () const override |
Returns the transformer type. | |
double | value (double input) const |
Calculates the size corresponding to a specific input value. | |
Public Member Functions inherited from QgsPropertyTransformer | |
QgsPropertyTransformer (const QgsPropertyTransformer &other) | |
QgsPropertyTransformer (double minValue=0.0, double maxValue=1.0) | |
Constructor for QgsPropertyTransformer. | |
virtual | ~QgsPropertyTransformer () |
QgsCurveTransform * | curveTransform () const |
Returns the curve transform applied to input values before they are transformed by the individual transform subclasses. | |
double | maxValue () const |
Returns the maximum value expected by the transformer. | |
double | minValue () const |
Returns the minimum value expected by the transformer. | |
QgsPropertyTransformer & | operator= (const QgsPropertyTransformer &other) |
void | setCurveTransform (QgsCurveTransform *transform) |
Sets a curve transform to apply to input values before they are transformed by the individual transform subclasses. | |
void | setMaxValue (double max) |
Sets the maximum value expected by the transformer. | |
void | setMinValue (double min) |
Sets the minimum value expected by the transformer. | |
Static Public Member Functions | |
static QgsGenericNumericTransformer * | fromExpression (const QString &expression, QString &baseExpression, QString &fieldName) |
Attempts to parse an expression into a corresponding QgsSizeScaleTransformer. | |
Static Public Member Functions inherited from QgsPropertyTransformer | |
static QgsPropertyTransformer * | create (Type type) |
Factory method for creating a new property transformer of the specified type. | |
static QgsPropertyTransformer * | fromExpression (const QString &expression, QString &baseExpression, QString &fieldName) |
Attempts to parse an expression into a corresponding property transformer. | |
Additional Inherited Members | |
Public Types inherited from QgsPropertyTransformer | |
enum | Type { GenericNumericTransformer , SizeScaleTransformer , ColorRampTransformer } |
Transformer types. More... | |
Protected Member Functions inherited from QgsPropertyTransformer | |
double | transformNumeric (double input) const |
Applies base class numeric transformations. | |
Protected Attributes inherited from QgsPropertyTransformer | |
std::unique_ptr< QgsCurveTransform > | mCurveTransform |
Optional curve transform. | |
double | mMaxValue |
Maximum value expected by the transformer. | |
double | mMinValue |
Minimum value expected by the transformer. | |
QgsPropertyTransformer subclass for scaling an input numeric value into an output numeric value.
Definition at line 329 of file qgspropertytransformer.h.
QgsGenericNumericTransformer::QgsGenericNumericTransformer | ( | double | minValue = 0.0 , |
double | maxValue = 1.0 , |
||
double | minOutput = 0.0 , |
||
double | maxOutput = 1.0 , |
||
double | nullOutput = 0.0 , |
||
double | exponent = 1.0 |
||
) |
Constructor for QgsGenericNumericTransformer.
minValue | minimum expected input value |
maxValue | maximum expected input value |
minOutput | minimum value to return |
maxOutput | maximum value to return |
nullOutput | value to return for null inputs |
exponent | optional exponential for non-linear scaling |
Definition at line 133 of file qgspropertytransformer.cpp.
|
overridevirtual |
Returns a clone of the transformer.
Implements QgsPropertyTransformer.
Definition at line 141 of file qgspropertytransformer.cpp.
|
inline |
Returns the exponent for an exponential expression.
Definition at line 422 of file qgspropertytransformer.h.
|
static |
Attempts to parse an expression into a corresponding QgsSizeScaleTransformer.
expression | expression to parse |
baseExpression | will be set to the component of the source expression which is used to calculate the input to the property transformer. This will be set to an empty string if a field reference is the transformer input. |
fieldName | will be set to a field name which is used to calculate the input to the property transformer. This will be set to an empty string if an expression is the transformer input. |
nullptr
if expression could not be parsed to a size scale transformer. Definition at line 227 of file qgspropertytransformer.cpp.
|
overridevirtual |
Loads this transformer from a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils::readVariant to read it from an XML document.
Reimplemented from QgsPropertyTransformer.
Definition at line 166 of file qgspropertytransformer.cpp.
|
inline |
Returns the maximum calculated size.
Definition at line 395 of file qgspropertytransformer.h.
|
inline |
Returns the minimum calculated size.
Definition at line 381 of file qgspropertytransformer.h.
|
inline |
Returns the size value when an expression evaluates to NULL.
Definition at line 409 of file qgspropertytransformer.h.
|
inline |
Sets the exponent for an exponential expression.
exponent | exponent |
Definition at line 429 of file qgspropertytransformer.h.
|
inline |
Sets the maximum calculated size.
size | maximum size |
Definition at line 403 of file qgspropertytransformer.h.
|
inline |
Sets the minimum calculated size.
size | minimum size |
Definition at line 389 of file qgspropertytransformer.h.
|
inline |
Sets the size value for when an expression evaluates to NULL.
size | null size |
Definition at line 416 of file qgspropertytransformer.h.
|
overridevirtual |
Converts the transformer to a QGIS expression string.
The baseExpression string consists of a sub-expression reflecting the parent property's state.
Implements QgsPropertyTransformer.
Definition at line 212 of file qgspropertytransformer.cpp.
|
overridevirtual |
Saves this transformer to a QVariantMap, wrapped in a QVariant.
You can use QgsXmlUtils::writeVariant to save it to an XML document.
Reimplemented from QgsPropertyTransformer.
Definition at line 154 of file qgspropertytransformer.cpp.
|
overridevirtual |
Calculates the transform of a value.
Derived classes must implement this to perform their transformations on input values
context | expression context |
value | input value to transform |
Implements QgsPropertyTransformer.
Definition at line 191 of file qgspropertytransformer.cpp.
|
inlineoverridevirtual |
Returns the transformer type.
Implements QgsPropertyTransformer.
Definition at line 349 of file qgspropertytransformer.h.
double QgsGenericNumericTransformer::value | ( | double | input | ) | const |
Calculates the size corresponding to a specific input value.
Definition at line 179 of file qgspropertytransformer.cpp.