mirror of
				https://github.com/qgis/QGIS.git
				synced 2025-11-04 00:04:25 -05:00 
			
		
		
		
	
		
			
				
	
	
		
			326 lines
		
	
	
		
			7.8 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			326 lines
		
	
	
		
			7.8 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:
 | 
						|
 | 
						|
    enum SnappingMode
 | 
						|
    {
 | 
						|
      ActiveLayer,
 | 
						|
      AllLayers,
 | 
						|
      AdvancedConfiguration,
 | 
						|
    };
 | 
						|
 | 
						|
    enum SnappingType
 | 
						|
    {
 | 
						|
      Vertex,
 | 
						|
      VertexAndSegment,
 | 
						|
      Segment,
 | 
						|
    };
 | 
						|
 | 
						|
    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, QgsSnappingConfig::SnappingType type, double tolerance, QgsTolerance::UnitType units );
 | 
						|
%Docstring
 | 
						|
 IndividualLayerSettings
 | 
						|
 \param enabled
 | 
						|
 \param type
 | 
						|
 \param tolerance
 | 
						|
 \param units
 | 
						|
%End
 | 
						|
 | 
						|
        IndividualLayerSettings();
 | 
						|
%Docstring
 | 
						|
 Constructs an invalid setting
 | 
						|
%End
 | 
						|
 | 
						|
        bool valid() const;
 | 
						|
%Docstring
 | 
						|
return if settings are valid
 | 
						|
 :rtype: bool
 | 
						|
%End
 | 
						|
 | 
						|
        bool enabled() const;
 | 
						|
%Docstring
 | 
						|
return if snapping is enabled
 | 
						|
 :rtype: bool
 | 
						|
%End
 | 
						|
 | 
						|
        void setEnabled( bool enabled );
 | 
						|
%Docstring
 | 
						|
enables the snapping
 | 
						|
%End
 | 
						|
 | 
						|
        QgsSnappingConfig::SnappingType type() const;
 | 
						|
%Docstring
 | 
						|
return the type (vertices and/or segments)
 | 
						|
 :rtype: QgsSnappingConfig.SnappingType
 | 
						|
%End
 | 
						|
 | 
						|
        void setType( QgsSnappingConfig::SnappingType type );
 | 
						|
%Docstring
 | 
						|
define the type of snapping
 | 
						|
%End
 | 
						|
 | 
						|
        double tolerance() const;
 | 
						|
%Docstring
 | 
						|
return the tolerance
 | 
						|
 :rtype: float
 | 
						|
%End
 | 
						|
 | 
						|
        void setTolerance( double tolerance );
 | 
						|
%Docstring
 | 
						|
set the tolerance
 | 
						|
%End
 | 
						|
 | 
						|
        QgsTolerance::UnitType units() const;
 | 
						|
%Docstring
 | 
						|
return the type of units
 | 
						|
 :rtype: QgsTolerance.UnitType
 | 
						|
%End
 | 
						|
 | 
						|
        void setUnits( QgsTolerance::UnitType units );
 | 
						|
%Docstring
 | 
						|
set the type of units
 | 
						|
%End
 | 
						|
 | 
						|
        bool operator!= ( const QgsSnappingConfig::IndividualLayerSettings &other ) const;
 | 
						|
%Docstring
 | 
						|
 Compare this configuration to other.
 | 
						|
%End
 | 
						|
 | 
						|
        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
 | 
						|
return if snapping is enabled
 | 
						|
 :rtype: bool
 | 
						|
%End
 | 
						|
 | 
						|
    void setEnabled( bool enabled );
 | 
						|
%Docstring
 | 
						|
enables the snapping
 | 
						|
%End
 | 
						|
 | 
						|
    SnappingMode mode() const;
 | 
						|
%Docstring
 | 
						|
return the mode (all layers, active layer, per layer settings)
 | 
						|
 :rtype: SnappingMode
 | 
						|
%End
 | 
						|
 | 
						|
    void setMode( SnappingMode mode );
 | 
						|
%Docstring
 | 
						|
define the mode of snapping
 | 
						|
%End
 | 
						|
 | 
						|
    SnappingType type() const;
 | 
						|
%Docstring
 | 
						|
return the type (vertices and/or segments)
 | 
						|
 :rtype: SnappingType
 | 
						|
%End
 | 
						|
 | 
						|
    void setType( SnappingType type );
 | 
						|
%Docstring
 | 
						|
define the type of snapping
 | 
						|
%End
 | 
						|
 | 
						|
    double tolerance() const;
 | 
						|
%Docstring
 | 
						|
return the tolerance
 | 
						|
 :rtype: float
 | 
						|
%End
 | 
						|
 | 
						|
    void setTolerance( double tolerance );
 | 
						|
%Docstring
 | 
						|
set the tolerance
 | 
						|
%End
 | 
						|
 | 
						|
    QgsTolerance::UnitType units() const;
 | 
						|
%Docstring
 | 
						|
return the type of units
 | 
						|
 :rtype: QgsTolerance.UnitType
 | 
						|
%End
 | 
						|
 | 
						|
    void setUnits( QgsTolerance::UnitType units );
 | 
						|
%Docstring
 | 
						|
set the type of units
 | 
						|
%End
 | 
						|
 | 
						|
    bool intersectionSnapping() const;
 | 
						|
%Docstring
 | 
						|
return if the snapping on intersection is enabled
 | 
						|
 :rtype: bool
 | 
						|
%End
 | 
						|
 | 
						|
    void setIntersectionSnapping( bool enabled );
 | 
						|
%Docstring
 | 
						|
set if the snapping on intersection is enabled
 | 
						|
%End
 | 
						|
 | 
						|
    SIP_PYDICT individualLayerSettings() const;
 | 
						|
%Docstring
 | 
						|
return individual snapping settings for all layers
 | 
						|
 :rtype: SIP_PYDICT
 | 
						|
%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
 | 
						|
return individual layer snappings settings (applied if mode is AdvancedConfiguration)
 | 
						|
 :rtype: QgsSnappingConfig.IndividualLayerSettings
 | 
						|
%End
 | 
						|
 | 
						|
    void setIndividualLayerSettings( QgsVectorLayer *vl, const QgsSnappingConfig::IndividualLayerSettings &individualLayerSettings );
 | 
						|
%Docstring
 | 
						|
set individual layer snappings settings (applied if mode is AdvancedConfiguration)
 | 
						|
%End
 | 
						|
 | 
						|
    bool operator!= ( const QgsSnappingConfig &other ) const;
 | 
						|
%Docstring
 | 
						|
 Compare this configuration to other.
 | 
						|
%End
 | 
						|
 | 
						|
    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
 | 
						|
 :rtype: bool
 | 
						|
%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
 | 
						|
 :rtype: bool
 | 
						|
%End
 | 
						|
 | 
						|
    QgsProject *project() const;
 | 
						|
%Docstring
 | 
						|
 The project from which the snapped layers should be retrieved
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
 :rtype: QgsProject
 | 
						|
%End
 | 
						|
 | 
						|
    void setProject( QgsProject *project );
 | 
						|
%Docstring
 | 
						|
 The project from which the snapped layers should be retrieved
 | 
						|
 | 
						|
.. versionadded:: 3.0
 | 
						|
%End
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
/************************************************************************
 | 
						|
 * This file has been generated automatically from                      *
 | 
						|
 *                                                                      *
 | 
						|
 * src/core/qgssnappingconfig.h                                         *
 | 
						|
 *                                                                      *
 | 
						|
 * Do not edit manually ! Edit header and run scripts/sipify.pl again   *
 | 
						|
 ************************************************************************/
 |