summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Tim Wootton <tim@tee-jay.demon.co.uk>2013-12-31 22:14:55 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-01-03 09:18:45 -0800
commit65eb86f85456a4b296dc3fabeb1d1af03b26c8d2 (patch)
treec2d0df42b2189a9932c694766f6a3fddc5bb7e89 /qt-ui/maintab.cpp
parent41876f974e8b4cc0e8af1474c8073b6baf64687f (diff)
downloadsubsurface-65eb86f85456a4b296dc3fabeb1d1af03b26c8d2.tar.gz
MainTab location coordinates displayed in ISO6709 format
changes the location coordinates display in the main tab to use ISO6709(2008) Annex D suggested format. Signed-off-by: Tim Wootton <tim@tee-jay.demon.co.uk> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 4fc543fc0..07c21b2b5 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -974,7 +974,8 @@ void MainTab::editWeightWidget(const QModelIndex& index)
QString MainTab::printGPSCoords(int lat, int lon)
{
unsigned int latdeg, londeg;
- unsigned int ilatmin, ilonmin;
+ unsigned int latmin, lonmin;
+ double latsec, lonsec;
QString lath, lonh, result;
if (!lat && !lon)
@@ -986,11 +987,13 @@ QString MainTab::printGPSCoords(int lat, int lon)
lon = abs(lon);
latdeg = lat / 1000000;
londeg = lon / 1000000;
- ilatmin = (lat % 1000000) * 60;
- ilonmin = (lon % 1000000) * 60;
- result.sprintf("%s%u%s %2d.%05d\' , %s%u%s %2d.%05d\'",
- lath.toUtf8().data(), latdeg, UTF8_DEGREE, ilatmin / 1000000, (ilatmin % 1000000) / 10,
- lonh.toUtf8().data(), londeg, UTF8_DEGREE, ilonmin / 1000000, (ilonmin % 1000000) / 10);
+ latmin = (lat % 1000000) * 60;
+ lonmin = (lon % 1000000) * 60;
+ latsec = (latmin % 1000000) * 60;
+ lonsec = (lonmin % 1000000) * 60;
+ result.sprintf("%u%s%02d\'%06.3f\"%s %u%s%02d\'%06.3f\"%s",
+ latdeg, UTF8_DEGREE, latmin / 1000000, latsec / 1000000, lath.toUtf8().data(),
+ londeg, UTF8_DEGREE, lonmin / 1000000, lonsec / 1000000, lonh.toUtf8().data());
return result;
}