2017-05-18 07:50:23 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgssnappingconfig.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-02-19 08:34:03 -04:00
|
|
|
|
2016-08-26 15:36:07 +02:00
|
|
|
class QgsSnappingConfig
|
|
|
|
{
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
This is a container for configuration of the snapping of the project
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2016-08-26 15:36:07 +02:00
|
|
|
%TypeHeaderCode
|
2017-05-18 07:50:23 +02:00
|
|
|
#include "qgssnappingconfig.h"
|
2016-08-26 15:36:07 +02:00
|
|
|
%End
|
2018-05-15 17:37:18 -04:00
|
|
|
public:
|
|
|
|
static const QMetaObject staticMetaObject;
|
|
|
|
|
2016-08-26 15:36:07 +02:00
|
|
|
public:
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2016-08-26 15:36:07 +02:00
|
|
|
enum SnappingMode
|
|
|
|
{
|
2017-05-18 07:50:23 +02:00
|
|
|
ActiveLayer,
|
|
|
|
AllLayers,
|
|
|
|
AdvancedConfiguration,
|
2016-08-26 15:36:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum SnappingType
|
|
|
|
{
|
2017-05-18 07:50:23 +02:00
|
|
|
Vertex,
|
|
|
|
VertexAndSegment,
|
|
|
|
Segment,
|
2016-08-26 15:36:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class IndividualLayerSettings
|
2017-05-18 07:50:23 +02:00
|
|
|
{
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
This is a container of advanced configuration (per layer) of the snapping of the project
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgssnappingconfig.h"
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
public:
|
2017-05-18 07:50:23 +02:00
|
|
|
|
2016-10-18 16:27:30 +02:00
|
|
|
IndividualLayerSettings( bool enabled, QgsSnappingConfig::SnappingType type, double tolerance, QgsTolerance::UnitType units );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-26 14:10:30 +10:00
|
|
|
IndividualLayerSettings
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param enabled:
|
|
|
|
:param type:
|
|
|
|
:param tolerance:
|
|
|
|
:param units:
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
IndividualLayerSettings();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructs an invalid setting
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
bool valid() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns if settings are valid
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
bool enabled() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns if snapping is enabled
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setEnabled( bool enabled );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
enables the snapping
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
QgsSnappingConfig::SnappingType type() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the type (vertices and/or segments)
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setType( QgsSnappingConfig::SnappingType type );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
define the type of snapping
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
double tolerance() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the tolerance
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setTolerance( double tolerance );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets the tolerance
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
QgsTolerance::UnitType units() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the type of units
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setUnits( QgsTolerance::UnitType units );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets the type of units
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
|
|
|
|
|
|
|
bool operator!= ( const QgsSnappingConfig::IndividualLayerSettings &other ) const;
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
bool operator== ( const QgsSnappingConfig::IndividualLayerSettings &other ) const;
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-05-02 07:21:20 +02:00
|
|
|
explicit QgsSnappingConfig( QgsProject *project = 0 );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor with default parameters defined in global settings
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
bool operator==( const QgsSnappingConfig &other ) const;
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void reset();
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
reset to default values
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
bool enabled() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns if snapping is enabled
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setEnabled( bool enabled );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
|
|
|
enables the snapping
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
SnappingMode mode() const;
|
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the mode (all layers, active layer, per layer settings)
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
void setMode( SnappingMode mode );
|
|
|
|
%Docstring
|
|
|
|
define the mode of snapping
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
SnappingType type() const;
|
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the type (vertices and/or segments)
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
void setType( SnappingType type );
|
|
|
|
%Docstring
|
|
|
|
define the type of snapping
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
double tolerance() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the tolerance
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setTolerance( double tolerance );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets the tolerance
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
QgsTolerance::UnitType units() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns the type of units
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setUnits( QgsTolerance::UnitType units );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets the type of units
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
bool intersectionSnapping() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns if the snapping on intersection is enabled
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
void setIntersectionSnapping( bool enabled );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets if the snapping on intersection is enabled
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
SIP_PYDICT individualLayerSettings() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns individual snapping settings for all layers
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
%MethodCode
|
|
|
|
// Create the dictionary.
|
2017-05-01 16:42:33 +02:00
|
|
|
PyObject *d = PyDict_New();
|
2017-05-18 07:50:23 +02:00
|
|
|
if ( !d )
|
2017-06-12 09:00:04 +02:00
|
|
|
return nullptr;
|
2016-08-26 15:36:07 +02:00
|
|
|
// Set the dictionary elements.
|
2017-05-18 07:50:23 +02:00
|
|
|
QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings> container = sipCpp->individualLayerSettings();
|
|
|
|
QHash<QgsVectorLayer *, QgsSnappingConfig::IndividualLayerSettings>::const_iterator i = container.constBegin();
|
2016-08-26 15:36:07 +02:00
|
|
|
while ( i != container.constEnd() )
|
|
|
|
{
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsVectorLayer *vl = i.key();
|
|
|
|
QgsSnappingConfig::IndividualLayerSettings *ils = new QgsSnappingConfig::IndividualLayerSettings( i.value() );
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-06-12 09:00:04 +02:00
|
|
|
PyObject *vlobj = sipConvertFromType( vl, sipType_QgsVectorLayer, nullptr );
|
2017-05-01 16:42:33 +02:00
|
|
|
PyObject *ilsobj = sipConvertFromType( ils, sipType_QgsSnappingConfig_IndividualLayerSettings, Py_None );
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
if ( !vlobj || !ilsobj || PyDict_SetItem( d, vlobj, ilsobj ) < 0 )
|
2016-08-26 15:36:07 +02:00
|
|
|
{
|
2017-05-18 07:50:23 +02:00
|
|
|
Py_DECREF( d );
|
|
|
|
if ( vlobj )
|
|
|
|
{
|
|
|
|
Py_DECREF( vlobj );
|
|
|
|
}
|
|
|
|
if ( ilsobj )
|
|
|
|
{
|
|
|
|
Py_DECREF( ilsobj );
|
|
|
|
}
|
2016-08-26 15:36:07 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
delete ils;
|
|
|
|
}
|
2017-05-18 07:50:23 +02:00
|
|
|
PyErr_SetString( PyExc_StopIteration, "" );
|
2016-08-26 15:36:07 +02:00
|
|
|
}
|
|
|
|
Py_DECREF( vlobj );
|
|
|
|
Py_DECREF( ilsobj );
|
|
|
|
++i;
|
|
|
|
}
|
|
|
|
sipRes = d;
|
|
|
|
%End
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsSnappingConfig::IndividualLayerSettings individualLayerSettings( QgsVectorLayer *vl ) const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Returns individual layer snappings settings (applied if mode is AdvancedConfiguration)
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setIndividualLayerSettings( QgsVectorLayer *vl, const QgsSnappingConfig::IndividualLayerSettings &individualLayerSettings );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2018-05-25 13:54:27 +10:00
|
|
|
Sets individual layer snappings settings (applied if mode is AdvancedConfiguration)
|
2017-05-18 07:50:23 +02:00
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool operator!= ( const QgsSnappingConfig &other ) const;
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void readProject( const QDomDocument &doc );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Reads the configuration from the specified QGIS project document.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void writeProject( QDomDocument &doc );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Writes the configuration to the specified QGIS project document.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
bool addLayers( const QList<QgsMapLayer *> &layers );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
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.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
|
|
|
|
|
|
|
bool removeLayers( const QList<QgsMapLayer *> &layers );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
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.
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsProject *project() const;
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
The project from which the snapped layers should be retrieved
|
|
|
|
|
2017-05-18 07:50:23 +02:00
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setProject( QgsProject *project );
|
2017-05-18 07:50:23 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
The project from which the snapped layers should be retrieved
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
2016-08-26 15:36:07 +02:00
|
|
|
|
|
|
|
};
|
2017-05-18 07:50:23 +02:00
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/core/qgssnappingconfig.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|