diff --git a/src/analysis/vector/geometry_checker/qgsgeometryholecheck.cpp b/src/analysis/vector/geometry_checker/qgsgeometryholecheck.cpp index 466b27fff44..4b7338fd173 100644 --- a/src/analysis/vector/geometry_checker/qgsgeometryholecheck.cpp +++ b/src/analysis/vector/geometry_checker/qgsgeometryholecheck.cpp @@ -14,6 +14,8 @@ ***************************************************************************/ #include "qgsgeometryholecheck.h" +#include "qgscurve.h" +#include "qgscurvepolygon.h" #include "qgsfeaturepool.h" void QgsGeometryHoleCheck::collectErrors( QList &errors, QStringList &/*messages*/, QAtomicInt *progressCounter, const QMap &ids ) const @@ -25,10 +27,16 @@ void QgsGeometryHoleCheck::collectErrors( QList &errors const QgsAbstractGeometry *geom = layerFeature.geometry(); for ( int iPart = 0, nParts = geom->partCount(); iPart < nParts; ++iPart ) { - // Rings after the first one are interiors - for ( int iRing = 1, nRings = geom->ringCount( iPart ); iRing < nRings; ++iRing ) + const QgsCurvePolygon *poly = dynamic_cast( QgsGeometryCheckerUtils::getGeomPart( geom, iPart ) ); + if ( !poly ) { - QgsPoint pos = QgsGeometryCheckerUtils::getGeomPart( geom, iPart )->centroid(); + continue; + } + // Rings after the first one are interiors + for ( int iRing = 1, nRings = poly->ringCount( iPart ); iRing < nRings; ++iRing ) + { + + QgsPoint pos = poly->interiorRing( iRing - 1 )->centroid(); errors.append( new QgsGeometryCheckError( this, layerFeature, pos, QgsVertexId( iPart, iRing ) ) ); } }