mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
enable zoom button only if error has feature
This commit is contained in:
parent
29febc0c1f
commit
e77bab9d2c
@ -178,6 +178,9 @@ void QgsGeometryValidationDock::onCurrentErrorChanged( const QModelIndex ¤
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user