Skip to content

Commit

Permalink
qgsvectorlayer: Expose 3D extent in htmlMetadata
Browse files Browse the repository at this point in the history
Try to display extent 3D by default. If empty (probably because the
data is 2D), fallback to the 2D version.
  • Loading branch information
ptitjano committed Jan 14, 2025
1 parent 6f4df5d commit feb8c5f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/vector/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5841,7 +5841,10 @@ QString QgsVectorLayer::htmlMetadata() const
}

// Extent
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extent().toString() + QStringLiteral( "</td></tr>\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() ? extent().toString() : extentBox3D.toString();
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Extent" ) + QStringLiteral( "</td><td>" ) + extentAsStr + QStringLiteral( "</td></tr>\n" );
}

// feature count
Expand Down

0 comments on commit feb8c5f

Please sign in to comment.