Skip to content
Permalink
Browse files

[Geometry checker] Use centroid of actual hole to report error in Qgs…

…GeometryHoleCheck
  • Loading branch information
manisandro committed Oct 17, 2017
1 parent edf563b commit 737d5135cc774422c1bd11ab89b89382096cc1b4
Showing with 10 additions and 2 deletions.
  1. +10 −2 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<QgsGeometryCheckError *> &errors, QStringList &/*messages*/, QAtomicInt *progressCounter, const QMap<QString, QgsFeatureIds> &ids ) const
@@ -25,10 +27,16 @@ void QgsGeometryHoleCheck::collectErrors( QList<QgsGeometryCheckError *> &errors
const QgsAbstractGeometry *geom = layerFeature.geometry();
for ( int iPart = 0, nParts = geom->partCount(); iPart < nParts; ++iPart )
{
const QgsCurvePolygon *poly = dynamic_cast<const QgsCurvePolygon *>( QgsGeometryCheckerUtils::getGeomPart( geom, iPart ) );
if ( !poly )
{
continue;
}
// Rings after the first one are interiors
for ( int iRing = 1, nRings = geom->ringCount( iPart ); iRing < nRings; ++iRing )
for ( int iRing = 1, nRings = poly->ringCount( iPart ); iRing < nRings; ++iRing )
{
QgsPoint pos = QgsGeometryCheckerUtils::getGeomPart( geom, iPart )->centroid();

QgsPoint pos = poly->interiorRing( iRing - 1 )->centroid();
errors.append( new QgsGeometryCheckError( this, layerFeature, pos, QgsVertexId( iPart, iRing ) ) );
}
}

0 comments on commit 737d513

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