Class: QgsGenericNumericTransformer

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

Class Hierarchy

Inheritance diagram of qgis.core.QgsGenericNumericTransformer

Base classes

QgsPropertyTransformer

Abstract base class for objects which transform the calculated value of a property.

Methods

exponent

Returns the exponent for an exponential expression.

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.

value

Calculates the size corresponding to a specific input value.

Static Methods

fromExpression

Attempts to parse an expression into a corresponding QgsSizeScaleTransformer.

class qgis.core.QgsGenericNumericTransformer[source]

Bases: QgsPropertyTransformer

__init__(minValue: float = 0, maxValue: float = 1, minOutput: float = 0, maxOutput: float = 1, nullOutput: float = 0, exponent: float = 1)

Constructor for QgsGenericNumericTransformer.

Parameters:
  • minValue (float = 0) – minimum expected input value

  • maxValue (float = 1) – maximum expected input value

  • minOutput (float = 0) – minimum value to return

  • maxOutput (float = 1) – maximum value to return

  • nullOutput (float = 0) – value to return for null inputs

  • exponent (float = 1) – optional exponential for non-linear scaling

__init__(a0: QgsGenericNumericTransformer)
Parameters:

a0 (QgsGenericNumericTransformer)

exponent(self) float[source]

Returns the exponent for an exponential expression.

See also

setExponent()

Return type:

float

static fromExpression(expression: str | None)[source]

Attempts to parse an expression into a corresponding QgsSizeScaleTransformer.

Parameters:

expression (Optional[str]) -> (Optional[QgsGenericNumericTransformer]) – expression to parse

Returns:

  • corresponding QgsSizeScaleTransformer, or None if expression could not be parsed to a size scale transformer.

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

maxOutputValue(self) float[source]

Returns the maximum calculated size.

See also

minOutputValue()

Return type:

float

minOutputValue(self) float[source]

Returns the minimum calculated size.

See also

maxOutputValue()

Return type:

float

nullOutputValue(self) float[source]

Returns the size value when an expression evaluates to NULL.

Return type:

float

setExponent(self, exponent: float)[source]

Sets the exponent for an exponential expression.

Parameters:

exponent (float) – exponent

See also

exponent()

setMaxOutputValue(self, size: float)[source]

Sets the maximum calculated size.

Parameters:

size (float) – maximum size

See also

maxOutputValue()

setMinOutputValue(self, size: float)[source]

Sets the minimum calculated size.

Parameters:

size (float) – minimum size

See also

minOutputValue()

setNullOutputValue(self, size: float)[source]

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

Parameters:

size (float) – null size

value(self, input: float) float[source]

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)