Skip to content
Permalink
Browse files

Handle error fixing on frontend size

  • Loading branch information
m-kuhn committed Oct 2, 2018
1 parent a56062c commit 5b5ec8f59f125256c707858c54110297a15fc27e
@@ -83,6 +83,7 @@ void QgsGeometryValidationDock::setGeometryValidationModel( QgsGeometryValidatio
mErrorListView->setModel( mGeometryValidationModel );

connect( mErrorListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsGeometryValidationDock::onCurrentErrorChanged );
connect( mGeometryValidationModel, &QgsGeometryValidationModel::rowsRemoved, this, &QgsGeometryValidationDock::updateCurrentError );
}

void QgsGeometryValidationDock::gotoNextError()
@@ -147,6 +148,15 @@ void QgsGeometryValidationDock::setGeometryValidationService( QgsGeometryValidat
mGeometryValidationService = geometryValidationService;
}

void QgsGeometryValidationDock::updateCurrentError()
{
mFeatureRubberband->hide();
mErrorRubberband->hide();
mErrorLocationRubberband->hide();

onCurrentErrorChanged( currentIndex(), QModelIndex() );
}

QModelIndex QgsGeometryValidationDock::currentIndex() const
{
return mErrorListView->selectionModel()->currentIndex();
@@ -42,6 +42,7 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
void setGeometryValidationService( QgsGeometryValidationService *geometryValidationService );

private slots:
void updateCurrentError();
void onCurrentErrorChanged( const QModelIndex &current, const QModelIndex &previous );
void onCurrentLayerChanged( QgsMapLayer *layer );
void gotoNextError();
@@ -14,6 +14,7 @@ QgsGeometryValidationModel::QgsGeometryValidationModel( QgsGeometryValidationSer
connect( mGeometryValidationService, &QgsGeometryValidationService::geometryCheckStarted, this, &QgsGeometryValidationModel::onGeometryCheckStarted );
connect( mGeometryValidationService, &QgsGeometryValidationService::topologyChecksUpdated, this, &QgsGeometryValidationModel::onTopologyChecksUpdated );
connect( mGeometryValidationService, &QgsGeometryValidationService::topologyChecksCleared, this, &QgsGeometryValidationModel::onTopologyChecksCleared );
connect( mGeometryValidationService, &QgsGeometryValidationService::topologyErrorUpdated, this, &QgsGeometryValidationModel::onTopologyErrorUpdated );
}

QModelIndex QgsGeometryValidationModel::index( int row, int column, const QModelIndex &parent ) const
@@ -76,7 +77,6 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )
{
return tr( "%1: %2" ).arg( featureTitle.toString(), topologyError->description() );
}

}

case FeatureExtentRole:
@@ -328,6 +328,23 @@ void QgsGeometryValidationModel::onTopologyChecksCleared( QgsVectorLayer *layer
}
}

void QgsGeometryValidationModel::onTopologyErrorUpdated( QgsVectorLayer *layer, QgsGeometryCheckError *error )
{
if ( layer == mCurrentLayer )
{
int i = 0;
for ( const auto &currentError : qgis::as_const( mTopologyErrorStorage[layer] ) )
{
if ( currentError.get() == error )
{
QModelIndex idx = index( i, 0, QModelIndex() );
emit dataChanged( idx, idx );
}
++i;
}
}
}

int QgsGeometryValidationModel::errorsForFeature( QgsVectorLayer *layer, QgsFeatureId fid )
{
const auto &layerErrors = mErrorStorage[layer];
@@ -43,6 +43,7 @@ class QgsGeometryValidationModel : public QAbstractItemModel
void onGeometryCheckStarted( QgsVectorLayer *layer, QgsFeatureId fid );
void onTopologyChecksUpdated( QgsVectorLayer *layer, const QList<std::shared_ptr<QgsGeometryCheckError> > &errors );
void onTopologyChecksCleared( QgsVectorLayer *layer );
void onTopologyErrorUpdated( QgsVectorLayer *layer, QgsGeometryCheckError *error );

private:
struct FeatureErrors

0 comments on commit 5b5ec8f

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