@@ -307,20 +307,23 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( QgsFeatur
307
307
308
308
if ( geometryType == QGis::Line )
309
309
{
310
+ const QgsPolyline &pline = feature->constGeometry ()->asPolyline ();
310
311
double dist = calc.measure ( feature->constGeometry () );
311
312
QGis::UnitType myDisplayUnits;
312
313
convertMeasurement ( calc, dist, myDisplayUnits, false );
313
314
QString str = calc.textUnit ( dist, 3 , myDisplayUnits, false ); // dist and myDisplayUnits are out params
314
315
derivedAttributes.insert ( tr ( " Length" ), str );
316
+ str = QLocale::system ().toString ( pline.size () );
317
+ derivedAttributes.insert ( tr ( " Vertices" ), str );
315
318
if ( wkbType == QGis::WKBLineString || wkbType == QGis::WKBLineString25D )
316
319
{
317
320
// Add the start and end points in as derived attributes
318
- QgsPoint pnt = mCanvas ->mapSettings ().layerToMapCoordinates ( layer, feature-> constGeometry ()-> asPolyline () .first () );
321
+ QgsPoint pnt = mCanvas ->mapSettings ().layerToMapCoordinates ( layer, pline .first () );
319
322
str = QLocale::system ().toString ( pnt.x (), ' g' , 10 );
320
323
derivedAttributes.insert ( tr ( " firstX" , " attributes get sorted; translation for lastX should be lexically larger than this one" ), str );
321
324
str = QLocale::system ().toString ( pnt.y (), ' g' , 10 );
322
325
derivedAttributes.insert ( tr ( " firstY" ), str );
323
- pnt = mCanvas ->mapSettings ().layerToMapCoordinates ( layer, feature-> constGeometry ()-> asPolyline () .last () );
326
+ pnt = mCanvas ->mapSettings ().layerToMapCoordinates ( layer, pline .last () );
324
327
str = QLocale::system ().toString ( pnt.x (), ' g' , 10 );
325
328
derivedAttributes.insert ( tr ( " lastX" , " attributes get sorted; translation for firstX should be lexically smaller than this one" ), str );
326
329
str = QLocale::system ().toString ( pnt.y (), ' g' , 10 );
0 commit comments