16#ifndef QGSPROJECTSNAPPINGSETTINGS_H
17#define QGSPROJECTSNAPPINGSETTINGS_H
41 Q_PROPERTY(
QgsProject *project READ project WRITE setProject )
69 Q_ENUM( ScaleDependencyMode )
142 bool enabled()
const;
145 void setEnabled(
bool enabled );
151 Qgis::SnappingTypes typeFlag()
const;
169 void setTypeFlag(
Qgis::SnappingTypes type );
172 double tolerance() const;
175 void setTolerance(
double tolerance );
178 Qgis::MapToolUnit units() const;
181 void setUnits(
Qgis::MapToolUnit units );
187 double minimumScale() const;
193 void setMinimumScale(
double minScale );
199 double maximumScale() const;
205 void setMaximumScale(
double maxScale );
217 bool mEnabled = false;
219 double mTolerance = 0;
220 Qgis::MapToolUnit mUnits =
Qgis::MapToolUnit::Pixels;
221 double mMinimumScale = 0.0;
222 double mMaximumScale = 0.0;
236 bool enabled() const;
239 void setEnabled(
bool enabled );
242 Qgis::SnappingMode mode() const;
245 void setMode(
Qgis::SnappingMode mode );
251 Qgis::SnappingTypes typeFlag() const;
269 void setTypeFlag(
Qgis::SnappingTypes type );
272 double tolerance() const;
275 void setTolerance(
double tolerance );
281 double minimumScale() const;
287 void setMinimumScale(
double minScale );
293 double maximumScale() const;
299 void setMaximumScale(
double maxScale );
314 Qgis::MapToolUnit units() const;
317 void setUnits(
Qgis::MapToolUnit units );
320 bool intersectionSnapping() const;
323 void setIntersectionSnapping(
bool enabled );
330 bool selfSnapping() const;
337 void setSelfSnapping(
bool enabled );
341 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> individualLayerSettings()
const;
343 SIP_PYDICT individualLayerSettings()
const;
346 PyObject *d = PyDict_New();
350 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
351 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::const_iterator i = container.constBegin();
352 while ( i != container.constEnd() )
357 PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer,
nullptr );
358 PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None );
360 if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 )
375 PyErr_SetString( PyExc_StopIteration,
"" );
396 void clearIndividualLayerSettings();
408 void readProject(
const QDomDocument &doc );
415 void writeProject( QDomDocument &doc );
427 bool addLayers(
const QList<QgsMapLayer *> &layers );
439 bool removeLayers(
const QList<QgsMapLayer *> &layers );
456 void readLegacySettings();
460 bool mEnabled =
false;
462 Qgis::SnappingTypes mType = Qgis::SnappingType::Vertex;
463 double mTolerance = 0.0;
464 ScaleDependencyMode mScaleDependencyMode = Disabled;
465 double mMinimumScale = 0.0;
466 double mMaximumScale = 0.0;
468 bool mIntersectionSnapping =
false;
469 bool mSelfSnapping =
false;
471 QHash<QgsVectorLayer *, IndividualLayerSettings> mIndividualLayerSettings;
The Qgis class provides global constants for use throughout the application.
MapToolUnit
Type of unit of tolerance value from settings.
SnappingType
SnappingTypeFlag defines on what object the snapping is performed.
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,...
This is a container of advanced configuration (per layer) of the snapping of the project.
IndividualLayerSettings()=default
Constructs an invalid setting.
This is a container for configuration of the snapping of the project.
ScaleDependencyMode
ScaleDependencyMode the scale dependency mode of snapping.
static Q_DECL_DEPRECATED QString snappingTypeFlagToString(Qgis::SnappingType type)
Convenient method to return the translated name of the enum type Qgis::SnappingTypes.
SnappingType
SnappingType defines on what object the snapping is performed.
static Q_DECL_DEPRECATED QIcon snappingTypeFlagToIcon(Qgis::SnappingType type)
Convenient method to return an icon corresponding to the enum type Qgis::SnappingTypes.
Represents a vector layer which manages a vector based data sets.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)