/************************************************************************ * This file has been generated automatically from * * * * src/core/qgssnappingconfig.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/ class QgsSnappingConfig { %Docstring(signature="appended") This is a container for configuration of the snapping of the project %End %TypeHeaderCode #include "qgssnappingconfig.h" %End public: static const QMetaObject staticMetaObject; public: enum SnappingType /BaseType=IntEnum/ { Vertex, VertexAndSegment, Segment, }; enum ScaleDependencyMode /BaseType=IntEnum/ { Disabled, Global, PerLayer }; static QString snappingTypeToString( Qgis::SnappingType type ); %Docstring Convenient method to returns the translated name of the enum type :py:class:`Qgis`.SnappingTypes. .. versionadded:: 3.26 %End static QString snappingTypeFlagToString( Qgis::SnappingType type ) /Deprecated/; %Docstring Convenient method to return the translated name of the enum type :py:class:`Qgis`.SnappingTypes. .. versionadded:: 3.12 .. deprecated:: QGIS 3.26 use :py:class:`Qgis`.snappingTypeToString instead %End static QIcon snappingTypeToIcon( Qgis::SnappingType type ); %Docstring Convenient method to return an icon corresponding to the enum type :py:class:`Qgis`.SnappingTypes. .. versionadded:: 3.20 %End static QIcon snappingTypeFlagToIcon( Qgis::SnappingType type ) /Deprecated/; %Docstring Convenient method to return an icon corresponding to the enum type :py:class:`Qgis`.SnappingTypes. .. deprecated:: QGIS 3.26 use :py:class:`Qgis`.snappingTypeToString instead .. versionadded:: 3.20 %End class IndividualLayerSettings { %Docstring(signature="appended") This is a container of advanced configuration (per layer) of the snapping of the project %End %TypeHeaderCode #include "qgssnappingconfig.h" %End public: IndividualLayerSettings( bool enabled, SnappingType type, double tolerance, Qgis::MapToolUnit units ) /Deprecated/; %Docstring IndividualLayerSettings :param enabled: :param type: :param tolerance: :param units: .. deprecated:: QGIS 3.12 use the method with :py:class:`Qgis`.SnappingTypes instead. %End IndividualLayerSettings( bool enabled, Qgis::SnappingTypes type, double tolerance, Qgis::MapToolUnit units, double minScale = 0.0, double maxScale = 0.0 ); %Docstring IndividualLayerSettings :param enabled: :param type: :param tolerance: :param units: :param minScale: 0.0 disable scale limit :param maxScale: 0.0 disable scale limit .. versionadded:: 3.12 %End IndividualLayerSettings(); %Docstring Constructs an invalid setting %End bool valid() const; %Docstring Returns if settings are valid %End bool enabled() const; %Docstring Returns if snapping is enabled %End void setEnabled( bool enabled ); %Docstring enables the snapping %End Qgis::SnappingTypes typeFlag() const; %Docstring Returns the flags type (vertices | segments | area | centroid | middle) .. versionadded:: 3.12 %End QgsSnappingConfig::SnappingType type() const /Deprecated/; %Docstring Returns the flags type (vertices | segments | area | centroid | middle) .. deprecated:: QGIS 3.12 use typeFlag instead. %End void setType( SnappingType type ) /Deprecated/; %Docstring define the type of snapping .. deprecated:: QGIS 3.12 use setTypeFlag instead. %End void setTypeFlag( Qgis::SnappingTypes type ); %Docstring define the type of snapping .. versionadded:: 3.12 %End double tolerance() const; %Docstring Returns the tolerance %End void setTolerance( double tolerance ); %Docstring Sets the tolerance %End Qgis::MapToolUnit units() const; %Docstring Returns the type of units %End void setUnits( Qgis::MapToolUnit units ); %Docstring Sets the type of units %End double minimumScale() const; %Docstring Returns minimum scale on which snapping is limited .. versionadded:: 3.14 %End void setMinimumScale( double minScale ); %Docstring Sets the min scale value on which snapping is used, 0.0 disable scale limit .. versionadded:: 3.14 %End double maximumScale() const; %Docstring Returns max scale on which snapping is limited .. versionadded:: 3.14 %End void setMaximumScale( double maxScale ); %Docstring Sets the max scale value on which snapping is used, 0.0 disable scale limit .. versionadded:: 3.14 %End bool operator!= ( const QgsSnappingConfig::IndividualLayerSettings &other ) const; bool operator== ( const QgsSnappingConfig::IndividualLayerSettings &other ) const; }; explicit QgsSnappingConfig( QgsProject *project = 0 ); %Docstring Constructor with default parameters defined in global settings %End bool operator==( const QgsSnappingConfig &other ) const; void reset(); %Docstring reset to default values %End bool enabled() const; %Docstring Returns if snapping is enabled %End void setEnabled( bool enabled ); %Docstring enables the snapping %End Qgis::SnappingMode mode() const; %Docstring Returns the mode (all layers, active layer, per layer settings) %End void setMode( Qgis::SnappingMode mode ); %Docstring define the mode of snapping %End Qgis::SnappingTypes typeFlag() const; %Docstring Returns the flags type (vertices | segments | area | centroid | middle) .. versionadded:: 3.12 %End QgsSnappingConfig::SnappingType type() const /Deprecated/; %Docstring Returns the flags type (vertices | segments | area | centroid | middle) .. deprecated:: QGIS 3.12 use typeFlag instead. %End void setType( QgsSnappingConfig::SnappingType type ); %Docstring define the type of snapping .. deprecated:: QGIS 3.12 use setTypeFlag instead. %End void setTypeFlag( Qgis::SnappingTypes type ); %Docstring define the type of snapping .. versionadded:: 3.12 %End double tolerance() const; %Docstring Returns the tolerance %End void setTolerance( double tolerance ); %Docstring Sets the tolerance %End double minimumScale() const; %Docstring Returns the min scale (i.e. most \"zoomed out\" scale) .. versionadded:: 3.14 %End void setMinimumScale( double minScale ); %Docstring Sets the min scale on which snapping is enabled, 0.0 disable scale limit .. versionadded:: 3.14 %End double maximumScale() const; %Docstring Returns the max scale (i.e. most \"zoomed in\" scale) .. versionadded:: 3.14 %End void setMaximumScale( double maxScale ); %Docstring Set the max scale on which snapping is enabled, 0.0 disable scale limit .. versionadded:: 3.14 %End void setScaleDependencyMode( ScaleDependencyMode mode ); %Docstring Set the scale dependency mode .. versionadded:: 3.14 %End ScaleDependencyMode scaleDependencyMode() const; %Docstring Returns the scale dependency mode .. versionadded:: 3.14 %End Qgis::MapToolUnit units() const; %Docstring Returns the type of units %End void setUnits( Qgis::MapToolUnit units ); %Docstring Sets the type of units %End bool intersectionSnapping() const; %Docstring Returns if the snapping on intersection is enabled %End void setIntersectionSnapping( bool enabled ); %Docstring Sets if the snapping on intersection is enabled %End bool selfSnapping() const; %Docstring Returns if self snapping (snapping to the currently digitized feature) is enabled .. versionadded:: 3.14 %End void setSelfSnapping( bool enabled ); %Docstring Sets if self snapping (snapping to the currently digitized feature) is enabled .. versionadded:: 3.14 %End SIP_PYDICT individualLayerSettings() const; %Docstring Returns individual snapping settings for all layers %End %MethodCode // Create the dictionary. PyObject *d = PyDict_New(); if ( !d ) return nullptr; // Set the dictionary elements. QHash container = sipCpp->individualLayerSettings(); QHash::const_iterator i = container.constBegin(); while ( i != container.constEnd() ) { QgsVectorLayer *vl = i.key(); QgsSnappingConfig::IndividualLayerSettings *ils = new QgsSnappingConfig::IndividualLayerSettings( i.value() ); PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer, nullptr ); PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None ); if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 ) { Py_DECREF( d ); if ( vlobj ) { Py_DECREF( vlobj ); } if ( ilsobj ) { Py_DECREF( ilsobj ); } else { delete ils; } PyErr_SetString( PyExc_StopIteration, "" ); } Py_DECREF( vlobj ); Py_DECREF( ilsobj ); ++i; } sipRes = d; %End QgsSnappingConfig::IndividualLayerSettings individualLayerSettings( QgsVectorLayer *vl ) const; %Docstring Returns individual layer snappings settings (applied if mode is AdvancedConfiguration) %End void setIndividualLayerSettings( QgsVectorLayer *vl, const QgsSnappingConfig::IndividualLayerSettings &individualLayerSettings ); %Docstring Sets individual layer snappings settings (applied if mode is AdvancedConfiguration) %End void clearIndividualLayerSettings(); %Docstring Removes all individual layer snapping settings .. versionadded:: 3.16 %End bool operator!= ( const QgsSnappingConfig &other ) const; void readProject( const QDomDocument &doc ); %Docstring Reads the configuration from the specified QGIS project document. %End void writeProject( QDomDocument &doc ); %Docstring Writes the configuration to the specified QGIS project document. %End bool addLayers( const QList &layers ); %Docstring Adds the specified layers as individual layers to the configuration with standard configuration. When implementing a long-living QgsSnappingConfig (like the one in QgsProject) it is best to directly feed this with information from the layer registry. :return: ``True`` if changes have been done. %End bool removeLayers( const QList &layers ); %Docstring Removes the specified layers from the individual layer configuration. When implementing a long-living QgsSnappingConfig (like the one in QgsProject) it is best to directly feed this with information from the layer registry. :return: ``True`` if changes have been done. %End QgsProject *project() const; %Docstring The project from which the snapped layers should be retrieved %End void setProject( QgsProject *project ); %Docstring The project from which the snapped layers should be retrieved %End }; /************************************************************************ * This file has been generated automatically from * * * * src/core/qgssnappingconfig.h * * * * Do not edit manually ! Edit header and run scripts/sipify.pl again * ************************************************************************/