Skip to content
Permalink
Browse files

enable zoom button only if error has feature

  • Loading branch information
3nids authored and m-kuhn committed Oct 1, 2018
1 parent 29febc0 commit e77bab9d2c8fbb929b994a6e1692c22eb629beec
@@ -178,6 +178,9 @@ void QgsGeometryValidationDock::onCurrentErrorChanged( const QModelIndex &curren
}
}

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

showHighlight( current );

switch ( mLastZoomToAction )
@@ -91,11 +91,20 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )
return topologyError->geometry();
}

case ErrorFeatureIdRole:
{
return topologyError->featureId();
}

case FeatureGeometryRole:
{
const QgsFeatureId fid = topologyError->featureId();
const QgsFeature feature = mCurrentLayer->getFeature( fid ); // TODO: this should be cached!
return feature.geometry();
if ( !FID_IS_NULL( fid ) )
{
const QgsFeature feature = mCurrentLayer->getFeature( fid ); // TODO: this should be cached!
return feature.geometry();
}
return QgsGeometry();
}

case ErrorLocationGeometryRole:
@@ -149,6 +158,11 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )
break;
}

case ErrorFeatureIdRole:
{
return featureItem.fid;
}

case FeatureExtentRole:
{
return mCurrentLayer->getFeature( featureItem.fid ).geometry().boundingBox();
@@ -18,6 +18,7 @@ class QgsGeometryValidationModel : public QAbstractItemModel
FeatureExtentRole = Qt::UserRole,
ProblemExtentRole,
ErrorGeometryRole,
ErrorFeatureIdRole,
FeatureGeometryRole,
ErrorLocationGeometryRole,
GeometryCheckErrorRole,

0 comments on commit e77bab9

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