Class: QgsTolerance

class qgis.core.QgsTolerance

Bases: sip.wrapper

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

Methods

defaultTolerance

Static function to get default tolerance value for a layer.

toleranceInMapUnits

Static function to translate tolerance value into layer units

toleranceInProjectUnits

Static function to translate tolerance value into map units

vertexSearchRadius

Static function to get vertex tolerance value.

Attributes

LayerUnits

Pixels

ProjectUnits

staticMetaObject

LayerUnits = 0
Pixels = 1
ProjectUnits = 2
class UnitType

Bases: int

baseClass

alias of qgis._core.QgsTolerance

defaultTolerance(layer: QgsMapLayer, mapSettings: QgsMapSettings) → float

Static function to get default tolerance value for a layer. The value is read from settings and transformed if necessary.

Return type

float

Returns

value of default tolerance in layer units

Parameters
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
toleranceInMapUnits(tolerance: float, layer: QgsMapLayer, mapSettings: QgsMapSettings, units: QgsTolerance.UnitType = QgsTolerance.LayerUnits) → float

Static function to translate tolerance value into layer units

Parameters
  • tolerance (float) – tolerance value to be translated

  • layer (QgsMapLayer) – reference layer

  • mapSettings (QgsMapSettings) – settings of the map

  • units (QgsTolerance.UnitType = QgsTolerance.LayerUnits) – type of units to be translated

Return type

float

Returns

value of tolerance in layer units

toleranceInProjectUnits(tolerance: float, layer: QgsMapLayer, mapSettings: QgsMapSettings, units: QgsTolerance.UnitType) → float

Static function to translate tolerance value into map units

Parameters
  • tolerance (float) – tolerance value to be translated

  • layer (QgsMapLayer) – source layer necessary in case tolerance is in layer units

  • mapSettings (QgsMapSettings) – settings of the map

  • units (QgsTolerance.UnitType) – type of units to be translated

Return type

float

Returns

value of tolerance in map units

New in version 2.8.

vertexSearchRadius(mapSettings: QgsMapSettings) → float

Static function to get vertex tolerance value. The value is read from settings and transformed if necessary.

Returns

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

New in version 2.8.

vertexSearchRadius(layer: QgsMapLayer, mapSettings: QgsMapSettings) -> float Static function to get vertex tolerance value for a layer. The value is read from settings and transformed if necessary.

Return type

float

Returns

value of vertex tolerance in layer units

Parameters

mapSettings (QgsMapSettings) –