From ea39bc5e206cecc069e0d124378cfdbc61214f31 Mon Sep 17 00:00:00 2001 From: Jean Felder Date: Tue, 14 Jan 2025 15:06:22 +0100 Subject: [PATCH] qgsvectorlayer: Expose 3D extent in htmlMetadata Try to display extent 3D by default. If empty (probably because the data is 2D), fallback to the 2D version. --- src/core/vector/qgsvectorlayer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/vector/qgsvectorlayer.cpp b/src/core/vector/qgsvectorlayer.cpp index 690ae1fdd73c..a91bcc6410b9 100644 --- a/src/core/vector/qgsvectorlayer.cpp +++ b/src/core/vector/qgsvectorlayer.cpp @@ -5841,7 +5841,10 @@ QString QgsVectorLayer::htmlMetadata() const } // Extent - myMetadata += QStringLiteral( "" ) + tr( "Extent" ) + QStringLiteral( "" ) + extent().toString() + QStringLiteral( "\n" ); + // Try to display extent 3D by default. If empty (probably because the data is 2D), fallback to the 2D version + const QgsBox3D extentBox3D = extent3D(); + const QString extentAsStr = !extentBox3D.isEmpty() ? extentBox3D.toString() : extent().toString(); + myMetadata += QStringLiteral( "" ) + tr( "Extent" ) + QStringLiteral( "" ) + extentAsStr + QStringLiteral( "\n" ); } // feature count