mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Correctly parse translated GPS coordinates
Minor oversight in commit 917b47b79c
("Parse localized GPS string") - we
accepted the translated hemisphere indicators in the regular expression,
but then didn't use them later when comparing with the result of applying
the regular expression.
Fixes #331
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
379fa5f652
commit
4f4b83ccbf
1 changed files with 2 additions and 2 deletions
|
@ -115,9 +115,9 @@ bool parseGpsText(const QString& gps_text, double *latitude, double *longitude)
|
||||||
// qDebug() << "Hemisphere" << r.cap(5) << "deg" << r.cap(6) << "min" << r.cap(7) << "decimal" << r.cap(8);
|
// qDebug() << "Hemisphere" << r.cap(5) << "deg" << r.cap(6) << "min" << r.cap(7) << "decimal" << r.cap(8);
|
||||||
*latitude = r.cap(2).toInt() + (r.cap(3) + QString(".") + r.cap(4)).toDouble() / 60.0;
|
*latitude = r.cap(2).toInt() + (r.cap(3) + QString(".") + r.cap(4)).toDouble() / 60.0;
|
||||||
*longitude = r.cap(6).toInt() + (r.cap(7) + QString(".") + r.cap(8)).toDouble() / 60.0;
|
*longitude = r.cap(6).toInt() + (r.cap(7) + QString(".") + r.cap(8)).toDouble() / 60.0;
|
||||||
if (r.cap(1) == "S")
|
if (r.cap(1) == "S" || r.cap(1) == tr("S"))
|
||||||
*latitude *= -1.0;
|
*latitude *= -1.0;
|
||||||
if (r.cap(5) == "W")
|
if (r.cap(5) == "W" || r.cap(5) == tr("W"))
|
||||||
*longitude *= -1.0;
|
*longitude *= -1.0;
|
||||||
// qDebug("%s -> %8.5f / %8.5f", gps_text.toLocal8Bit().data(), *latitude, *longitude);
|
// qDebug("%s -> %8.5f / %8.5f", gps_text.toLocal8Bit().data(), *latitude, *longitude);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue