Skip to content
Permalink
Browse files

Geometry validator: do not report result summary as error

(cherry picked from commit 968e08c)
  • Loading branch information
m-kuhn authored and nyalldawson committed Feb 20, 2019
1 parent 7cedb14 commit 483cf16c92a1e595fbd2508793da5d2cdd484f6d
@@ -28,11 +28,29 @@ Constructor for QgsGeometryValidator.

static void validateGeometry( const QgsGeometry &geometry, QVector<QgsGeometry::Error> &errors /Out/, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal );
%Docstring
Validate geometry and produce a list of geometry errors
Validate geometry and produce a list of geometry errors.
This method blocks the thread until the validation is finished.
%End

signals:
void errorFound( const QgsGeometry::Error & );

void errorFound( const QgsGeometry::Error &error );
%Docstring
Sent when an error has been found during the validation process.

The ``error`` contains details about the error.
%End

void validationFinished( const QString &summary );
%Docstring
Sent when the validation is finished.

The result is in a human readable ``summary``, mentioning
if the validation has been aborted, successfully been validated
or how many errors have been found.

.. versionadded:: 3.6
%End

public slots:
void addError( const QgsGeometry::Error & );
@@ -316,18 +316,16 @@ void QgsGeometryValidator::run()

if ( mStop )
{
emit errorFound( QgsGeometry::Error( QObject::tr( "Geometry validation was aborted." ) ) );
emit validationFinished( QObject::tr( "Geometry validation was aborted." ) );
}
else if ( mErrorCount > 0 )
{
emit errorFound( QgsGeometry::Error( QObject::tr( "Geometry has %1 errors." ).arg( mErrorCount ) ) );
emit validationFinished( QObject::tr( "Geometry has %1 errors." ).arg( mErrorCount ) );
}
#if 0
else
{
emit errorFound( QgsGeometry::Error( QObject::tr( "Geometry is valid." ) ) );
emit validationFinished( QObject::tr( "Geometry is valid." ) );
}
#endif
break;
}
}
@@ -40,11 +40,31 @@ class CORE_EXPORT QgsGeometryValidator : public QThread
void run() override;
void stop();

//! Validate geometry and produce a list of geometry errors
/**
* Validate geometry and produce a list of geometry errors.
* This method blocks the thread until the validation is finished.
*/
static void validateGeometry( const QgsGeometry &geometry, QVector<QgsGeometry::Error> &errors SIP_OUT, QgsGeometry::ValidationMethod method = QgsGeometry::ValidatorQgisInternal );

signals:
void errorFound( const QgsGeometry::Error & );

/**
* Sent when an error has been found during the validation process.
*
* The \a error contains details about the error.
*/
void errorFound( const QgsGeometry::Error &error );

/**
* Sent when the validation is finished.
*
* The result is in a human readable \a summary, mentioning
* if the validation has been aborted, successfully been validated
* or how many errors have been found.
*
* \since QGIS 3.6
*/
void validationFinished( const QString &summary );

public slots:
void addError( const QgsGeometry::Error & );

0 comments on commit 483cf16

Please sign in to comment.
You can’t perform that action at this time.