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 );
226 bool mEnabled = false;
227 SnappingTypeFlag mType = VertexFlag;
228 double mTolerance = 0;
230 double mMinimumScale = 0.0;
231 double mMaximumScale = 0.0;
245 bool enabled() const;
248 void setEnabled(
bool enabled );
281 double tolerance() const;
284 void setTolerance(
double tolerance );
290 double minimumScale() const;
296 void setMinimumScale(
double minScale );
302 double maximumScale() const;
308 void setMaximumScale(
double maxScale );
329 bool intersectionSnapping() const;
332 void setIntersectionSnapping(
bool enabled );
339 bool selfSnapping() const;
346 void setSelfSnapping(
bool enabled );
350 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> individualLayerSettings()
const;
352 SIP_PYDICT individualLayerSettings()
const;
355 PyObject *d = PyDict_New();
359 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
360 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::const_iterator i = container.constBegin();
361 while ( i != container.constEnd() )
366 PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer,
nullptr );
367 PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None );
369 if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 )
384 PyErr_SetString( PyExc_StopIteration,
"" );
405 void clearIndividualLayerSettings();
417 void readProject(
const QDomDocument &doc );
424 void writeProject( QDomDocument &doc );
436 bool addLayers(
const QList<QgsMapLayer *> &layers );
448 bool removeLayers(
const QList<QgsMapLayer *> &layers );
465 void readLegacySettings();
469 bool mEnabled =
false;
470 SnappingMode mMode = ActiveLayer;
471 SnappingTypeFlag mType = VertexFlag;
472 double mTolerance = 0.0;
473 ScaleDependencyMode mScaleDependencyMode = Disabled;
474 double mMinimumScale = 0.0;
475 double mMaximumScale = 0.0;
477 bool mIntersectionSnapping =
false;
478 bool mSelfSnapping =
false;
480 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.