Skip to content

Commit 737d513

Browse files
committed
[Geometry checker] Use centroid of actual hole to report error in QgsGeometryHoleCheck
1 parent edf563b commit 737d513

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/analysis/vector/geometry_checker/qgsgeometryholecheck.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
***************************************************************************/
1515

1616
#include "qgsgeometryholecheck.h"
17+
#include "qgscurve.h"
18+
#include "qgscurvepolygon.h"
1719
#include "qgsfeaturepool.h"
1820

1921
void QgsGeometryHoleCheck::collectErrors( QList<QgsGeometryCheckError *> &errors, QStringList &/*messages*/, QAtomicInt *progressCounter, const QMap<QString, QgsFeatureIds> &ids ) const
@@ -25,10 +27,16 @@ void QgsGeometryHoleCheck::collectErrors( QList<QgsGeometryCheckError *> &errors
2527
const QgsAbstractGeometry *geom = layerFeature.geometry();
2628
for ( int iPart = 0, nParts = geom->partCount(); iPart < nParts; ++iPart )
2729
{
30+
const QgsCurvePolygon *poly = dynamic_cast<const QgsCurvePolygon *>( QgsGeometryCheckerUtils::getGeomPart( geom, iPart ) );
31+
if ( !poly )
32+
{
33+
continue;
34+
}
2835
// Rings after the first one are interiors
29-
for ( int iRing = 1, nRings = geom->ringCount( iPart ); iRing < nRings; ++iRing )
36+
for ( int iRing = 1, nRings = poly->ringCount( iPart ); iRing < nRings; ++iRing )
3037
{
31-
QgsPoint pos = QgsGeometryCheckerUtils::getGeomPart( geom, iPart )->centroid();
38+
39+
QgsPoint pos = poly->interiorRing( iRing - 1 )->centroid();
3240
errors.append( new QgsGeometryCheckError( this, layerFeature, pos, QgsVertexId( iPart, iRing ) ) );
3341
}
3442
}

0 commit comments

Comments
 (0)