Skip to content

Commit

Permalink
Send signals when geometry options change
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Oct 15, 2018
1 parent 859ac16 commit f82970d
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 3 deletions.
35 changes: 34 additions & 1 deletion python/core/auto_generated/qgsgeometryoptions.sip.in
Expand Up @@ -9,7 +9,8 @@



class QgsGeometryOptions

class QgsGeometryOptions : QObject
{
%Docstring

Expand Down Expand Up @@ -114,6 +115,38 @@ Write the geometry options to the ``node``.
%Docstring
Read the geometry options from ``node``.

.. versionadded:: 3.4
%End

signals:

void checkConfigurationChanged();
%Docstring
Access the configuration for the check ``checkId``.

.. versionadded:: 3.4
%End

void geometryChecksChanged();
%Docstring
A list of activated geometry checks.

.. versionadded:: 3.4
%End

void removeDuplicateNodesChanged();
%Docstring
Automatically remove duplicate nodes on all geometries which are edited on this layer.

.. versionadded:: 3.4
%End

void geometryPrecisionChanged();
%Docstring
The precision in which geometries on this layer should be saved.
Geometries which are edited on this layer will be rounded to multiples of this value (snap to grid).
Set to 0.0 to disable.

.. versionadded:: 3.4
%End

Expand Down
2 changes: 1 addition & 1 deletion src/core/CMakeLists.txt
Expand Up @@ -606,6 +606,7 @@ SET(QGIS_CORE_MOC_HDRS
qgsfiledownloader.h
qgsfeaturefiltermodel.h
qgsfeaturefiltermodel_p.h
qgsgeometryoptions.h
qgsgeometryvalidator.h
qgsgml.h
qgsgmlschema.h
Expand Down Expand Up @@ -869,7 +870,6 @@ SET(QGIS_CORE_HDRS
qgsfields.h
qgsfileutils.h
qgsfontutils.h
qgsgeometryoptions.h
qgsgeometrysimplifier.h
qgshistogram.h
qgshstoreutils.h
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsgeometryoptions.cpp
Expand Up @@ -27,6 +27,7 @@ bool QgsGeometryOptions::removeDuplicateNodes() const
void QgsGeometryOptions::setRemoveDuplicateNodes( bool value )
{
mRemoveDuplicateNodes = value;
emit removeDuplicateNodesChanged();
}

double QgsGeometryOptions::geometryPrecision() const
Expand All @@ -37,6 +38,7 @@ double QgsGeometryOptions::geometryPrecision() const
void QgsGeometryOptions::setGeometryPrecision( double value )
{
mGeometryPrecision = value;
emit geometryPrecisionChanged();
}

bool QgsGeometryOptions::isActive() const
Expand All @@ -61,6 +63,7 @@ QStringList QgsGeometryOptions::geometryChecks() const
void QgsGeometryOptions::setGeometryChecks( const QStringList &geometryChecks )
{
mGeometryChecks = geometryChecks;
emit geometryChecksChanged();
}

QVariantMap QgsGeometryOptions::checkConfiguration( const QString &checkId ) const
Expand All @@ -71,6 +74,7 @@ QVariantMap QgsGeometryOptions::checkConfiguration( const QString &checkId ) con
void QgsGeometryOptions::setCheckConfiguration( const QString &checkId, const QVariantMap &checkConfiguration )
{
mCheckConfiguration[checkId] = checkConfiguration;
emit checkConfigurationChanged();
}

void QgsGeometryOptions::writeXml( QDomNode &node ) const
Expand Down
38 changes: 37 additions & 1 deletion src/core/qgsgeometryoptions.h
Expand Up @@ -22,6 +22,8 @@
#include "qgis_sip.h"
#include "qgsgeometry.h"

#include <QObject>

/**
* \ingroup core
*
Expand All @@ -30,8 +32,10 @@
*
* \since QGIS 3.4
*/
class CORE_EXPORT QgsGeometryOptions
class CORE_EXPORT QgsGeometryOptions : public QObject
{
Q_OBJECT

public:

/**
Expand Down Expand Up @@ -127,6 +131,38 @@ class CORE_EXPORT QgsGeometryOptions
*/
void readXml( const QDomNode &node );

signals:

/**
* Access the configuration for the check \a checkId.
*
* \since QGIS 3.4
*/
void checkConfigurationChanged();

/**
* A list of activated geometry checks.
*
* \since QGIS 3.4
*/
void geometryChecksChanged();

/**
* Automatically remove duplicate nodes on all geometries which are edited on this layer.
*
* \since QGIS 3.4
*/
void removeDuplicateNodesChanged();

/**
* The precision in which geometries on this layer should be saved.
* Geometries which are edited on this layer will be rounded to multiples of this value (snap to grid).
* Set to 0.0 to disable.
*
* \since QGIS 3.4
*/
void geometryPrecisionChanged();

private:

/**
Expand Down

0 comments on commit f82970d

Please sign in to comment.