Skip to content

Commit

Permalink
Fix crash and missing closest vertex in WMS identify
Browse files Browse the repository at this point in the history
... in "feature" mode.

Fixes #29443
  • Loading branch information
elpaso authored and nyalldawson committed Jun 15, 2020
1 parent d8b3ada commit 3ef7d89
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/gui/qgsmaptoolidentify.cpp
Expand Up @@ -578,6 +578,13 @@ bool QgsMapToolIdentify::identifyVectorLayer( QList<QgsMapToolIdentify::Identify

void QgsMapToolIdentify::closestVertexAttributes( const QgsAbstractGeometry &geometry, QgsVertexId vId, QgsMapLayer *layer, QMap< QString, QString > &derivedAttributes )
{
if ( ! vId.isValid( ) )
{
// We should not get here ...
QgsDebugMsg( "Invalid vertex id!" );
return;
}

QString str = QLocale().toString( vId.vertex + 1 );
derivedAttributes.insert( tr( "Closest vertex number" ), str );

Expand Down Expand Up @@ -673,6 +680,8 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( const Qgs
closestPoint = QgsGeometryUtils::closestVertex( *feature.geometry().constGet(), QgsPoint( layerPoint ), vId );
}



if ( QgsWkbTypes::isMultiType( wkbType ) )
{
QString str = QLocale().toString( static_cast<const QgsGeometryCollection *>( feature.geometry().constGet() )->numGeometries() );
Expand Down Expand Up @@ -982,7 +991,7 @@ bool QgsMapToolIdentify::identifyRasterLayer( QList<IdentifyResult> *results, Qg
}

QMap< QString, QString > derAttributes = derivedAttributes;
derAttributes.unite( featureDerivedAttributes( feature, layer ) );
derAttributes.unite( featureDerivedAttributes( feature, layer, toLayerCoordinates( layer, point ) ) );

IdentifyResult identifyResult( qobject_cast<QgsMapLayer *>( layer ), labels.join( QStringLiteral( " / " ) ), featureStore.fields(), feature, derAttributes );

Expand Down

0 comments on commit 3ef7d89

Please sign in to comment.