Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Show the CRS Epoch up to 3 decimal digits when needed and in more places #57725

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/core/layertree/qgslayertreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,15 @@ QVariant QgsLayerTreeModel::data( const QModelIndex &index, int role ) const

if ( layer->isSpatial() && layer->crs().isValid() )
{
QString layerCrs = layer->crs().authid();
if ( !std::isnan( layer->crs().coordinateEpoch() ) )
{
layerCrs += QStringLiteral( " @ %1" ).arg( qgsDoubleToString( layer->crs().coordinateEpoch(), 3 ) );
}
if ( QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer ) )
title += tr( " (%1 - %2)" ).arg( QgsWkbTypes::displayString( vl->wkbType() ), layer->crs().authid() ).toHtmlEscaped();
title += tr( " (%1 - %2)" ).arg( QgsWkbTypes::displayString( vl->wkbType() ), layerCrs ).toHtmlEscaped();
else
title += tr( " (%1)" ).arg( layer->crs().authid() ).toHtmlEscaped();
title += tr( " (%1)" ).arg( layerCrs ).toHtmlEscaped();
}

QStringList parts;
Expand Down
2 changes: 1 addition & 1 deletion src/core/proj/qgscoordinatereferencesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ QString QgsCoordinateReferenceSystem::userFriendlyIdentifier( Qgis::CrsIdentifie
id = QObject::tr( "Custom CRS: %1" ).arg( type == Qgis::CrsIdentifierType::MediumString ? ( toProj().left( 50 ) + QString( QChar( 0x2026 ) ) )
: toProj() );
if ( !id.isEmpty() && !std::isnan( d->mCoordinateEpoch ) )
id += QStringLiteral( " @ %1" ).arg( d->mCoordinateEpoch );
id += QStringLiteral( " @ %1" ).arg( qgsDoubleToString( d->mCoordinateEpoch, 3 ) );

return id;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3386,7 +3386,7 @@ QString QgsMapLayer::crsHtmlMetadata() const
// coordinate epoch
if ( !std::isnan( c.coordinateEpoch() ) )
{
metadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Coordinate Epoch" ) + QStringLiteral( "</td><td>%1</td></tr>\n" ).arg( c.coordinateEpoch() );
metadata += QStringLiteral( "<tr><td class=\"highlight\">" ) + tr( "Coordinate Epoch" ) + QStringLiteral( "</td><td>%1</td></tr>\n" ).arg( qgsDoubleToString( c.coordinateEpoch(), 3 ) );
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/core/qgsmaplayermodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,15 @@ QVariant QgsMapLayerModel::data( const QModelIndex &index, int role ) const
title = "<b>" + title + "</b>";
if ( layer->isSpatial() && layer->crs().isValid() )
{
QString layerCrs = layer->crs().authid();
if ( !std::isnan( layer->crs().coordinateEpoch() ) )
{
layerCrs += QStringLiteral( " @ %1" ).arg( qgsDoubleToString( layer->crs().coordinateEpoch(), 3 ) );
}
if ( QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( layer ) )
title = tr( "%1 (%2 - %3)" ).arg( title, QgsWkbTypes::displayString( vl->wkbType() ), layer->crs().authid() );
title = tr( "%1 (%2 - %3)" ).arg( title, QgsWkbTypes::displayString( vl->wkbType() ), layerCrs );
else
title = tr( "%1 (%2) " ).arg( title, layer->crs().authid() );
title = tr( "%1 (%2)" ).arg( title, layerCrs );
}
parts << title;

Expand Down
Loading