Class: QgsMapUnitScale

Struct for storing maximum and minimum scales for measurements in map units

For measurements in map units, a minimum and a maximum scale can be defined. Outside this range, the measurements aren’t scaled anymore proportionally to the map scale.

Methods

computeMapUnitsPerPixel

Computes a map units per pixel scaling factor, respecting the minimum and maximum scales set for the object.

Attributes

maxScale

The maximum scale, or 0.0 if unset.

maxSizeMM

The maximum size in millimeters, or 0.0 if unset

maxSizeMMEnabled

Whether the maximum size in mm should be respected

minScale

The minimum scale, or 0.0 if unset.

minSizeMM

The minimum size in millimeters, or 0.0 if unset

minSizeMMEnabled

Whether the minimum size in mm should be respected

class qgis.core.QgsMapUnitScale[source]

Bases: object

__init__(minScale: float = 0, maxScale: float = 0)

Constructor for QgsMapUnitScale

Parameters:
  • minScale (float = 0) – minimum allowed scale, or 0.0 if no minimum scale set

  • maxScale (float = 0) – maximum allowed scale, or 0.0 if no maximum scale set The scale values indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

__init__(a0: QgsMapUnitScale)
Parameters:

a0 (QgsMapUnitScale)

computeMapUnitsPerPixel(self, c: QgsRenderContext) float[source]

Computes a map units per pixel scaling factor, respecting the minimum and maximum scales set for the object.

Parameters:

c (QgsRenderContext) – render context

Return type:

float

Returns:

map units per pixel, limited between minimum and maximum scales

maxScale

The maximum scale, or 0.0 if unset. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

maxSizeMM

The maximum size in millimeters, or 0.0 if unset

maxSizeMMEnabled

Whether the maximum size in mm should be respected

minScale

The minimum scale, or 0.0 if unset. The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

minSizeMM

The minimum size in millimeters, or 0.0 if unset

minSizeMMEnabled

Whether the minimum size in mm should be respected