QGIS API Documentation
3.6.0-Noosa (5873452)
|
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. More... | |
QgsSizeScaleTransformer * | clone () const override |
Returns a clone of the transformer. More... | |
double | exponent () const |
Returns the exponent for an exponential expression. More... | |
bool | loadVariant (const QVariant &definition) override |
Loads this transformer from a QVariantMap, wrapped in a QVariant. More... | |
double | maxSize () const |
Returns the maximum calculated size. More... | |
double | minSize () const |
Returns the minimum calculated size. More... | |
double | nullSize () const |
Returns the size value when an expression evaluates to NULL. More... | |
void | setExponent (double exponent) |
Sets the exponent for an exponential expression. More... | |
void | setMaxSize (double size) |
Sets the maximum calculated size. More... | |
void | setMinSize (double size) |
Sets the minimum calculated size. More... | |
void | setNullSize (double size) |
Sets the size value for when an expression evaluates to NULL. More... | |
void | setType (ScaleType type) |
Sets the size transformer's scaling type (the method used to calculate the size from a value). More... | |
double | size (double value) const |
Calculates the size corresponding to a specific value. More... | |
QString | toExpression (const QString &baseExpression) const override |
Converts the transformer to a QGIS expression string. More... | |
QVariant | toVariant () const override |
Saves this transformer to a QVariantMap, wrapped in a QVariant. More... | |
QVariant | transform (const QgsExpressionContext &context, const QVariant &value) const override |
Calculates the transform of a value. More... | |
Type | transformerType () const override |
Returns the transformer type. More... | |
ScaleType | type () const |
Returns the size transformer's scaling type (the method used to calculate the size from a value). More... | |
Public Member Functions inherited from QgsPropertyTransformer | |
QgsPropertyTransformer (double minValue=0.0, double maxValue=1.0) | |
Constructor for QgsPropertyTransformer. More... | |
QgsPropertyTransformer (const QgsPropertyTransformer &other) | |
Copy constructor. More... | |
virtual | ~QgsPropertyTransformer ()=default |
QgsCurveTransform * | curveTransform () const |
Returns the curve transform applied to input values before they are transformed by the individual transform subclasses. More... | |
double | maxValue () const |
Returns the maximum value expected by the transformer. More... | |
double | minValue () const |
Returns the minimum value expected by the transformer. More... | |
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. More... | |
void | setMaxValue (double max) |
Sets the maximum value expected by the transformer. More... | |
void | setMinValue (double min) |
Sets the minimum value expected by the transformer. More... | |
Static Public Member Functions | |
static QgsSizeScaleTransformer * | fromExpression (const QString &expression, QString &baseExpression, QString &fieldName) |
Attempts to parse an expression into a corresponding QgsSizeScaleTransformer. More... | |
Static Public Member Functions inherited from QgsPropertyTransformer | |
static QgsPropertyTransformer * | create (Type type) |
Factory method for creating a new property transformer of the specified type. More... | |
static QgsPropertyTransformer * | fromExpression (const QString &expression, QString &baseExpression, QString &fieldName) |
Attempts to parse an expression into a corresponding property transformer. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from QgsPropertyTransformer | |
double | transformNumeric (double input) const |
Applies base class numeric transformations. More... | |
Protected Attributes inherited from QgsPropertyTransformer | |
std::unique_ptr< QgsCurveTransform > | mCurveTransform |
Optional curve transform. More... | |
double | mMaxValue |
Maximum value expected by the transformer. More... | |
double | mMinValue |
Minimum value expected by the transformer. More... | |
QgsPropertyTransformer subclass for scaling a value into a size according to various scaling methods.
Definition at line 461 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 466 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 299 of file qgspropertytransformer.cpp.
|
overridevirtual |
Returns a clone of the transformer.
Implements QgsPropertyTransformer.
Definition at line 309 of file qgspropertytransformer.cpp.
|
inline |
Returns the exponent for an exponential expression.
Definition at line 567 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. |
Definition at line 433 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 336 of file qgspropertytransformer.cpp.
|
inline |
Returns the maximum calculated size.
Definition at line 539 of file qgspropertytransformer.h.
|
inline |
Returns the minimum calculated size.
Definition at line 525 of file qgspropertytransformer.h.
|
inline |
Returns the size value when an expression evaluates to NULL.
Definition at line 553 of file qgspropertytransformer.h.
|
inline |
Sets the exponent for an exponential expression.
exponent | exponent |
Definition at line 574 of file qgspropertytransformer.h.
|
inline |
Sets the maximum calculated size.
size | maximum size |
Definition at line 547 of file qgspropertytransformer.h.
|
inline |
Sets the minimum calculated size.
size | minimum size |
Definition at line 533 of file qgspropertytransformer.h.
|
inline |
Sets the size value for when an expression evaluates to NULL.
size | null size |
Definition at line 560 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 369 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 351 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 410 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 323 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 389 of file qgspropertytransformer.cpp.
|
inlineoverridevirtual |
Returns the transformer type.
Implements QgsPropertyTransformer.
Definition at line 492 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 581 of file qgspropertytransformer.h.