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:
Dirk Hohndel 2013-12-06 20:37:47 -08:00
parent 379fa5f652
commit 4f4b83ccbf

View file

@ -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);
*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;
if (r.cap(1) == "S")
if (r.cap(1) == "S" || r.cap(1) == tr("S"))
*latitude *= -1.0;
if (r.cap(5) == "W")
if (r.cap(5) == "W" || r.cap(5) == tr("W"))
*longitude *= -1.0;
// qDebug("%s -> %8.5f / %8.5f", gps_text.toLocal8Bit().data(), *latitude, *longitude);
return true;