16#ifndef QGSPROJECTSNAPPINGSETTINGS_H
17#define QGSPROJECTSNAPPINGSETTINGS_H
70 Q_ENUM( ScaleDependencyMode )
214 bool mEnabled = false;
216 double mTolerance = 0;
217 Qgis::MapToolUnit mUnits =
Qgis::MapToolUnit::Pixels;
218 double mMinimumScale = 0.0;
219 double mMaximumScale = 0.0;
343 PyObject *d = PyDict_New();
347 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
348 QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::const_iterator i = container.constBegin();
349 while ( i != container.constEnd() )
354 PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer,
nullptr );
355 PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None );
357 if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 )
372 PyErr_SetString( PyExc_StopIteration,
"" );
383 QgsSnappingConfig::IndividualLayerSettings individualLayerSettings( QgsVectorLayer *vl )
const;
386 void setIndividualLayerSettings( QgsVectorLayer *vl,
const QgsSnappingConfig::IndividualLayerSettings &individualLayerSettings );
393 void clearIndividualLayerSettings();
395 bool operator!= (
const QgsSnappingConfig &other )
const;
401 void readProject(
const QDomDocument &doc );
407 void writeProject( QDomDocument &doc );
418 bool addLayers(
const QList<QgsMapLayer *> &layers );
429 bool removeLayers(
const QList<QgsMapLayer *> &layers );
435 QgsProject *project()
const;
441 void setProject( QgsProject *project );
444 void readLegacySettings();
447 QgsProject *mProject =
nullptr;
448 bool mEnabled =
false;
451 double mTolerance = 0.0;
452 ScaleDependencyMode mScaleDependencyMode = Disabled;
453 double mMinimumScale = 0.0;
454 double mMaximumScale = 0.0;
456 bool mIntersectionSnapping =
false;
457 bool mSelfSnapping =
false;
459 QHash<QgsVectorLayer *, IndividualLayerSettings> mIndividualLayerSettings;
Provides global constants and enumerations for use throughout the application.
MapToolUnit
Type of unit of tolerance value from settings.
@ Project
Map (project) units.
SnappingType
SnappingTypeFlag defines on what object the snapping is performed.
QFlags< SnappingType > SnappingTypes
Snapping types.
SnappingMode
SnappingMode defines on which layer the snapping is performed.
@ ActiveLayer
On the active layer.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
A container of advanced configuration (per layer) of the snapping of the project.
double tolerance() const
Returns the tolerance.
void setEnabled(bool enabled)
enables the snapping
void setTypeFlag(Qgis::SnappingTypes type)
define the type of snapping
bool valid() const
Returns if settings are valid.
IndividualLayerSettings()=default
Constructs an invalid setting.
double maximumScale() const
Returns max scale on which snapping is limited.
Q_DECL_DEPRECATED IndividualLayerSettings(bool enabled, SnappingType type, double tolerance, Qgis::MapToolUnit units)
IndividualLayerSettings.
void setMinimumScale(double minScale)
Sets the min scale value on which snapping is used, 0.0 disable scale limit.
Qgis::MapToolUnit units() const
Returns the type of units.
void setMaximumScale(double maxScale)
Sets the max scale value on which snapping is used, 0.0 disable scale limit.
Q_DECL_DEPRECATED void setType(SnappingType type)
define the type of snapping
bool enabled() const
Returns if snapping is enabled.
Q_DECL_DEPRECATED QgsSnappingConfig::SnappingType type() const
Returns the flags type (vertices | segments | area | centroid | middle).
double minimumScale() const
Returns minimum scale on which snapping is limited.
void setUnits(Qgis::MapToolUnit units)
Sets the type of units.
Qgis::SnappingTypes typeFlag() const
Returns the flags type (vertices | segments | area | centroid | middle).
void setTolerance(double tolerance)
Sets the tolerance.
void setScaleDependencyMode(ScaleDependencyMode mode)
Set the scale dependency mode.
QgsSnappingConfig(QgsProject *project=nullptr)
Constructor with default parameters defined in global settings.
bool intersectionSnapping() const
Returns if the snapping on intersection is enabled.
ScaleDependencyMode
ScaleDependencyMode the scale dependency mode of snapping.
@ PerLayer
Scale dependency using min max range per layer.
@ Disabled
No scale dependency.
@ Global
Scale dependency using global min max range.
void setMode(Qgis::SnappingMode mode)
define the mode of snapping
static QIcon snappingTypeToIcon(Qgis::SnappingType type)
Convenient method to return an icon corresponding to the enum type Qgis::SnappingTypes.
void reset()
reset to default values
bool selfSnapping() const
Returns if self snapping (snapping to the currently digitized feature) is enabled.
Q_DECL_DEPRECATED QgsSnappingConfig::SnappingType type() const
Returns the flags type (vertices | segments | area | centroid | middle).
void setProject(QgsProject *project)
The project from which the snapped layers should be retrieved.
static Q_DECL_DEPRECATED QString snappingTypeFlagToString(Qgis::SnappingType type)
Convenient method to return the translated name of the enum type Qgis::SnappingTypes.
static QString snappingTypeToString(Qgis::SnappingType type)
Convenient method to returns the translated name of the enum type Qgis::SnappingTypes.
SnappingType
SnappingType defines on what object the snapping is performed.
@ VertexAndSegment
Both on vertices and segments.
@ Vertex
On vertices only.
@ Segment
On segments only.
void setSelfSnapping(bool enabled)
Sets if self snapping (snapping to the currently digitized feature) is enabled.
static Q_DECL_DEPRECATED QIcon snappingTypeFlagToIcon(Qgis::SnappingType type)
Convenient method to return an icon corresponding to the enum type Qgis::SnappingTypes.
QHash< QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings > individualLayerSettings() const
Returns individual snapping settings for all layers.
ScaleDependencyMode scaleDependencyMode() const
Returns the scale dependency mode.
void setEnabled(bool enabled)
enables the snapping
void setIntersectionSnapping(bool enabled)
Sets if the snapping on intersection is enabled.
Represents a vector layer which manages a vector based dataset.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)