QgsSnappingUtils::LayerConfig struct

Configures how a certain layer should be handled in a snapping operation.

Constructors, destructors, conversion operators

LayerConfig(QgsVectorLayer* l, QgsPointLocator::Types t, double tol, QgsTolerance::UnitType u)
Create a new configuration for a snapping layer.

Public variables

QgsVectorLayer* layer
The layer to configure.
double tolerance
The range around snapping targets in which snapping should occur.
QgsPointLocator::Types type
To which geometry properties of this layers a snapping should happen.
QgsTolerance::UnitType unit
The units in which the tolerance is specified.

Function documentation

QgsSnappingUtils::LayerConfig::LayerConfig(QgsVectorLayer* l, QgsPointLocator::Types t, double tol, QgsTolerance::UnitType u)

Create a new configuration for a snapping layer.

Parameters
l The vector layer for which this configuration is
t Which parts of the geometry should be snappable
tol The tolerance radius in which the snapping will trigger
u The unit in which the tolerance is specified
snapper = QgsMapCanvasSnappingUtils(mapCanvas)

snapping_layer1 = QgsSnappingUtils.LayerConfig(layer1, QgsPointLocator.Vertex, 10, QgsTolerance.Pixels)
snapping_layer2 = QgsSnappingUtils.LayerConfig(layer2, QgsPointLocator.Vertex and QgsPointLocator.Edge, 10, QgsTolerance.Pixels)

snapper.setLayers([snapping_layer1, snapping_layer2])