QGIS API Documentation 3.41.0-Master (3440c17df1d)
|
QgsPropertyTransformer subclass for scaling a value into a size according to various scaling methods. More...
#include <qgspropertytransformer.h>
Public Types | |
enum | ScaleType { Linear , Area , Flannery , Exponential } |
Size scaling methods. More... | |
Public Types inherited from QgsPropertyTransformer | |
enum | Type { GenericNumericTransformer , SizeScaleTransformer , ColorRampTransformer } |
Transformer types. More... | |
Public Member Functions | |
QgsSizeScaleTransformer (ScaleType type=Linear, double minValue=0.0, double maxValue=1.0, double minSize=0.0, double maxSize=1.0, double nullSize=0.0, double exponent=1.0) | |
Constructor for QgsSizeScaleTransformer. | |
QgsSizeScaleTransformer * | 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 | maxSize () const |
Returns the maximum calculated size. | |
double | minSize () const |
Returns the minimum calculated size. | |
double | nullSize () const |
Returns the size value when an expression evaluates to NULL. | |
void | setExponent (double exponent) |
Sets the exponent for an exponential expression. | |
void | setMaxSize (double size) |
Sets the maximum calculated size. | |
void | setMinSize (double size) |
Sets the minimum calculated size. | |
void | setNullSize (double size) |
Sets the size value for when an expression evaluates to NULL. | |
void | setType (ScaleType type) |
Sets the size transformer's scaling type (the method used to calculate the size from a value). | |
double | size (double value) const |
Calculates the size corresponding to a specific value. | |
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. | |
ScaleType | type () const |
Returns the size transformer's scaling type (the method used to calculate the size from a 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 QgsSizeScaleTransformer * | 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 | |
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 a value into a size according to various scaling methods.
Definition at line 446 of file qgspropertytransformer.h.
Size scaling methods.
Enumerator | |
---|---|
Linear | Linear scaling. |
Area | Area based scaling. |
Flannery | Flannery scaling method. |
Exponential | Scale using set exponent. |
Definition at line 451 of file qgspropertytransformer.h.
QgsSizeScaleTransformer::QgsSizeScaleTransformer | ( | ScaleType | type = Linear , |
double | minValue = 0.0 , |
||
double | maxValue = 1.0 , |
||
double | minSize = 0.0 , |
||
double | maxSize = 1.0 , |
||
double | nullSize = 0.0 , |
||
double | exponent = 1.0 |
||
) |
Constructor for QgsSizeScaleTransformer.
type | scaling type |
minValue | minimum expected value |
maxValue | maximum expected value |
minSize | minimum size to return |
maxSize | maximum size to return |
nullSize | size to return for null values |
exponent | exponent for Exponential scaling method |
Definition at line 305 of file qgspropertytransformer.cpp.
|
overridevirtual |
Returns a clone of the transformer.
Implements QgsPropertyTransformer.
Definition at line 315 of file qgspropertytransformer.cpp.
|
inline |
Returns the exponent for an exponential expression.
Definition at line 547 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 439 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 342 of file qgspropertytransformer.cpp.
|
inline |
Returns the maximum calculated size.
Definition at line 519 of file qgspropertytransformer.h.
|
inline |
Returns the minimum calculated size.
Definition at line 505 of file qgspropertytransformer.h.
|
inline |
Returns the size value when an expression evaluates to NULL.
Definition at line 533 of file qgspropertytransformer.h.
|
inline |
Sets the exponent for an exponential expression.
exponent | exponent |
Definition at line 554 of file qgspropertytransformer.h.
|
inline |
Sets the maximum calculated size.
size | maximum size |
Definition at line 527 of file qgspropertytransformer.h.
|
inline |
Sets the minimum calculated size.
size | minimum size |
Definition at line 513 of file qgspropertytransformer.h.
|
inline |
Sets the size value for when an expression evaluates to NULL.
size | null size |
Definition at line 540 of file qgspropertytransformer.h.
void QgsSizeScaleTransformer::setType | ( | QgsSizeScaleTransformer::ScaleType | type | ) |
Sets the size transformer's scaling type (the method used to calculate the size from a value).
type | scale type |
Definition at line 375 of file qgspropertytransformer.cpp.
double QgsSizeScaleTransformer::size | ( | double | value | ) | const |
Calculates the size corresponding to a specific value.
value | value to calculate size for |
Definition at line 357 of file qgspropertytransformer.cpp.
|
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 416 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 329 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 395 of file qgspropertytransformer.cpp.
|
inlineoverridevirtual |
Returns the transformer type.
Implements QgsPropertyTransformer.
Definition at line 477 of file qgspropertytransformer.h.
|
inline |
Returns the size transformer's scaling type (the method used to calculate the size from a value).
Definition at line 561 of file qgspropertytransformer.h.