Class: QgsSizeScaleTransformer¶
QgsPropertyTransformer subclass for scaling a value into a
size according to various scaling methods.
Class Hierarchy¶
Base classes¶
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.  | 
Methods
Returns the exponent for an exponential expression.  | 
|
Returns the maximum calculated size.  | 
|
Returns the minimum calculated size.  | 
|
Returns the size value when an expression evaluates to NULL.  | 
|
Sets the exponent for an exponential expression.  | 
|
Sets the maximum calculated size.  | 
|
Sets the minimum calculated size.  | 
|
Sets the size value for when an expression evaluates to NULL.  | 
|
Sets the size transformer's scaling type (the method used to calculate the size from a value).  | 
|
Calculates the size corresponding to a specific value.  | 
|
Returns the size transformer's scaling type (the method used to calculate the size from a value).  | 
Static Methods
Attempts to parse an expression into a corresponding QgsSizeScaleTransformer.  | 
Attributes
- class qgis.core.QgsSizeScaleTransformer[source]¶
 Bases:
QgsPropertyTransformer- __init__(type: QgsSizeScaleTransformer.ScaleType = QgsSizeScaleTransformer.Linear, minValue: float = 0, maxValue: float = 1, minSize: float = 0, maxSize: float = 1, nullSize: float = 0, exponent: float = 1)
 Constructor for QgsSizeScaleTransformer.
- Parameters:
 type (QgsSizeScaleTransformer.ScaleType = QgsSizeScaleTransformer.Linear) – scaling type
minValue (float = 0) – minimum expected value
maxValue (float = 1) – maximum expected value
minSize (float = 0) – minimum size to return
maxSize (float = 1) – maximum size to return
nullSize (float = 0) – size to return for null values
exponent (float = 1) – exponent for Exponential scaling method
- __init__(a0: QgsSizeScaleTransformer)
 - Parameters:
 
- Area = 1¶
 
- Exponential = 3¶
 
- Flannery = 2¶
 
- Linear = 0¶
 
- class ScaleType¶
 Bases:
int
- exponent(self) float[source]¶
 Returns the exponent for an exponential expression.
See also
See also
- Return type:
 float
- static fromExpression(expression: str | None)[source]¶
 Attempts to parse an expression into a corresponding QgsSizeScaleTransformer.
- Parameters:
 expression (Optional[str]) -> (Optional[QgsSizeScaleTransformer]) – expression to parse
- Returns:
 corresponding
QgsSizeScaleTransformer, orNoneif 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 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 an empty string if an expression is the transformer input.
- minSize(self) float[source]¶
 Returns the minimum calculated size.
See also
See also
- Return type:
 float
- nullSize(self) float[source]¶
 Returns the size value when an expression evaluates to NULL.
See also
- Return type:
 float
- setExponent(self, exponent: float)[source]¶
 Sets the exponent for an exponential expression.
- Parameters:
 exponent (float) – exponent
See also
- setMaxSize(self, size: float)[source]¶
 Sets the maximum calculated size.
- Parameters:
 size (float) – maximum size
See also
See also
- setMinSize(self, size: float)[source]¶
 Sets the minimum calculated size.
- Parameters:
 size (float) – minimum size
See also
See also
- setNullSize(self, size: float)[source]¶
 Sets the size value for when an expression evaluates to NULL.
- Parameters:
 size (float) – null size
See also
- setType(self, type: QgsSizeScaleTransformer.ScaleType)[source]¶
 Sets the size transformer’s scaling type (the method used to calculate the size from a value).
- Parameters:
 type (QgsSizeScaleTransformer.ScaleType) – scale type
See also
- size(self, value: float) float[source]¶
 Calculates the size corresponding to a specific value.
- Parameters:
 value (float) – value to calculate size for
- Return type:
 float
- Returns:
 calculated size using size scale transformer’s parameters and type
- type(self) QgsSizeScaleTransformer.ScaleType[source]¶
 Returns the size transformer’s scaling type (the method used to calculate the size from a value).
See also
- Return type: