Skip to content

Commit

Permalink
Merge pull request #9576 from m-kuhn/geometry_validation_invalid_feat…
Browse files Browse the repository at this point in the history
…ure_master

 Only change map extent when manually changing the active error
  • Loading branch information
m-kuhn authored Mar 21, 2019
2 parents 7cb1695 + 4f2a78b commit 0f20c13
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/qgsgeometryvalidationdock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void QgsGeometryValidationDock::setGeometryValidationModel( QgsGeometryValidatio
mErrorListView->setModel( mGeometryValidationModel );

connect( mErrorListView->selectionModel(), &QItemSelectionModel::currentChanged, this, &QgsGeometryValidationDock::onCurrentErrorChanged );
connect( mErrorListView->selectionModel(), &QItemSelectionModel::currentChanged, this, [this]() { updateMapCanvasExtent(); } );
connect( mGeometryValidationModel, &QgsGeometryValidationModel::dataChanged, this, &QgsGeometryValidationDock::onDataChanged );
connect( mGeometryValidationModel, &QgsGeometryValidationModel::rowsRemoved, this, &QgsGeometryValidationDock::updateCurrentError );
connect( mGeometryValidationModel, &QgsGeometryValidationModel::rowsInserted, this, &QgsGeometryValidationDock::onRowsInserted );
Expand Down Expand Up @@ -243,7 +244,10 @@ void QgsGeometryValidationDock::onCurrentErrorChanged( const QModelIndex &curren

bool hasFeature = !FID_IS_NULL( current.data( QgsGeometryValidationModel::ErrorFeatureIdRole ) );
mZoomToFeatureButton->setEnabled( hasFeature );
}

void QgsGeometryValidationDock::updateMapCanvasExtent()
{
if ( !mPreventZoomToError )
{
switch ( mLastZoomToAction )
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsgeometryvalidationdock.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
private slots:
void updateCurrentError();
void onCurrentErrorChanged( const QModelIndex &current, const QModelIndex &previous );
void updateMapCanvasExtent();
void onCurrentLayerChanged( QgsMapLayer *layer );
void onLayerEditingStatusChanged();
void onLayerDestroyed( QObject *layer );
Expand Down
6 changes: 6 additions & 0 deletions src/app/qgsgeometryvalidationmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,18 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )

case ErrorLocationGeometryRole:
{
if ( featureItem.errors.empty() )
return QVariant();

QgsSingleGeometryCheckError *error = featureItem.errors.first().get();
return error->errorLocation();
}

case ProblemExtentRole:
{
if ( featureItem.errors.empty() )
return QVariant();

QgsSingleGeometryCheckError *error = featureItem.errors.first().get();
return error->errorLocation().boundingBox();
}
Expand Down

0 comments on commit 0f20c13

Please sign in to comment.