Skip to content
Permalink
Browse files

do not zoom to feature if no extent

  • Loading branch information
3nids authored and m-kuhn committed Oct 1, 2018
1 parent 579c97e commit d4ac9a7c009a4dcf98cc2a49a581ad1468103e5e
@@ -10,7 +10,6 @@




class QgsGeometryCheck
{
%Docstring
@@ -31,8 +31,6 @@
class QgsGeometryCheckError;
class QgsFeaturePool;

#define FEATUREID_NULL std::numeric_limits<QgsFeatureId>::min()

class ANALYSIS_EXPORT QgsGeometryCheck
{
Q_GADGET
@@ -20,6 +20,7 @@

#include "qgsgeometrycheck.h"
#include "qgsgeometrycheckerror.h"
#include "qgsfeatureid.h"

class ANALYSIS_EXPORT QgsGeometryGapCheckError : public QgsGeometryCheckError
{
@@ -30,7 +31,7 @@ class ANALYSIS_EXPORT QgsGeometryGapCheckError : public QgsGeometryCheckError
const QMap<QString, QgsFeatureIds> &neighbors,
double area,
const QgsRectangle &gapAreaBBox )
: QgsGeometryCheckError( check, layerId, FEATUREID_NULL, geometry, geometry.constGet()->centroid(), QgsVertexId(), area, ValueArea )
: QgsGeometryCheckError( check, layerId, FID_NULL, geometry, geometry.constGet()->centroid(), QgsVertexId(), area, ValueArea )
, mNeighbors( neighbors )
, mGapAreaBBox( gapAreaBBox )
{
@@ -110,8 +110,11 @@ void QgsGeometryValidationDock::zoomToFeature()
return;

QgsRectangle featureExtent = currentIndex().data( QgsGeometryValidationModel::FeatureExtentRole ).value<QgsRectangle>();
QgsRectangle mapExtent = mLayerTransform.transform( featureExtent );
mMapCanvas->zoomToFeatureExtent( mapExtent );
if ( !featureExtent.isEmpty() )
{
QgsRectangle mapExtent = mLayerTransform.transform( featureExtent );
mMapCanvas->zoomToFeatureExtent( mapExtent );
}
}

void QgsGeometryValidationDock::triggerTopologyChecks()
@@ -74,6 +74,8 @@ QVariant QgsGeometryValidationModel::data( const QModelIndex &index, int role )
case FeatureExtentRole:
{
const QgsFeatureId fid = topologyError->featureId();
if ( FID_IS_NULL( fid ) )
return QgsRectangle();
const QgsFeature feature = mCurrentLayer->getFeature( fid ); // TODO: this should be cached!
return feature.geometry().boundingBox();
}
@@ -81,7 +81,7 @@ void QgsGeometryCheckerFixSummaryDialog::addError( QTableWidget *table, QgsGeome
table->insertRow( row );
table->setItem( row, 0, new QTableWidgetItem( !error->layerId().isEmpty() ? mChecker->featurePools()[error->layerId()]->layer()->name() : "" ) );
QTableWidgetItem *idItem = new QTableWidgetItem();
idItem->setData( Qt::EditRole, error->featureId() != FEATUREID_NULL ? QVariant( error->featureId() ) : QVariant() );
idItem->setData( Qt::EditRole, error->featureId() != FID_NULL ? QVariant( error->featureId() ) : QVariant() );
table->setItem( row, 1, idItem );
table->setItem( row, 2, new QTableWidgetItem( error->description() ) );
table->setItem( row, 3, new QTableWidgetItem( posStr ) );
@@ -151,7 +151,7 @@ void QgsGeometryCheckerResultTab::addError( QgsGeometryCheckError *error )

ui.tableWidgetErrors->insertRow( row );
QTableWidgetItem *idItem = new QTableWidgetItem();
idItem->setData( Qt::EditRole, error->featureId() != FEATUREID_NULL ? QVariant( error->featureId() ) : QVariant() );
idItem->setData( Qt::EditRole, error->featureId() != FID_NULL ? QVariant( error->featureId() ) : QVariant() );
ui.tableWidgetErrors->setItem( row, 0, new QTableWidgetItem( !error->layerId().isEmpty() ? mChecker->featurePools()[error->layerId()]->layer()->name() : "" ) );
ui.tableWidgetErrors->setItem( row, 1, idItem );
ui.tableWidgetErrors->setItem( row, 2, new QTableWidgetItem( error->description() ) );

0 comments on commit d4ac9a7

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