QgsMapUnitScale class

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.

Constructors, destructors, conversion operators

QgsMapUnitScale(double minScale = 0.0, double maxScale = 0.0) explicit
Constructor for QgsMapUnitScale.

Public functions

auto computeMapUnitsPerPixel(const QgsRenderContext& c) const -> double
Computes a map units per pixel scaling factor, respecting the minimum and maximum scales set for the object.

Public variables

double maxScale
The maximum scale, or 0.0 if unset.
double maxSizeMM
The maximum size in millimeters, or 0.0 if unset.
bool maxSizeMMEnabled
Whether the maximum size in mm should be respected.
double minScale
The minimum scale, or 0.0 if unset.
double minSizeMM
The minimum size in millimeters, or 0.0 if unset.
bool minSizeMMEnabled
Whether the minimum size in mm should be respected.

Function documentation

QgsMapUnitScale::QgsMapUnitScale(double minScale = 0.0, double maxScale = 0.0) explicit

Constructor for QgsMapUnitScale.

Parameters
minScale minimum allowed scale, or 0.0 if no minimum scale set
maxScale 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.

double QgsMapUnitScale::computeMapUnitsPerPixel(const QgsRenderContext& c) const

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

Parameters
c render context
Returns map units per pixel, limited between minimum and maximum scales

Variable documentation

double QgsMapUnitScale::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.

double QgsMapUnitScale::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.