summaryrefslogtreecommitdiffstats
path: root/qthelper.cpp
diff options
context:
space:
mode:
authorGravatar Tim Wootton <tim@tee-jay.demon.co.uk>2014-01-13 21:26:25 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-14 21:15:01 +0700
commit13d4c48e6a9498d37ecd26dcc55b829da6f207be (patch)
tree8fd00917cf2dfceb9e986fcd35ed2643fc4ac381 /qthelper.cpp
parent2da8146b46b6a6ed959d536249078b3ce1f5e329 (diff)
downloadsubsurface-13d4c48e6a9498d37ecd26dcc55b829da6f207be.tar.gz
Changes test for ISO 6709 location format
As discussed with Mika this changes the ISO 6709 detection to use: 1st non-whitespace character is a digit and number of commas is even. The idea is that, as all the other formats seperate the lat from long with a single comma, additional even numbers of commas could ocour in locales where comma is used as a decimal point, but in total an even number of commas (often 0) would indicate an ISO format entry. Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qthelper.cpp')
-rw-r--r--qthelper.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/qthelper.cpp b/qthelper.cpp
index cd4720908..acdb7c2ee 100644
--- a/qthelper.cpp
+++ b/qthelper.cpp
@@ -119,7 +119,8 @@ bool parseGpsText(const QString& gps_text, double *latitude, double *longitude)
// ISO 6709 Annex D representation
// http://en.wikipedia.org/wiki/ISO_6709#Representation_at_the_human_interface_.28Annex_D.29
- if (gps_text.at(0).isDigit() && gps_text.count(UTF8_DEGREE) > 0) {
+ // e.g. 52°49'02.388"N 1°36'17.388"E
+ if (gps_text.at(0).isDigit() && (gps_text.count(",") % 2) == 0) {
gpsStyle = ISO6709D;
regExp = QString("(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([NS%1%2])"
"\\s*(\\d+)[" UTF8_DEGREE "\\s](\\d+)[\'\\s](\\d+)([,\\.](\\d+))?[\"\\s]([EW%3%4])")