QgsTolerance class

This is the class is providing tolerance value in map unit values.

Public types

enum UnitType { LayerUnits, Pixels, ProjectUnits }
Type of unit of tolerance value from settings.

Public static functions

static auto defaultTolerance(QgsMapLayer* layer, const QgsMapSettings& mapSettings) -> double
Static function to get default tolerance value for a layer.
static auto toleranceInMapUnits(double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, UnitType units = LayerUnits) -> double
Static function to translate tolerance value into layer units.
static auto toleranceInProjectUnits(double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, QgsTolerance::UnitType units) -> double
Static function to translate tolerance value into map units.
static auto vertexSearchRadius(const QgsMapSettings& mapSettings) -> double
Static function to get vertex tolerance value.
static auto vertexSearchRadius(QgsMapLayer* layer, const QgsMapSettings& mapSettings) -> double
Static function to get vertex tolerance value for a layer.

Enum documentation

enum QgsTolerance::UnitType

Type of unit of tolerance value from settings.

For map (project) units, use ProjectUnits.

Enumerators
LayerUnits

Layer unit value.

Pixels

Pixels unit of tolerance.

ProjectUnits

Map (project) units. Added in 2.8.

Function documentation

static double QgsTolerance::defaultTolerance(QgsMapLayer* layer, const QgsMapSettings& mapSettings)

Static function to get default tolerance value for a layer.

Returns value of default tolerance in layer units

The value is read from settings and transformed if necessary.

static double QgsTolerance::toleranceInMapUnits(double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, UnitType units = LayerUnits)

Static function to translate tolerance value into layer units.

Parameters
tolerance tolerance value to be translated
layer reference layer
mapSettings settings of the map
units type of units to be translated
Returns value of tolerance in layer units

static double QgsTolerance::toleranceInProjectUnits(double tolerance, QgsMapLayer* layer, const QgsMapSettings& mapSettings, QgsTolerance::UnitType units)

Static function to translate tolerance value into map units.

Parameters
tolerance tolerance value to be translated
layer source layer necessary in case tolerance is in layer units
mapSettings settings of the map
units type of units to be translated
Returns value of tolerance in map units

static double QgsTolerance::vertexSearchRadius(const QgsMapSettings& mapSettings)

Static function to get vertex tolerance value.

Returns value of vertex tolerance in map units (not layer units)

The value is read from settings and transformed if necessary.

static double QgsTolerance::vertexSearchRadius(QgsMapLayer* layer, const QgsMapSettings& mapSettings)

Static function to get vertex tolerance value for a layer.

Returns value of vertex tolerance in layer units

The value is read from settings and transformed if necessary.