Skip to content
Permalink
Browse files

Disable message bar feedback from geometryvalidator

  • Loading branch information
m-kuhn committed Oct 1, 2018
1 parent 91cd1ed commit ed274428c2c0cc1ec97112cc1244aaaef818c2f6
Showing with 2 additions and 22 deletions.
  1. +1 −18 src/gui/qgsmaptoolcapture.cpp
  2. +1 −4 src/gui/qgsmaptoolcapture.h
@@ -81,16 +81,6 @@ void QgsMapToolCapture::deactivate()
QgsMapToolAdvancedDigitizing::deactivate();
}

void QgsMapToolCapture::validationFinished()
{
emit messageDiscarded();
QString msgFinished = tr( "Validation finished" );
if ( !mValidationWarnings.isEmpty() )
{
emit messageEmitted( mValidationWarnings.join( QStringLiteral( "\n" ) ).append( "\n" ).append( msgFinished ), Qgis::Warning );
}
}

void QgsMapToolCapture::currentLayerChanged( QgsMapLayer *layer )
{
if ( !mCaptureModeFromLayer )
@@ -688,7 +678,6 @@ void QgsMapToolCapture::validateGeometry()
mValidator = nullptr;
}

mValidationWarnings.clear();
mGeomErrors.clear();
while ( !mGeomErrorMarkers.isEmpty() )
{
@@ -726,20 +715,17 @@ void QgsMapToolCapture::validateGeometry()
method = QgsGeometry::ValidatorGeos;
mValidator = new QgsGeometryValidator( geom, nullptr, method );
connect( mValidator, &QgsGeometryValidator::errorFound, this, &QgsMapToolCapture::addError );
connect( mValidator, &QThread::finished, this, &QgsMapToolCapture::validationFinished );
mValidator->start();
QgsDebugMsgLevel( "Validation started", 4 );
}

void QgsMapToolCapture::addError( QgsGeometry::Error e )
void QgsMapToolCapture::addError( const QgsGeometry::Error &e )
{
mGeomErrors << e;
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() );
if ( !vlayer )
return;

mValidationWarnings << e.what();

if ( e.hasWhere() )
{
QgsVertexMarker *vm = new QgsVertexMarker( mCanvas );
@@ -751,9 +737,6 @@ void QgsMapToolCapture::addError( QgsGeometry::Error e )
vm->setZValue( vm->zValue() + 1 );
mGeomErrorMarkers << vm;
}

emit messageDiscarded();
emit messageEmitted( mValidationWarnings.join( QStringLiteral( "\n" ) ), Qgis::Warning );
}

int QgsMapToolCapture::size()
@@ -107,11 +107,9 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
void clean() override;

private slots:
void validationFinished();
void addError( QgsGeometry::Error );
void addError( const QgsGeometry::Error &error );
void currentLayerChanged( QgsMapLayer *layer );


protected:

/**
@@ -264,7 +262,6 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
QList<QgsPointLocator::Match> mSnappingMatches;

void validateGeometry();
QStringList mValidationWarnings;
QgsGeometryValidator *mValidator = nullptr;
QList< QgsGeometry::Error > mGeomErrors;
QList< QgsVertexMarker * > mGeomErrorMarkers;

0 comments on commit ed27442

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