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 )
76 CentroidFlag = 1 << 3,
77 MiddleOfSegmentFlag = 1 << 4,
78 LineEndpointFlag = 1 << 5,
80 Q_ENUM( SnappingTypes )
81 Q_DECLARE_FLAGS( SnappingTypeFlag, SnappingTypes )
82 Q_FLAG( SnappingTypeFlag )
94 Q_ENUM( ScaleDependencyMode )
102 static QString snappingTypeFlagToString( SnappingTypeFlag type );
110 static QIcon snappingTypeFlagToIcon( SnappingTypeFlag type );
152 bool enabled()
const;
155 void setEnabled(
bool enabled );
161 QgsSnappingConfig::SnappingTypeFlag typeFlag()
const;
182 double tolerance() const;
185 void setTolerance(
double tolerance );
197 double minimumScale() const;
203 void setMinimumScale(
double minScale );
209 double maximumScale() const;
215 void setMaximumScale(
double maxScale );
227 bool mEnabled = false;
228 SnappingTypeFlag mType = VertexFlag;
229 double mTolerance = 0;
231 double mMinimumScale = 0.0;
232 double mMaximumScale = 0.0;
246 bool enabled() const;
249 void setEnabled(
bool enabled );
282 double tolerance() const;
285 void setTolerance(
double tolerance );
291 double minimumScale() const;
297 void setMinimumScale(
double minScale );
303 double maximumScale() const;
309 void setMaximumScale(
double maxScale );
330 bool intersectionSnapping() const;
333 void setIntersectionSnapping(
bool enabled );
340 bool selfSnapping() const;
347 void setSelfSnapping(
bool enabled );
351 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> individualLayerSettings()
const;
353 SIP_PYDICT individualLayerSettings()
const;
356 PyObject *d = PyDict_New();
360 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
361 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::const_iterator i = container.constBegin();
362 while ( i != container.constEnd() )
367 PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer,
nullptr );
368 PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None );
370 if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 )
385 PyErr_SetString( PyExc_StopIteration,
"" );
406 void clearIndividualLayerSettings();
418 void readProject(
const QDomDocument &doc );
425 void writeProject( QDomDocument &doc );
437 bool addLayers(
const QList<QgsMapLayer *> &layers );
449 bool removeLayers(
const QList<QgsMapLayer *> &layers );
466 void readLegacySettings();
470 bool mEnabled =
false;
471 SnappingMode mMode = ActiveLayer;
472 SnappingTypeFlag mType = VertexFlag;
473 double mTolerance = 0.0;
474 ScaleDependencyMode mScaleDependencyMode = Disabled;
475 double mMinimumScale = 0.0;
476 double mMaximumScale = 0.0;
478 bool mIntersectionSnapping =
false;
479 bool mSelfSnapping =
false;
481 QHash<QgsVectorLayer *, IndividualLayerSettings> mIndividualLayerSettings;
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.
SnappingMode
SnappingMode defines on which layer the snapping is performed.
SnappingTypes
SnappingTypeFlag defines on what object the snapping is performed.
ScaleDependencyMode
ScaleDependencyMode the scale dependency mode of snapping.
SnappingType
SnappingType defines on what object the snapping is performed.
This is the class is providing tolerance value in map unit values.
UnitType
Type of unit of tolerance value from settings.
@ ProjectUnits
Map (project) units. Added in 2.8.
Represents a vector layer which manages a vector based data sets.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Q_DECLARE_OPERATORS_FOR_FLAGS(QgsField::ConfigurationFlags) CORE_EXPORT QDataStream &operator<<(QDataStream &out
Writes the field to stream out. QGIS version compatibility is not guaranteed.