Class: QgsPropertyTransformer¶
- class qgis.core.QgsPropertyTransformer(minValue: float = 0, maxValue: float = 1)¶
Bases:
sip.wrapper
Constructor for QgsPropertyTransformer
- Parameters
minValue – minimum expected value from source property
maxValue – maximum expected value from source property
QgsPropertyTransformer(other:
QgsPropertyTransformer
) Copy constructor.Abstract base class for objects which transform the calculated value of a property. Possible uses include transformers which map a value into a scaled size or color from a gradient.
New in version 3.0:
Methods
Returns a clone of the transformer.
Factory method for creating a new property transformer of the specified type.
Returns the curve transform applied to input values before they are transformed by the individual transform subclasses.
Attempts to parse an expression into a corresponding property transformer.
Loads this transformer from a QVariantMap, wrapped in a QVariant.
Returns the maximum value expected by the transformer.
Returns the minimum value expected by the transformer.
Sets a curve transform to apply to input values before they are transformed by the individual transform subclasses.
Sets the maximum value expected by the transformer.
Sets the minimum value expected by the transformer.
Converts the transformer to a QGIS expression string.
Saves this transformer to a QVariantMap, wrapped in a QVariant.
Calculates the transform of a value.
Applies base class numeric transformations.
Returns the transformer type.
Attributes
- ColorRampTransformer = 2¶
- GenericNumericTransformer = 0¶
- SizeScaleTransformer = 1¶
- class Type¶
Bases:
int
- clone(self) QgsPropertyTransformer ¶
Returns a clone of the transformer.
- Return type
- create(type: QgsPropertyTransformer.Type) QgsPropertyTransformer ¶
Factory method for creating a new property transformer of the specified type.
- Parameters
type (QgsPropertyTransformer.Type) – transformer type to create
- Return type
- curveTransform(self) QgsCurveTransform ¶
Returns the curve transform applied to input values before they are transformed by the individual transform subclasses.
See also
- Return type
- fromExpression(expression: str) Tuple[QgsPropertyTransformer, str, str] ¶
Attempts to parse an expression into a corresponding property transformer.
- Parameters
expression (str) – expression to parse
- Return type
Tuple[
QgsPropertyTransformer
, str, str]- Returns
corresponding property transformer, or
None
if expression could notbaseExpression: 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 transformer.
- loadVariant(self, transformer: Any) bool ¶
Loads this transformer from a QVariantMap, wrapped in a QVariant. You can use QgsXmlUtils.readVariant to read it from an XML document.
See also
- Parameters
transformer (Any) –
- Return type
bool
- maxValue(self) float ¶
Returns the maximum value expected by the transformer.
See also
See also
- Return type
float
- minValue(self) float ¶
Returns the minimum value expected by the transformer.
See also
See also
- Return type
float
- setCurveTransform(self, transform: QgsCurveTransform)¶
Sets a curve transform to apply to input values before they are transformed by the individual transform subclasses. Ownership of
transform
is transferred to the property transformer.See also
- Parameters
transform (QgsCurveTransform) –
- setMaxValue(self, max: float)¶
Sets the maximum value expected by the transformer.
- Parameters
max (float) – maximum value
See also
See also
- setMinValue(self, min: float)¶
Sets the minimum value expected by the transformer.
- Parameters
min (float) – minimum value
See also
See also
- toExpression(self, baseExpression: str) str ¶
Converts the transformer to a QGIS expression string. The
baseExpression
string consists of a sub-expression reflecting the parent property’s state.- Parameters
baseExpression (str) –
- Return type
str
- toVariant(self) Any ¶
Saves this transformer to a QVariantMap, wrapped in a QVariant. You can use QgsXmlUtils.writeVariant to save it to an XML document.
See also
- Return type
Any
- transform(self, context: QgsExpressionContext, value: Any) Any ¶
Calculates the transform of a value. Derived classes must implement this to perform their transformations on input values
- Parameters
context (QgsExpressionContext) – expression context
value (Any) – input value to transform
- 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.- Parameters
input (float) –
- Return type
float
- transformerType(self) QgsPropertyTransformer.Type ¶
Returns the transformer type.
- Return type