mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			481 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			481 lines
		
	
	
		
			11 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
/************************************************************************
 | 
						|
 * 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
 | 
						|
This is a container for configuration of the snapping of the project
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgssnappingconfig.h"
 | 
						|
%End
 | 
						|
  public:
 | 
						|
    static const QMetaObject staticMetaObject;
 | 
						|
 | 
						|
  public:
 | 
						|
 | 
						|
    enum SnappingMode
 | 
						|
    {
 | 
						|
      ActiveLayer,
 | 
						|
      AllLayers,
 | 
						|
      AdvancedConfiguration,
 | 
						|
    };
 | 
						|
 | 
						|
    enum SnappingType
 | 
						|
    {
 | 
						|
      Vertex,
 | 
						|
      VertexAndSegment,
 | 
						|
      Segment,
 | 
						|
    };
 | 
						|
 | 
						|
    enum SnappingTypes
 | 
						|
    {
 | 
						|
      NoSnapFlag,
 | 
						|
      VertexFlag,
 | 
						|
      SegmentFlag,
 | 
						|
      AreaFlag,
 | 
						|
      CentroidFlag,
 | 
						|
      MiddleOfSegmentFlag,
 | 
						|
    };
 | 
						|
    typedef QFlags<QgsSnappingConfig::SnappingTypes> SnappingTypeFlag;
 | 
						|
 | 
						|
 | 
						|
    enum ScaleDependencyMode
 | 
						|
    {
 | 
						|
      Disabled,
 | 
						|
      Global,
 | 
						|
      PerLayer
 | 
						|
    };
 | 
						|
 | 
						|
    static const QString snappingTypeFlagToString( SnappingTypeFlag type );
 | 
						|
%Docstring
 | 
						|
Convenient method to returns the translated name of the enum type
 | 
						|
QgsSnappingConfig.SnappingTypeFlag
 | 
						|
 | 
						|
.. versionadded:: 3.12
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    class IndividualLayerSettings
 | 
						|
{
 | 
						|
%Docstring
 | 
						|
This is a container of advanced configuration (per layer) of the snapping of the project
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
%TypeHeaderCode
 | 
						|
#include "qgssnappingconfig.h"
 | 
						|
%End
 | 
						|
      public:
 | 
						|
 | 
						|
 IndividualLayerSettings( bool enabled, SnappingType type, double tolerance, QgsTolerance::UnitType units ) /Deprecated/;
 | 
						|
%Docstring
 | 
						|
IndividualLayerSettings
 | 
						|
 | 
						|
:param enabled:
 | 
						|
:param type:
 | 
						|
:param tolerance:
 | 
						|
:param units:
 | 
						|
 | 
						|
.. deprecated:: QGIS 3.12
 | 
						|
   use the method with SnappingTypeFlag instead.
 | 
						|
%End
 | 
						|
 | 
						|
        IndividualLayerSettings( bool enabled, SnappingTypeFlag type, double tolerance, QgsTolerance::UnitType 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
 | 
						|
 | 
						|
        QgsSnappingConfig::SnappingTypeFlag 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 ) /Deprecated/;
 | 
						|
%Docstring
 | 
						|
define the type of snapping
 | 
						|
 | 
						|
.. deprecated:: QGIS 3.12
 | 
						|
   use setTypeFlag instead.
 | 
						|
%End
 | 
						|
 | 
						|
        void setTypeFlag( QgsSnappingConfig::SnappingTypeFlag 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
 | 
						|
 | 
						|
        QgsTolerance::UnitType units() const;
 | 
						|
%Docstring
 | 
						|
Returns the type of units
 | 
						|
%End
 | 
						|
 | 
						|
        void setUnits( QgsTolerance::UnitType 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
 | 
						|
 | 
						|
    SnappingMode mode() const;
 | 
						|
%Docstring
 | 
						|
Returns the mode (all layers, active layer, per layer settings)
 | 
						|
%End
 | 
						|
 | 
						|
    void setMode( SnappingMode mode );
 | 
						|
%Docstring
 | 
						|
define the mode of snapping
 | 
						|
%End
 | 
						|
 | 
						|
    QgsSnappingConfig::SnappingTypeFlag 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( QgsSnappingConfig::SnappingTypeFlag 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
 | 
						|
 | 
						|
    QgsTolerance::UnitType units() const;
 | 
						|
%Docstring
 | 
						|
Returns the type of units
 | 
						|
%End
 | 
						|
 | 
						|
    void setUnits( QgsTolerance::UnitType 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 digitised feature) is enabled
 | 
						|
 | 
						|
.. versionadded:: 3.14
 | 
						|
%End
 | 
						|
 | 
						|
    void setSelfSnapping( bool enabled );
 | 
						|
%Docstring
 | 
						|
Sets if self snapping (snapping to the currently digitised 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<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
 | 
						|
    QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::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
 | 
						|
 | 
						|
    bool operator!= ( const QgsSnappingConfig &other ) const;
 | 
						|
 | 
						|
    void readProject( const QDomDocument &doc );
 | 
						|
%Docstring
 | 
						|
Reads the configuration from the specified QGIS project document.
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
    void writeProject( QDomDocument &doc );
 | 
						|
%Docstring
 | 
						|
Writes the configuration to the specified QGIS project document.
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
    bool addLayers( const QList<QgsMapLayer *> &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.
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
 | 
						|
    bool removeLayers( const QList<QgsMapLayer *> &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.
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
    QgsProject *project() const;
 | 
						|
%Docstring
 | 
						|
The project from which the snapped layers should be retrieved
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
    void setProject( QgsProject *project );
 | 
						|
%Docstring
 | 
						|
The project from which the snapped layers should be retrieved
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
QFlags<QgsSnappingConfig::SnappingTypes> operator|(QgsSnappingConfig::SnappingTypes f1, QFlags<QgsSnappingConfig::SnappingTypes> f2);
 | 
						|
 | 
						|
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/qgssnappingconfig.h                                         *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | 
						|
 ************************************************************************/
 |