Skip to content

Commit

Permalink
Fix accuracy message when operation accuracy is unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jun 3, 2019
1 parent 3defbe1 commit 4bf6e8f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/app/qgsappcoordinateoperationhandlers.cpp
Expand Up @@ -145,11 +145,17 @@ void QgsAppMissingGridHandler::onMissingPreferredGrid( const QgsCoordinateRefere
gridMessage = "<ul>" + gridMessage + "</ul>";
}

QString accuracyMessage;
if ( availableOperation.accuracy >= 0 && preferredOperation.accuracy >= 0 )
accuracyMessage = tr( "<p>Current transform “<i>%1</i>” has an accuracy of %2 meters, while the preferred transformation “<i>%3</i>” has accuracy %4 meters.</p>" ).arg( availableOperation.name )
.arg( availableOperation.accuracy ).arg( preferredOperation.name ).arg( preferredOperation.accuracy );
else if ( preferredOperation.accuracy >= 0 )
accuracyMessage = tr( "<p>Current transform “<i>%1</i>” has an unknown accuracy, while the preferred transformation “<i>%2</i>” has accuracy %3 meters.</p>" ).arg( availableOperation.name )
.arg( preferredOperation.name ).arg( preferredOperation.accuracy );

const QString longMessage = tr( "<p>The preferred transform between <i>%1</i> and <i>%2</i> is not available for use on the system.</p>" ).arg( displayIdentifierForCrs( sourceCrs ),
displayIdentifierForCrs( destinationCrs ) )
+ gridMessage +
tr( "<p>Current transform “<i>%1</i>” has an accuracy of %2 meters, while the preferred transformation “<i>%3</i>” has accuracy %4 meters.</p>" ).arg( availableOperation.name )
.arg( availableOperation.accuracy ).arg( preferredOperation.name ).arg( preferredOperation.accuracy );
+ gridMessage + accuracyMessage;

QgsMessageBar *bar = QgisApp::instance()->messageBar();
QgsMessageBarItem *widget = bar->createMessage( QString(), shortMessage );
Expand Down

0 comments on commit 4bf6e8f

Please sign in to comment.