16#ifndef QGSPROJECTSNAPPINGSETTINGS_H
17#define QGSPROJECTSNAPPINGSETTINGS_H
68 Q_ENUM( ScaleDependencyMode )
211 bool mEnabled = false;
213 double mTolerance = 0;
214 Qgis::MapToolUnit mUnits =
Qgis::MapToolUnit::Pixels;
215 double mMinimumScale = 0.0;
216 double mMaximumScale = 0.0;
341 PyObject *d = PyDict_New();
345 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
346 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::const_iterator i = container.constBegin();
347 while ( i != container.constEnd() )
352 PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer,
nullptr );
353 PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None );
355 if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 )
370 PyErr_SetString( PyExc_StopIteration,
"" );
382 QgsSnappingConfig::IndividualLayerSettings individualLayerSettings( QgsVectorLayer *vl )
const;
385 void setIndividualLayerSettings( QgsVectorLayer *vl,
const QgsSnappingConfig::IndividualLayerSettings &individualLayerSettings );
392 void clearIndividualLayerSettings();
394 bool operator!=(
const QgsSnappingConfig &other )
const;
400 void readProject(
const QDomDocument &doc );
406 void writeProject( QDomDocument &doc );
417 bool addLayers(
const QList<QgsMapLayer *> &layers );
428 bool removeLayers(
const QList<QgsMapLayer *> &layers );
434 QgsProject *project()
const;
440 void setProject( QgsProject *project );
443 void readLegacySettings();
446 QgsProject *mProject =
nullptr;
447 bool mEnabled =
false;
450 double mTolerance = 0.0;
451 ScaleDependencyMode mScaleDependencyMode = Disabled;
452 double mMinimumScale = 0.0;
453 double mMaximumScale = 0.0;
455 bool mIntersectionSnapping =
false;
456 bool mSelfSnapping =
false;
458 QHash<QgsVectorLayer *, IndividualLayerSettings> mIndividualLayerSettings;
Provides global constants and enumerations for use throughout the application.
MapToolUnit
Type of unit of tolerance value from settings.
@ Project
Map (project) units.
SnappingType
SnappingTypeFlag defines on what object the snapping is performed.
QFlags< SnappingType > SnappingTypes
Snapping types.
SnappingMode
SnappingMode defines on which layer the snapping is performed.
@ ActiveLayer
On the active layer.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
A container of advanced configuration (per layer) of the snapping of the project.
double tolerance() const
Returns the tolerance.
void setEnabled(bool enabled)
enables the snapping
void setTypeFlag(Qgis::SnappingTypes type)
define the type of snapping
bool valid() const
Returns if settings are valid.
IndividualLayerSettings()=default
Constructs an invalid setting.
double maximumScale() const
Returns max scale on which snapping is limited.
Q_DECL_DEPRECATED IndividualLayerSettings(bool enabled, SnappingType type, double tolerance, Qgis::MapToolUnit units)
IndividualLayerSettings.
void setMinimumScale(double minScale)
Sets the min scale value on which snapping is used, 0.0 disable scale limit.
Qgis::MapToolUnit units() const
Returns the type of units.
void setMaximumScale(double maxScale)
Sets the max scale value on which snapping is used, 0.0 disable scale limit.
Q_DECL_DEPRECATED void setType(SnappingType type)
define the type of snapping
bool enabled() const
Returns if snapping is enabled.
Q_DECL_DEPRECATED QgsSnappingConfig::SnappingType type() const
Returns the flags type (vertices | segments | area | centroid | middle).
double minimumScale() const
Returns minimum scale on which snapping is limited.
void setUnits(Qgis::MapToolUnit units)
Sets the type of units.
Qgis::SnappingTypes typeFlag() const
Returns the flags type (vertices | segments | area | centroid | middle).
void setTolerance(double tolerance)
Sets the tolerance.
void setScaleDependencyMode(ScaleDependencyMode mode)
Set the scale dependency mode.
QgsSnappingConfig(QgsProject *project=nullptr)
Constructor with default parameters defined in global settings.
bool intersectionSnapping() const
Returns if the snapping on intersection is enabled.
ScaleDependencyMode
ScaleDependencyMode the scale dependency mode of snapping.
@ PerLayer
Scale dependency using min max range per layer.
@ Disabled
No scale dependency.
@ Global
Scale dependency using global min max range.
void setMode(Qgis::SnappingMode mode)
define the mode of snapping
static QIcon snappingTypeToIcon(Qgis::SnappingType type)
Convenient method to return an icon corresponding to the enum type Qgis::SnappingTypes.
void reset()
reset to default values
bool selfSnapping() const
Returns if self snapping (snapping to the currently digitized feature) is enabled.
Q_DECL_DEPRECATED QgsSnappingConfig::SnappingType type() const
Returns the flags type (vertices | segments | area | centroid | middle).
void setProject(QgsProject *project)
The project from which the snapped layers should be retrieved.
static Q_DECL_DEPRECATED QString snappingTypeFlagToString(Qgis::SnappingType type)
Convenient method to return the translated name of the enum type Qgis::SnappingTypes.
static QString snappingTypeToString(Qgis::SnappingType type)
Convenient method to returns the translated name of the enum type Qgis::SnappingTypes.
SnappingType
SnappingType defines on what object the snapping is performed.
@ VertexAndSegment
Both on vertices and segments.
@ Vertex
On vertices only.
@ Segment
On segments only.
void setSelfSnapping(bool enabled)
Sets if self snapping (snapping to the currently digitized feature) is enabled.
static Q_DECL_DEPRECATED QIcon snappingTypeFlagToIcon(Qgis::SnappingType type)
Convenient method to return an icon corresponding to the enum type Qgis::SnappingTypes.
QHash< QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings > individualLayerSettings() const
Returns individual snapping settings for all layers.
ScaleDependencyMode scaleDependencyMode() const
Returns the scale dependency mode.
void setEnabled(bool enabled)
enables the snapping
void setIntersectionSnapping(bool enabled)
Sets if the snapping on intersection is enabled.
Represents a vector layer which manages a vector based dataset.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)