16 #ifndef QGSPROJECTSNAPPINGSETTINGS_H
17 #define QGSPROJECTSNAPPINGSETTINGS_H
20 #include "qgis_core.h"
37 Q_PROPERTY(
QgsProject *project READ project WRITE setProject )
48 AdvancedConfiguration = 3,
50 Q_ENUM( SnappingMode )
77 MiddleOfSegmentFlag = 16,
79 Q_ENUM( SnappingTypes )
80 Q_DECLARE_FLAGS( SnappingTypeFlag, SnappingTypes )
81 Q_FLAG( SnappingTypeFlag )
93 Q_ENUM( ScaleDependencyMode )
101 static const QString snappingTypeFlagToString( SnappingTypeFlag type )
156 bool enabled()
const;
159 void setEnabled(
bool enabled );
165 QgsSnappingConfig::SnappingTypeFlag typeFlag()
const;
186 double tolerance() const;
189 void setTolerance(
double tolerance );
201 double minimumScale() const;
207 void setMinimumScale(
double minScale );
213 double maximumScale() const;
219 void setMaximumScale(
double maxScale );
230 bool mEnabled = false;
231 SnappingTypeFlag mType = VertexFlag;
232 double mTolerance = 0;
234 double mMinimumScale = 0.0;
235 double mMaximumScale = 0.0;
249 bool enabled() const;
252 void setEnabled(
bool enabled );
285 double tolerance() const;
288 void setTolerance(
double tolerance );
294 double minimumScale() const;
300 void setMinimumScale(
double minScale );
306 double maximumScale() const;
312 void setMaximumScale(
double maxScale );
333 bool intersectionSnapping() const;
336 void setIntersectionSnapping(
bool enabled );
343 bool selfSnapping() const;
350 void setSelfSnapping(
bool enabled );
354 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> individualLayerSettings()
const;
356 SIP_PYDICT individualLayerSettings()
const;
359 PyObject *d = PyDict_New();
363 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
364 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::const_iterator i = container.constBegin();
365 while ( i != container.constEnd() )
370 PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer,
nullptr );
371 PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None );
373 if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 )
388 PyErr_SetString( PyExc_StopIteration,
"" );
409 void clearIndividualLayerSettings();
421 void readProject(
const QDomDocument &doc );
428 void writeProject( QDomDocument &doc );
440 bool addLayers(
const QList<QgsMapLayer *> &layers );
452 bool removeLayers(
const QList<QgsMapLayer *> &layers );
469 void readLegacySettings();
473 bool mEnabled =
false;
474 SnappingMode mMode = ActiveLayer;
475 SnappingTypeFlag mType = VertexFlag;
476 double mTolerance = 0.0;
477 ScaleDependencyMode mScaleDependencyMode = Disabled;
478 double mMinimumScale = 0.0;
479 double mMaximumScale = 0.0;
481 bool mIntersectionSnapping =
false;
482 bool mSelfSnapping =
false;
484 QHash<QgsVectorLayer *, IndividualLayerSettings> mIndividualLayerSettings;
489 #endif // QGSPROJECTSNAPPINGSETTINGS_H