@@ -423,25 +423,37 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur
423
423
// add details of closest vertex to identify point
424
424
closestVertexAttributes ( *feature->geometry ().constGet (), vId, layer, derivedAttributes );
425
425
}
426
- else if ( geometryType == QgsWkbTypes::PointGeometry &&
427
- QgsWkbTypes::flatType ( wkbType ) == QgsWkbTypes::Point )
426
+ else if ( geometryType == QgsWkbTypes::PointGeometry )
428
427
{
429
- // Include the x and y coordinates of the point as a derived attribute
430
- QgsPointXY pnt = mCanvas ->mapSettings ().layerToMapCoordinates ( layer, feature->geometry ().asPoint () );
431
- QString str = formatXCoordinate ( pnt );
432
- derivedAttributes.insert ( QStringLiteral ( " X" ), str );
433
- str = formatYCoordinate ( pnt );
434
- derivedAttributes.insert ( QStringLiteral ( " Y" ), str );
435
-
436
- if ( QgsWkbTypes::hasZ ( wkbType ) )
428
+ if ( QgsWkbTypes::flatType ( wkbType ) == QgsWkbTypes::Point )
437
429
{
438
- str = QLocale::system ().toString ( static_cast <const QgsPoint *>( feature->geometry ().constGet () )->z (), ' g' , 10 );
439
- derivedAttributes.insert ( QStringLiteral ( " Z" ), str );
430
+ // Include the x and y coordinates of the point as a derived attribute
431
+ QgsPointXY pnt = mCanvas ->mapSettings ().layerToMapCoordinates ( layer, feature->geometry ().asPoint () );
432
+ QString str = formatXCoordinate ( pnt );
433
+ derivedAttributes.insert ( QStringLiteral ( " X" ), str );
434
+ str = formatYCoordinate ( pnt );
435
+ derivedAttributes.insert ( QStringLiteral ( " Y" ), str );
436
+
437
+ if ( QgsWkbTypes::hasZ ( wkbType ) )
438
+ {
439
+ str = QLocale::system ().toString ( static_cast <const QgsPoint *>( feature->geometry ().constGet () )->z (), ' g' , 10 );
440
+ derivedAttributes.insert ( QStringLiteral ( " Z" ), str );
441
+ }
442
+ if ( QgsWkbTypes::hasM ( wkbType ) )
443
+ {
444
+ str = QLocale::system ().toString ( static_cast <const QgsPoint *>( feature->geometry ().constGet () )->m (), ' g' , 10 );
445
+ derivedAttributes.insert ( QStringLiteral ( " M" ), str );
446
+ }
440
447
}
441
- if ( QgsWkbTypes::hasM ( wkbType ) )
448
+ else
442
449
{
443
- str = QLocale::system ().toString ( static_cast <const QgsPoint *>( feature->geometry ().constGet () )->m (), ' g' , 10 );
444
- derivedAttributes.insert ( QStringLiteral ( " M" ), str );
450
+ // multipart
451
+
452
+ // add details of closest vertex to identify point
453
+ const QgsAbstractGeometry *geom = feature->geometry ().constGet ();
454
+ {
455
+ closestVertexAttributes ( *geom, vId, layer, derivedAttributes );
456
+ }
445
457
}
446
458
}
447
459
0 commit comments