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;
183 void setTypeFlag( QgsSnappingConfig::SnappingTypeFlag type );
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 );
264 QgsSnappingConfig::SnappingTypeFlag typeFlag()
const;
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,
"" );
414 void readProject(
const QDomDocument &doc );
421 void writeProject( QDomDocument &doc );
433 bool addLayers(
const QList<QgsMapLayer *> &layers );
445 bool removeLayers(
const QList<QgsMapLayer *> &layers );
462 void readLegacySettings();
466 bool mEnabled =
false;
467 SnappingMode mMode = ActiveLayer;
468 SnappingTypeFlag mType = VertexFlag;
469 double mTolerance = 0.0;
470 ScaleDependencyMode mScaleDependencyMode = Disabled;
471 double mMinimumScale = 0.0;
472 double mMaximumScale = 0.0;
474 bool mIntersectionSnapping =
false;
475 bool mSelfSnapping =
false;
477 QHash<QgsVectorLayer *, IndividualLayerSettings> mIndividualLayerSettings;
480 Q_DECLARE_OPERATORS_FOR_FLAGS( QgsSnappingConfig::SnappingTypeFlag )
482 #endif // QGSPROJECTSNAPPINGSETTINGS_H