61 #include <QMouseEvent>
70 , mLastMapUnitsPerPixel( -1.0 )
71 , mCoordinatePrecision( 6 )
103 return identify( x, y, mode, QList<QgsMapLayer *>(), layerType, identifyContext );
113 return identify( geometry, mode, QList<QgsMapLayer *>(), layerType, identifyContext );
118 QList<IdentifyResult> results;
120 mLastGeometry = geometry;
121 mLastExtent =
mCanvas->extent();
122 mLastMapUnitsPerPixel =
mCanvas->mapUnitsPerPixel();
124 mCoordinatePrecision = QgsCoordinateUtils::calculateCoordinatePrecision( mLastMapUnitsPerPixel,
mCanvas->mapSettings().destinationCrs() );
135 int x = canvasPt.x(), y = canvasPt.y();
136 QList<IdentifyResult> results =
identify( x, y,
TopDownAll, layerList, layerType, identifyContext );
137 QPoint globalPos =
mCanvas->mapToGlobal( QPoint( x + 5, y + 5 ) );
140 else if ( mode ==
ActiveLayer && layerList.isEmpty() )
146 emit
identifyMessage( tr(
"No active layer. To identify features, you must choose an active layer." ) );
152 QApplication::setOverrideCursor( Qt::WaitCursor );
154 identifyLayer( &results,
layer, mLastGeometry, mLastExtent, mLastMapUnitsPerPixel, layerType, identifyContext );
158 QApplication::setOverrideCursor( Qt::WaitCursor );
160 QList< QgsMapLayer * > targetLayers;
161 if ( layerList.isEmpty() )
162 targetLayers =
mCanvas->layers(
true );
164 targetLayers = layerList;
166 const int layerCount = targetLayers.size();
167 for (
int i = 0; i < layerCount; i++ )
177 if (
identifyLayer( &results,
layer, mLastGeometry, mLastExtent, mLastMapUnitsPerPixel, layerType, identifyContext ) )
188 QApplication::restoreOverrideCursor();
195 mOverrideCanvasSearchRadius = searchRadiusMapUnits;
200 mOverrideCanvasSearchRadius = -1;
222 return identifyRasterLayer( results, qobject_cast<QgsRasterLayer *>(
layer ), geometry, viewExtent, mapUnitsPerPixel, identifyContext );
234 return identifyVectorTileLayer( results, qobject_cast<QgsVectorTileLayer *>(
layer ), geometry, identifyContext );
238 return identifyPointCloudLayer( results, qobject_cast<QgsPointCloudLayer *>(
layer ), geometry, identifyContext );
263 double searchRadius = mOverrideCanvasSearchRadius < 0 ?
searchRadiusMU(
mCanvas ) : mOverrideCanvasSearchRadius;
266 QList<QgsMeshDatasetIndex> datasetIndexList;
267 int activeScalarGroup =
layer->rendererSettings().activeScalarDatasetGroup();
268 int activeVectorGroup =
layer->rendererSettings().activeVectorDatasetGroup();
270 const QList<int> allGroup =
layer->enabledDatasetGroupsIndexes();
273 const QgsDateTimeRange &time = identifyContext.
temporalRange();
274 if ( activeScalarGroup >= 0 )
275 datasetIndexList.append(
layer->activeScalarDatasetAtTime( time ) );
276 if ( activeVectorGroup >= 0 && activeVectorGroup != activeScalarGroup )
277 datasetIndexList.append(
layer->activeVectorDatasetAtTime( time ) );
279 for (
int groupIndex : allGroup )
281 if ( groupIndex != activeScalarGroup && groupIndex != activeVectorGroup )
282 datasetIndexList.append(
layer->datasetIndexAtTime( time, groupIndex ) );
288 if ( activeScalarGroup >= 0 )
289 datasetIndexList.append(
layer->staticScalarDatasetIndex() );
290 if ( activeVectorGroup >= 0 && activeVectorGroup != activeScalarGroup )
291 datasetIndexList.append(
layer->staticVectorDatasetIndex() );
294 for (
int groupIndex : allGroup )
296 if ( groupIndex != activeScalarGroup && groupIndex != activeVectorGroup )
298 if ( !
layer->datasetGroupMetadata( groupIndex ).isTemporal() )
299 datasetIndexList.append( groupIndex );
307 if ( !index.isValid() )
311 QMap< QString, QString > derivedAttributes;
313 QMap<QString, QString> attribute;
317 const double scalar = scalarValue.
scalar();
318 attribute.insert( tr(
"Scalar Value" ), std::isnan( scalar ) ? tr(
"no data" ) : QLocale().toString( scalar ) );
324 const double vectorX = vectorValue.
x();
325 const double vectorY = vectorValue.
y();
326 if ( std::isnan( vectorX ) || std::isnan( vectorY ) )
327 attribute.insert( tr(
"Vector Value" ), tr(
"no data" ) );
330 attribute.insert( tr(
"Vector Magnitude" ), QLocale().toString( vectorValue.
scalar() ) );
331 derivedAttributes.insert( tr(
"Vector x-component" ), QLocale().toString( vectorY ) );
332 derivedAttributes.insert( tr(
"Vector y-component" ), QLocale().toString( vectorX ) );
339 derivedAttributes.insert( tr(
"Time Step" ),
layer->formatTime( meta.
time() ) );
340 derivedAttributes.insert( tr(
"Source" ), groupMeta.
uri() );
342 QString resultName = groupMeta.
name();
343 if ( isTemporal && ( index.group() == activeScalarGroup || index.group() == activeVectorGroup ) )
344 resultName.append( tr(
" (active)" ) );
351 results->append( result );
354 QMap<QString, QString> derivedGeometry;
359 derivedGeometry.insert( tr(
"Snapped Vertex Position X" ), QLocale().toString( vertexPoint.
x() ) );
360 derivedGeometry.insert( tr(
"Snapped Vertex Position Y" ), QLocale().toString( vertexPoint.
y() ) );
366 derivedGeometry.insert( tr(
"Face Centroid X" ), QLocale().toString( faceCentroid.
x() ) );
367 derivedGeometry.insert( tr(
"Face Centroid Y" ), QLocale().toString( faceCentroid.
y() ) );
373 derivedGeometry.insert( tr(
"Point on Edge X" ), QLocale().toString( pointOnEdge.
x() ) );
374 derivedGeometry.insert( tr(
"Point on Edge Y" ), QLocale().toString( pointOnEdge.
y() ) );
382 results->append( result );
389 Q_UNUSED( identifyContext )
401 QMap< QString, QString > commonDerivedAttributes;
404 bool isPointOrRectangle;
409 isPointOrRectangle =
true;
410 point = selectionGeom.
asPoint();
420 int featureCount = 0;
422 std::unique_ptr<QgsGeometryEngine> selectionGeomPrepared;
432 double sr = mOverrideCanvasSearchRadius < 0 ?
searchRadiusMU(
mCanvas ) : mOverrideCanvasSearchRadius;
439 if ( !isPointOrRectangle )
450 const int tileZoom =
layer->tileMatrixSet().scaleToZoomLevel(
mCanvas->scale() );
454 for (
int row = tileRange.
startRow(); row <= tileRange.
endRow(); ++row )
459 QByteArray data =
layer->getRawTile( tileID );
460 if ( data.isEmpty() )
464 if ( !decoder.decode( tileID, data ) )
467 QMap<QString, QgsFields> perLayerFields;
468 const QStringList layerNames = decoder.layers();
469 for (
const QString &layerName : layerNames )
471 QSet<QString> fieldNames = qgis::listToSet( decoder.layerFieldNames( layerName ) );
476 const QStringList featuresLayerNames = features.keys();
477 for (
const QString &layerName : featuresLayerNames )
479 const QgsFields fFields = perLayerFields[layerName];
480 const QVector<QgsFeature> &layerFeatures = features[layerName];
483 if ( f.geometry().intersects( r ) && ( !selectionGeomPrepared || selectionGeomPrepared->intersects( f.geometry().constGet() ) ) )
485 QMap< QString, QString > derivedAttributes = commonDerivedAttributes;
486 derivedAttributes.insert( tr(
"Feature ID" ),
FID_TO_STRING( f.id() ) );
488 results->
append( IdentifyResult(
layer, layerName, fFields, f, derivedAttributes ) );
502 QgsDebugMsg( QStringLiteral(
"Caught CRS exception %1" ).arg( cse.
what() ) );
505 return featureCount > 0;
510 Q_UNUSED( identifyContext )
516 const double searchRadiusMapUnits = mOverrideCanvasSearchRadius < 0 ?
searchRadiusMU(
mCanvas ) : mOverrideCanvasSearchRadius;
518 const QVector<QVariantMap> points = renderer->
identify(
layer, context, geometry, searchRadiusMapUnits );
527 QMap< QString, QString > derivedAttributes;
528 derivedAttributes.insert( tr(
"(clicked coordinate X)" ), formatXCoordinate( point ) );
529 derivedAttributes.insert( tr(
"(clicked coordinate Y)" ), formatYCoordinate( point ) );
531 derivedAttributes.insert( tr(
"(clicked coordinate Z)" ), QLocale().toString( point.
z(),
'f' ) );
532 return derivedAttributes;
542 QgsDebugMsg( QStringLiteral(
"Out of scale limits" ) );
546 QString temporalFilter;
554 temporalFilter = qobject_cast< const QgsVectorLayerTemporalProperties * >(
layer->
temporalProperties() )->createFilterString( temporalContext, identifyContext.
temporalRange() );
559 QApplication::setOverrideCursor( Qt::WaitCursor );
561 QMap< QString, QString > commonDerivedAttributes;
564 bool isPointOrRectangle;
569 isPointOrRectangle =
true;
570 point = *qgsgeometry_cast< const QgsPoint *>( selectionGeom.
constGet() );
581 std::unique_ptr<QgsGeometryEngine> selectionGeomPrepared;
591 double sr = mOverrideCanvasSearchRadius < 0 ?
searchRadiusMU(
mCanvas ) : mOverrideCanvasSearchRadius;
598 if ( !isPointOrRectangle )
612 if ( !temporalFilter.isEmpty() )
619 if ( !selectionGeomPrepared || selectionGeomPrepared->intersects( f.
geometry().
constGet() ) )
627 QgsDebugMsg( QStringLiteral(
"Caught CRS exception %1" ).arg( cse.
what() ) );
635 std::unique_ptr< QgsFeatureRenderer > renderer(
layer->renderer() ?
layer->renderer()->
clone() :
nullptr );
644 if ( !isSingleClick )
647 const int featureCount =
identifyVectorLayer( results,
layer, featureList, filter ? renderer.get() :
nullptr, commonDerivedAttributes,
648 [point,
layer,
this](
const QgsFeature & feature )->QMap< QString, QString >
650 return featureDerivedAttributes( feature, layer, toLayerCoordinates( layer, point ) );
657 QApplication::restoreOverrideCursor();
658 return featureCount > 0;
663 int featureCount = 0;
664 for (
const QgsFeature &feature : std::as_const( features ) )
666 QMap< QString, QString > derivedAttributes = commonDerivedAttributes;
674 derivedAttributes.unite( deriveAttributesForFeature( feature ) );
676 derivedAttributes.insert( tr(
"Feature ID" ), fid < 0 ? tr(
"new feature" ) :
FID_TO_STRING( fid ) );
678 results->append( IdentifyResult( qobject_cast<QgsMapLayer *>(
layer ), feature, derivedAttributes ) );
693 QString
str = QLocale().toString( vId.
vertex + 1 );
694 derivedAttributes.insert( tr(
"Closest vertex number" ),
str );
698 QgsPoint closestPointMapCoords =
mCanvas->mapSettings().layerToMapCoordinates(
layer, closestPoint );
699 derivedAttributes.insert( tr(
"Closest vertex X" ), formatXCoordinate( closestPointMapCoords ) );
700 derivedAttributes.insert( tr(
"Closest vertex Y" ), formatYCoordinate( closestPointMapCoords ) );
702 if ( closestPoint.
is3D() )
704 str = QLocale().toString( closestPointMapCoords.
z(),
'g', 10 );
705 derivedAttributes.insert( tr(
"Closest vertex Z" ),
str );
709 str = QLocale().toString( closestPointMapCoords.
m(),
'g', 10 );
710 derivedAttributes.insert( tr(
"Closest vertex M" ),
str );
713 if ( vId.
type == Qgis::VertexType::Curve )
715 double radius, centerX, centerY;
721 geometry.
vertexAt( vIdAfter ), radius, centerX, centerY );
722 derivedAttributes.insert( QStringLiteral(
"Closest vertex radius" ), QLocale().toString( radius ) );
726 void QgsMapToolIdentify::closestPointAttributes(
const QgsAbstractGeometry &geometry,
const QgsPointXY &layerPoint, QMap<QString, QString> &derivedAttributes )
730 derivedAttributes.insert( tr(
"Closest X" ), formatXCoordinate( closestPoint ) );
731 derivedAttributes.insert( tr(
"Closest Y" ), formatYCoordinate( closestPoint ) );
733 if ( closestPoint.
is3D() )
735 const QString
str = QLocale().toString( closestPoint.
z(),
'g', 10 );
736 derivedAttributes.insert( tr(
"Interpolated Z" ),
str );
740 const QString
str = QLocale().toString( closestPoint.
m(),
'g', 10 );
741 derivedAttributes.insert( tr(
"Interpolated M" ),
str );
745 QString QgsMapToolIdentify::formatCoordinate(
const QgsPointXY &canvasPoint )
const
747 return QgsCoordinateUtils::formatCoordinateForProject(
QgsProject::instance(), canvasPoint,
mCanvas->mapSettings().destinationCrs(),
748 mCoordinatePrecision );
751 QString QgsMapToolIdentify::formatXCoordinate(
const QgsPointXY &canvasPoint )
const
753 QString coordinate = formatCoordinate( canvasPoint );
757 QString QgsMapToolIdentify::formatYCoordinate(
const QgsPointXY &canvasPoint )
const
759 QString coordinate = formatCoordinate( canvasPoint );
767 QMap< QString, QString > derivedAttributes;
796 derivedAttributes.insert( tr(
"Parts" ),
str );
799 str = QLocale().toString( vId.
part + 1 );
800 derivedAttributes.insert( tr(
"Part number" ),
str );
805 ? displayDistanceUnits() :
layer->
crs().mapUnits();
818 str = formatDistance( dist );
819 derivedAttributes.insert( tr(
"Length (Ellipsoidal — %1)" ).arg( ellipsoid ),
str );
828 derivedAttributes.insert( tr(
"Length (Cartesian — 2D)" ),
str );
832 return total + qgsgeometry_cast< const QgsLineString * >( part )->length3D();
835 str = formatDistance( totalLength3d, cartesianDistanceUnits );
836 derivedAttributes.insert( tr(
"Length (Cartesian — 3D)" ),
str );
840 derivedAttributes.insert( tr(
"Length (Cartesian)" ),
str );
844 derivedAttributes.insert( tr(
"Vertices" ),
str );
848 closestVertexAttributes( *geom, vId,
layer, derivedAttributes );
849 closestPointAttributes( *geom, layerPoint, derivedAttributes );
852 if (
const QgsCurve *curve = qgsgeometry_cast< const QgsCurve * >( geom ) )
856 str = formatXCoordinate( pnt );
857 derivedAttributes.insert( tr(
"firstX",
"attributes get sorted; translation for lastX should be lexically larger than this one" ),
str );
858 str = formatYCoordinate( pnt );
859 derivedAttributes.insert( tr(
"firstY" ),
str );
860 pnt =
mCanvas->mapSettings().layerToMapCoordinates(
layer,
QgsPointXY( curve->endPoint().x(), curve->endPoint().y() ) );
861 str = formatXCoordinate( pnt );
862 derivedAttributes.insert( tr(
"lastX",
"attributes get sorted; translation for firstX should be lexically smaller than this one" ),
str );
863 str = formatYCoordinate( pnt );
864 derivedAttributes.insert( tr(
"lastY" ),
str );
874 str = formatArea( area );
875 derivedAttributes.insert( tr(
"Area (Ellipsoidal — %1)" ).arg( ellipsoid ),
str );
879 derivedAttributes.insert( tr(
"Area (Cartesian)" ),
str );
885 str = formatDistance( perimeter );
886 derivedAttributes.insert( tr(
"Perimeter (Ellipsoidal — %1)" ).arg( ellipsoid ),
str );
890 derivedAttributes.insert( tr(
"Perimeter (Cartesian)" ),
str );
893 derivedAttributes.insert( tr(
"Vertices" ),
str );
899 closestPointAttributes( *feature.
geometry().
constGet(), layerPoint, derivedAttributes );
908 QString
str = formatXCoordinate( pnt );
909 derivedAttributes.insert( tr(
"X" ),
str );
910 str = formatYCoordinate( pnt );
911 derivedAttributes.insert( tr(
"Y" ),
str );
916 derivedAttributes.insert( tr(
"Z" ),
str );
921 derivedAttributes.insert( tr(
"M" ),
str );
932 closestVertexAttributes( *geom, vId,
layer, derivedAttributes );
942 return derivedAttributes;
957 std::unique_ptr< QgsRasterDataProvider > dprovider(
layer->
dataProvider()->clone() );
961 int capabilities = dprovider->capabilities();
970 dprovider->temporalCapabilities()->setRequestedTemporalRange( identifyContext.
temporalRange() );
981 QgsDebugMsg( QStringLiteral(
"coordinate not reprojectable: %1" ).arg( cse.
what() ) );
984 QgsDebugMsg( QStringLiteral(
"point = %1 %2" ).arg( point.
x() ).arg( point.
y() ) );
989 QMap< QString, QString > attributes, derivedAttributes;
1005 if ( dprovider->crs() !=
mCanvas->mapSettings().destinationCrs() )
1014 r.
setXMinimum( pointInCanvasCrs.
x() - mapUnitsPerPixel / 2. );
1015 r.
setXMaximum( pointInCanvasCrs.
x() + mapUnitsPerPixel / 2. );
1016 r.
setYMinimum( pointInCanvasCrs.
y() - mapUnitsPerPixel / 2. );
1017 r.
setYMaximum( pointInCanvasCrs.
y() + mapUnitsPerPixel / 2. );
1021 identifyResult = dprovider->identify( point, format, r, 1, 1 );
1037 int width =
static_cast< int >( std::round( viewExtent.
width() / mapUnitsPerPixel ) );
1038 int height =
static_cast< int >( std::round( viewExtent.
height() / mapUnitsPerPixel ) );
1040 QgsDebugMsg( QStringLiteral(
"viewExtent.width = %1 viewExtent.height = %2" ).arg( viewExtent.
width() ).arg( viewExtent.
height() ) );
1041 QgsDebugMsg( QStringLiteral(
"width = %1 height = %2" ).arg( width ).arg( height ) );
1042 QgsDebugMsg( QStringLiteral(
"xRes = %1 yRes = %2 mapUnitsPerPixel = %3" ).arg( viewExtent.
width() / width ).arg( viewExtent.
height() / height ).arg( mapUnitsPerPixel ) );
1044 identifyResult = dprovider->identify( point, format, viewExtent, width, height );
1049 if ( identifyResult.
isValid() )
1051 QMap<int, QVariant> values = identifyResult.
results();
1055 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
1057 QString valueString;
1058 if ( it.value().isNull() )
1060 valueString = tr(
"no data" );
1064 QVariant value( it.value() );
1068 if (
static_cast<QMetaType::Type
>( value.type() ) == QMetaType::Float )
1077 attributes.insert( dprovider->generateBandName( it.key() ), valueString );
1080 results->append(
IdentifyResult( qobject_cast<QgsMapLayer *>(
layer ), label, attributes, derivedAttributes ) );
1084 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
1086 QVariant value = it.value();
1087 if ( value.type() == QVariant::Bool && !value.toBool() )
1093 if ( value.type() == QVariant::String )
1099 attributes.insert( tr(
"Error" ), value.toString() );
1101 results->append(
IdentifyResult( qobject_cast<QgsMapLayer *>(
layer ), label, attributes, derivedAttributes ) );
1111 for (
const QgsFeature &feature : storeFeatures )
1117 QString sublayer = featureStore.params().value( QStringLiteral(
"sublayer" ) ).toString();
1118 QString featureType = featureStore.params().value( QStringLiteral(
"featureType" ) ).toString();
1120 featureType.remove( QStringLiteral(
"_feature" ) );
1122 if ( sublayer.compare(
layer->
name(), Qt::CaseInsensitive ) != 0 )
1126 if ( featureType.compare( sublayer, Qt::CaseInsensitive ) != 0 || labels.isEmpty() )
1128 labels << featureType;
1131 QMap< QString, QString > derAttributes = derivedAttributes;
1134 IdentifyResult identifyResult( qobject_cast<QgsMapLayer *>(
layer ), labels.join( QLatin1String(
" / " ) ), featureStore.fields(), feature, derAttributes );
1136 identifyResult.
mParams.insert( QStringLiteral(
"getFeatureInfoUrl" ), featureStore.params().value( QStringLiteral(
"getFeatureInfoUrl" ) ) );
1137 results->append( identifyResult );
1144 QgsDebugMsg( QStringLiteral(
"%1 HTML or text values" ).arg( values.size() ) );
1145 for (
auto it = values.constBegin(); it != values.constEnd(); ++it )
1147 QString value = it.value().toString();
1149 attributes.insert( QString(), value );
1152 results->append(
IdentifyResult( qobject_cast<QgsMapLayer *>(
layer ), label, attributes, derivedAttributes ) );
1160 attributes.insert( tr(
"Error" ), value );
1161 QString label = tr(
"Identify error" );
1162 results->append(
IdentifyResult( qobject_cast<QgsMapLayer *>(
layer ), label, attributes, derivedAttributes ) );
1178 QString QgsMapToolIdentify::formatDistance(
double distance )
const
1180 return formatDistance( distance, displayDistanceUnits() );
1183 QString QgsMapToolIdentify::formatArea(
double area )
const
1185 return formatArea( area, displayAreaUnits() );
1191 bool baseUnit = settings.
value( QStringLiteral(
"qgis/measure/keepbaseunit" ),
true ).toBool();
1199 bool baseUnit = settings.
value( QStringLiteral(
"qgis/measure/keepbaseunit" ),
true ).toBool();
1206 QList<IdentifyResult> results;
1217 for (
const QVariantMap &pt : identified )
1219 QMap<QString, QString> ptStr;
1220 QString classification;
1221 for (
auto attrIt = pt.constBegin(); attrIt != pt.constEnd(); ++attrIt )
1223 if ( attrIt.key().compare( QLatin1String(
"Z" ), Qt::CaseInsensitive ) == 0
1227 ptStr[ tr(
"Z (original)" ) ] = attrIt.value().toString();
1228 ptStr[ tr(
"Z (adjusted)" ) ] = QString::number( attrIt.value().toDouble() * elevationProps->
zScale() + elevationProps->
zOffset() );
1230 else if ( attrIt.key().compare( QLatin1String(
"Classification" ), Qt::CaseInsensitive ) == 0 )
1233 ptStr[ attrIt.key() ] = QStringLiteral(
"%1 (%2)" ).arg( attrIt.value().toString(), classification );
1237 ptStr[attrIt.key()] = attrIt.value().toString();
1240 QgsMapToolIdentify::IdentifyResult res(
layer, classification.isEmpty() ? QString::number(
id ) : QStringLiteral(
"%1 (%2)" ).arg(
id ).arg( classification ), ptStr, QMap<QString, QString>() );
1241 results.append( res );
1251 if ( identified.empty() )
1261 QHash< QgsFeatureId, QVariant > featureDistances;
1262 QHash< QgsFeatureId, QVariant > featureElevations;
1265 for (
const QVariantMap &map : identified )
1267 if ( !map.contains( QStringLiteral(
"id" ) ) )
1269 QMap< QString, QString > attributes;
1270 if ( map.value( QStringLiteral(
"distance" ) ).isValid() )
1271 attributes.insert( tr(
"Distance along curve" ), QString::number( map.value( QStringLiteral(
"distance" ) ).toDouble() ) );
1272 if ( map.value( QStringLiteral(
"elevation" ) ).isValid() )
1273 attributes.insert( tr(
"Elevation" ), QString::number( map.value( QStringLiteral(
"elevation" ) ).toDouble() ) );
1279 const QgsFeatureId id = map.value( QStringLiteral(
"id" ) ).toLongLong();
1280 filterIds.insert(
id );
1282 featureDistances.insert(
id, map.value( QStringLiteral(
"distance" ) ) );
1283 featureElevations.insert(
id, map.value( QStringLiteral(
"elevation" ) ) );
1295 identifyVectorLayer( &results, vl, features,
nullptr, QMap< QString, QString >(), [
this, vl, &featureDistances, &featureElevations](
const QgsFeature & feature )->QMap< QString, QString >
1297 QMap< QString, QString > attributes = featureDerivedAttributes( feature, vl,
QgsPointXY() );
1299 if ( featureDistances.value( feature.
id() ).isValid() )
1300 attributes.insert( tr(
"Distance along curve" ), QString::number( featureDistances.value( feature.
id() ).toDouble() ) );
1301 if ( featureElevations.value( feature.
id() ).isValid() )
1302 attributes.insert( tr(
"Elevation" ), QString::number( featureElevations.value( feature.
id() ).toDouble() ) );
1312 for (
const QVariantMap &map : identified )
1314 QMap< QString, QString > attributes;
1315 if ( map.value( QStringLiteral(
"distance" ) ).isValid() )
1316 attributes.insert( tr(
"Distance along curve" ), QString::number( map.value( QStringLiteral(
"distance" ) ).toDouble() ) );
1317 if ( map.value( QStringLiteral(
"elevation" ) ).isValid() )
1318 attributes.insert( tr(
"Elevation" ), QString::number( map.value( QStringLiteral(
"elevation" ) ).toDouble() ) );