Subgroup: Snapping
Class: QgsSnappingConfig¶
-
class
qgis.core.
QgsSnappingConfig
¶ Bases:
sip.wrapper
This is a container for configuration of the snapping of the project
New in version 3.0: Methods
addLayers
Adds the specified layers as individual layers to the configuration with standard configuration. enabled
return if snapping is enabled individualLayerSettings
return individual snapping settings for all layers intersectionSnapping
return if the snapping on intersection is enabled mode
return the mode (all layers, active layer, per layer settings) project
The project from which the snapped layers should be retrieved readProject
Reads the configuration from the specified QGIS project document. removeLayers
Removes the specified layers from the individual layer configuration. reset
reset to default values setEnabled
enables the snapping setIndividualLayerSettings
set individual layer snappings settings (applied if mode is AdvancedConfiguration) setIntersectionSnapping
set if the snapping on intersection is enabled setMode
define the mode of snapping setProject
The project from which the snapped layers should be retrieved setTolerance
set the tolerance setType
define the type of snapping setUnits
set the type of units tolerance
return the tolerance type
return the type (vertices and/or segments) units
return the type of units writeProject
Writes the configuration to the specified QGIS project document. Attributes
ActiveLayer
AdvancedConfiguration
AllLayers
Segment
Vertex
VertexAndSegment
-
ActiveLayer
= 1¶
-
AdvancedConfiguration
= 3¶
-
AllLayers
= 2¶
-
class
IndividualLayerSettings
¶ Bases:
sip.wrapper
This is a container of advanced configuration (per layer) of the snapping of the project
New in version 3.0.
-
enabled
(self) → bool¶ return if snapping is enabled
-
setEnabled
(self, enabled: bool)¶ enables the snapping
-
setTolerance
(self, tolerance: float)¶ set the tolerance
-
setType
(self, type: QgsSnappingConfig.SnappingType)¶ define the type of snapping
-
setUnits
(self, units: QgsTolerance.UnitType)¶ set the type of units
-
tolerance
(self) → float¶ return the tolerance
-
type
(self) → QgsSnappingConfig.SnappingType¶ return the type (vertices and/or segments)
-
units
(self) → QgsTolerance.UnitType¶ return the type of units
-
valid
(self) → bool¶ return if settings are valid
-
-
Segment
= 3¶
-
class
SnappingMode
¶ Bases:
int
-
class
SnappingType
¶ Bases:
int
-
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¶ return if snapping is enabled
-
individualLayerSettings
(self) → Dict¶ return individual snapping settings for all layers
individualLayerSettings(self, vl: QgsVectorLayer) -> QgsSnappingConfig.IndividualLayerSettings return individual layer snappings settings (applied if mode is AdvancedConfiguration)
-
intersectionSnapping
(self) → bool¶ return if the snapping on intersection is enabled
-
mode
(self) → QgsSnappingConfig.SnappingMode¶ return 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)¶ set individual layer snappings settings (applied if mode is AdvancedConfiguration)
-
setIntersectionSnapping
(self, enabled: bool)¶ set 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)¶ set the tolerance
-
setType
(self, type: QgsSnappingConfig.SnappingType)¶ define the type of snapping
-
setUnits
(self, units: QgsTolerance.UnitType)¶ set the type of units
-
tolerance
(self) → float¶ return the tolerance
-
type
(self) → QgsSnappingConfig.SnappingType¶ return the type (vertices and/or segments)
-
units
(self) → QgsTolerance.UnitType¶ return the type of units
-
writeProject
(self, doc: QDomDocument)¶ Writes the configuration to the specified QGIS project document.
New in version 3.0.
-