Fixes #52903 : Fix topology checker results display with geometry collection

This commit is contained in:
Julien Cabieces 2023-06-14 18:41:34 +02:00 committed by Nyall Dawson
parent b6a9119c76
commit e5db747409

View File

@ -376,22 +376,20 @@ void checkDock::runTests( ValidateType type )
for ( it = errors.begin(); it != errors.end(); ++it ) for ( it = errors.begin(); it != errors.end(); ++it )
{ {
TopolError *te = *it; TopolError *te = *it;
te->conflict();
const QgsSettings settings; const QgsSettings settings;
if ( te->conflict().type() == Qgis::GeometryType::Polygon ) const QgsGeometry geom = te->conflict();
QVector<QgsGeometry> geoms = ( geom.wkbType() == Qgis::WkbType::GeometryCollection ?
geom.asGeometryCollection() : QVector<QgsGeometry>() << geom );
for ( const QgsGeometry &g : std::as_const( geoms ) )
{ {
rb = new QgsRubberBand( qgsInterface->mapCanvas(), Qgis::GeometryType::Polygon ); rb = new QgsRubberBand( qgsInterface->mapCanvas(), g.type() );
rb->setColor( "red" );
rb->setWidth( 4 );
rb->setToGeometry( g, layer1 );
rb->show();
mRbErrorMarkers << rb;
} }
else
{
rb = new QgsRubberBand( qgsInterface->mapCanvas(), te->conflict().type() );
}
rb->setColor( "red" );
rb->setWidth( 4 );
rb->setToGeometry( te->conflict(), layer1 );
rb->show();
mRbErrorMarkers << rb;
} }
mErrorList << errors; mErrorList << errors;
} }