Class: QgsSnappingConfig¶
-
class
qgis.core.
QgsSnappingConfig
(project: QgsProject = None)¶ Bases:
sip.wrapper
Constructor with default parameters defined in global settings
QgsSnappingConfig(QgsSnappingConfig)
This is a container for configuration of the snapping of the project
New in version 3.0: Enums
Methods
Adds the specified layers as individual layers to the configuration with standard configuration.
Returns if snapping is enabled
Returns individual snapping settings for all layers
Returns if the snapping on intersection is enabled
Returns the mode (all layers, active layer, per layer settings)
The project from which the snapped layers should be retrieved
Reads the configuration from the specified QGIS project document.
Removes the specified layers from the individual layer configuration.
reset to default values
enables the snapping
Sets individual layer snappings settings (applied if mode is AdvancedConfiguration)
Sets if the snapping on intersection is enabled
define the mode of snapping
The project from which the snapped layers should be retrieved
Sets the tolerance
define the type of snapping
Sets the type of units
Returns the tolerance
Returns the type (vertices and/or segments)
Returns the type of units
Writes the configuration to the specified QGIS project document.
Signals
Attributes
-
ActiveLayer
= 1¶
-
AdvancedConfiguration
= 3¶
-
AllLayers
= 2¶
-
class
IndividualLayerSettings
(enabled: bool, type: QgsSnappingConfig.SnappingType, tolerance: float, units: QgsTolerance.UnitType)¶ Bases:
sip.wrapper
IndividualLayerSettings
- Parameters
enabled –
type –
tolerance –
units –
QgsSnappingConfig.IndividualLayerSettings() Constructs an invalid setting
QgsSnappingConfig.IndividualLayerSettings(QgsSnappingConfig.IndividualLayerSettings)
This is a container of advanced configuration (per layer) of the snapping of the project
New in version 3.0.
-
enabled
(self) → bool¶ Returns if snapping is enabled
-
setEnabled
(self, enabled: bool)¶ enables the snapping
-
setTolerance
(self, tolerance: float)¶ Sets the tolerance
-
setType
(self, type: QgsSnappingConfig.SnappingType)¶ define the type of snapping
-
setUnits
(self, units: QgsTolerance.UnitType)¶ Sets the type of units
-
tolerance
(self) → float¶ Returns the tolerance
-
type
(self) → QgsSnappingConfig.SnappingType¶ Returns the type (vertices and/or segments)
-
units
(self) → QgsTolerance.UnitType¶ Returns the type of units
-
valid
(self) → bool¶ Returns if settings are valid
-
Segment
= 3¶
-
class
SnappingMode
¶ Bases:
int
-
baseClass
¶ alias of
QgsSnappingConfig
-
-
class
SnappingType
¶ Bases:
int
-
baseClass
¶ alias of
QgsSnappingConfig
-
-
Vertex
= 1¶
-
VertexAndSegment
= 2¶
-
addLayers
(self, layers: Iterable[QgsMapLayer]) → bool¶ Adds the specified layers as individual layers to the configuration with standard configuration. When implementing a long-living QgsSnappingConfig (like the one in QgsProject) it is best to directly feed this with information from the layer registry.
- Returns
True if changes have been done.
New in version 3.0.
-
enabled
(self) → bool¶ Returns if snapping is enabled
-
individualLayerSettings
(self) → Dict¶ Returns individual snapping settings for all layers
individualLayerSettings(self, vl: QgsVectorLayer) -> QgsSnappingConfig.IndividualLayerSettings Returns individual layer snappings settings (applied if mode is AdvancedConfiguration)
-
intersectionSnapping
(self) → bool¶ Returns if the snapping on intersection is enabled
-
mode
(self) → QgsSnappingConfig.SnappingMode¶ Returns the mode (all layers, active layer, per layer settings)
-
project
(self) → QgsProject¶ The project from which the snapped layers should be retrieved
New in version 3.0.
-
readProject
(self, doc: QDomDocument)¶ Reads the configuration from the specified QGIS project document.
New in version 3.0.
-
removeLayers
(self, layers: Iterable[QgsMapLayer]) → bool¶ Removes the specified layers from the individual layer configuration. When implementing a long-living QgsSnappingConfig (like the one in QgsProject) it is best to directly feed this with information from the layer registry.
- Returns
True if changes have been done.
New in version 3.0.
-
reset
(self)¶ reset to default values
-
setEnabled
(self, enabled: bool)¶ enables the snapping
-
setIndividualLayerSettings
(self, vl: QgsVectorLayer, individualLayerSettings: QgsSnappingConfig.IndividualLayerSettings)¶ Sets individual layer snappings settings (applied if mode is AdvancedConfiguration)
-
setIntersectionSnapping
(self, enabled: bool)¶ Sets if the snapping on intersection is enabled
-
setMode
(self, mode: QgsSnappingConfig.SnappingMode)¶ define the mode of snapping
-
setProject
(self, project: QgsProject)¶ The project from which the snapped layers should be retrieved
New in version 3.0.
-
setTolerance
(self, tolerance: float)¶ Sets the tolerance
-
setType
(self, type: QgsSnappingConfig.SnappingType)¶ define the type of snapping
-
setUnits
(self, units: QgsTolerance.UnitType)¶ Sets the type of units
-
staticMetaObject
= <PyQt5.QtCore.QMetaObject object>¶
-
tolerance
(self) → float¶ Returns the tolerance
-
type
(self) → QgsSnappingConfig.SnappingType¶ Returns the type (vertices and/or segments)
-
units
(self) → QgsTolerance.UnitType¶ Returns the type of units
-
writeProject
(self, doc: QDomDocument)¶ Writes the configuration to the specified QGIS project document.
New in version 3.0.
-