[Geometry checker] Ensure overlap check returns on error for each overlap part

This commit is contained in:
Sandro Mani 2017-09-28 15:07:27 +02:00
parent 87cdeda439
commit 58e39f6a06
2 changed files with 7 additions and 7 deletions

View File

@ -54,10 +54,11 @@ void QgsGeometryOverlapCheck::collectErrors( QList<QgsGeometryCheckError *> &err
QgsGeometryCheckerUtils::filter1DTypes( interGeom );
for ( int iPart = 0, nParts = interGeom->partCount(); iPart < nParts; ++iPart )
{
double area = QgsGeometryCheckerUtils::getGeomPart( interGeom, iPart )->area();
QgsAbstractGeometry *interPart = QgsGeometryCheckerUtils::getGeomPart( interGeom, iPart );
double area = interPart->area();
if ( area > mContext->reducedTolerance && area < overlapThreshold )
{
errors.append( new QgsGeometryOverlapCheckError( this, layerFeatureA.layer().id(), layerFeatureA.feature().id(), interGeom->clone(), QgsGeometryCheckerUtils::getGeomPart( interGeom, iPart )->centroid(), area, qMakePair( layerFeatureB.layer().id(), layerFeatureB.feature().id() ) ) );
errors.append( new QgsGeometryOverlapCheckError( this, layerFeatureA, interPart->clone(), interPart->centroid(), area, layerFeatureB ) );
}
}
}

View File

@ -22,14 +22,13 @@ class ANALYSIS_EXPORT QgsGeometryOverlapCheckError : public QgsGeometryCheckErro
{
public:
QgsGeometryOverlapCheckError( const QgsGeometryCheck *check,
const QString &layerId,
QgsFeatureId featureId,
const QgsGeometryCheckerUtils::LayerFeature &layerFeature,
QgsAbstractGeometry *geometry,
const QgsPointXY &errorLocation,
const QVariant &value,
const QPair<QString, QgsFeatureId> &overlappedFeature )
: QgsGeometryCheckError( check, layerId, featureId, geometry, errorLocation, QgsVertexId(), value, ValueArea )
, mOverlappedFeature( overlappedFeature )
const QgsGeometryCheckerUtils::LayerFeature &overlappedFeature )
: QgsGeometryCheckError( check, layerFeature.layer().id(), layerFeature.feature().id(), geometry, errorLocation, QgsVertexId(), value, ValueArea )
, mOverlappedFeature( qMakePair( overlappedFeature.layer().id(), overlappedFeature.feature().id() ) )
{ }
const QPair<QString, QgsFeatureId> &overlappedFeature() const { return mOverlappedFeature; }