16 #ifndef QGSPROJECTSNAPPINGSETTINGS_H
17 #define QGSPROJECTSNAPPINGSETTINGS_H
20 #include "qgis_core.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 );
187 double minimumScale()
const;
193 void setMinimumScale(
double minScale );
199 double maximumScale()
const;
205 void setMaximumScale(
double maxScale );
217 bool mEnabled =
false;
218 Qgis::SnappingTypes mType = Qgis::SnappingType::Vertex;
219 double mTolerance = 0;
221 double mMinimumScale = 0.0;
222 double mMaximumScale = 0.0;
236 bool enabled()
const;
239 void setEnabled(
bool enabled );
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 );
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;
475 #endif // QGSPROJECTSNAPPINGSETTINGS_H