Skip to content
Permalink
Browse files

[locator] Fix broken parsing of google maps URL Z values

  • Loading branch information
nirvn committed Jan 7, 2021
1 parent 5454d22 commit 1181c36ce145ef7055b7c9ec8b74b85b330de343
Showing with 3 additions and 3 deletions.
  1. +2 −2 src/app/locator/qgsinbuiltlocatorfilters.cpp
  2. +1 −1 tests/src/app/testqgsapplocatorfilters.cpp
@@ -1100,9 +1100,9 @@ void QgsGotoLocatorFilter::fetchResults( const QString &string, const QgsLocator

if ( okX && okY )
{
if ( match.captured( 2 ) == QChar( 'z' ) && scales.contains( params.at( 2 ).toInt() ) )
if ( match.captured( 2 ) == QChar( 'z' ) && scales.contains( static_cast<int>( params.at( 2 ).toDouble() ) ) )
{
scale = scales.value( params.at( 2 ).toInt() );
scale = scales.value( static_cast<int>( params.at( 2 ).toDouble() ) );
}
else if ( match.captured( 2 ) == QChar( 'm' ) )
{
@@ -391,7 +391,7 @@ void TestQgsAppLocatorFilters::testGoto()
QCOMPARE( results.at( 0 ).userData.toMap()[QStringLiteral( "scale" )].toDouble(), 22569.0 );

// Google Maps
results = gatherResults( &filter, QStringLiteral( "https://www.google.com/maps/@44.5546,6.4936,15z" ), QgsLocatorContext() );
results = gatherResults( &filter, QStringLiteral( "https://www.google.com/maps/@44.5546,6.4936,15.25z" ), QgsLocatorContext() );
QCOMPARE( results.count(), 1 );
QCOMPARE( results.at( 0 ).displayString, QObject::tr( "Go to 6.4936° 44.5546° at scale 1:22569 (EPSG:4326 - WGS 84)" ) );
QCOMPARE( results.at( 0 ).userData.toMap()[QStringLiteral( "point" )].value<QgsPointXY>(), QgsPointXY( 6.4936, 44.5546 ) );

0 comments on commit 1181c36

Please sign in to comment.
You can’t perform that action at this time.