Class: QgsGenericNumericTransformer

class qgis.core.QgsGenericNumericTransformer(minValue: float = 0, maxValue: float = 1, minOutput: float = 0, maxOutput: float = 1, nullOutput: float = 0, exponent: float = 1)

Bases: QgsPropertyTransformer

Constructor for QgsGenericNumericTransformer.

Parameters
  • 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

QgsGenericNumericTransformer(QgsGenericNumericTransformer)

QgsPropertyTransformer subclass for scaling an input numeric value into an output numeric value.

New in version 3.0:

Methods

clone

rtype

QgsGenericNumericTransformer

exponent

Returns the exponent for an exponential expression.

fromExpression

Attempts to parse an expression into a corresponding QgsSizeScaleTransformer.

loadVariant

param definition

maxOutputValue

Returns the maximum calculated size.

minOutputValue

Returns the minimum calculated size.

nullOutputValue

Returns the size value when an expression evaluates to NULL.

setExponent

Sets the exponent for an exponential expression.

setMaxOutputValue

Sets the maximum calculated size.

setMinOutputValue

Sets the minimum calculated size.

setNullOutputValue

Sets the size value for when an expression evaluates to NULL.

toExpression

param baseExpression

toVariant

rtype

Any

transform

param context

transformNumeric

Applies base class numeric transformations.

transformerType

rtype

QgsPropertyTransformer.Type

value

Calculates the size corresponding to a specific input value.

clone(self) QgsGenericNumericTransformer
Return type

QgsGenericNumericTransformer

exponent(self) float

Returns the exponent for an exponential expression.

See also

setExponent()

Return type

float

fromExpression(expression: str) Tuple[QgsGenericNumericTransformer, str, str]

Attempts to parse an expression into a corresponding QgsSizeScaleTransformer.

Parameters

expression (str) – expression to parse

Return type

Tuple[QgsGenericNumericTransformer, str, str]

Returns

  • corresponding QgsSizeScaleTransformer, or None if expression could not

  • 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.

be parsed to a size scale transformer.

loadVariant(self, definition: Any) bool
Parameters

definition (Any) –

Return type

bool

maxOutputValue(self) float

Returns the maximum calculated size.

See also

minOutputValue()

Return type

float

minOutputValue(self) float

Returns the minimum calculated size.

See also

maxOutputValue()

Return type

float

nullOutputValue(self) float

Returns the size value when an expression evaluates to NULL.

Return type

float

setExponent(self, exponent: float)

Sets the exponent for an exponential expression.

Parameters

exponent (float) – exponent

See also

exponent()

setMaxOutputValue(self, size: float)

Sets the maximum calculated size.

Parameters

size (float) – maximum size

See also

maxOutputValue()

setMinOutputValue(self, size: float)

Sets the minimum calculated size.

Parameters

size (float) – minimum size

See also

minOutputValue()

setNullOutputValue(self, size: float)

Sets the size value for when an expression evaluates to NULL.

Parameters

size (float) – null size

toExpression(self, baseExpression: str) str
Parameters

baseExpression (str) –

Return type

str

toVariant(self) Any
Return type

Any

transform(self, context: QgsExpressionContext, value: Any) Any
Parameters
Return type

Any

transformNumeric(self, input: float) float

Applies base class numeric transformations. Derived classes should call this to transform an input numeric value before they apply any transform to the result. This applies any curve transforms which may exist on the transformer.

transformerType(self) QgsPropertyTransformer.Type
Return type

QgsPropertyTransformer.Type

value(self, input: float) float

Calculates the size corresponding to a specific input value.

Return type

float

Returns

calculated size using size scale transformer’s parameters and type

Parameters

input (float) –