diff options
-rw-r--r-- | core/gpslocation.cpp | 8 | ||||
-rw-r--r-- | core/qthelper.cpp | 4 | ||||
-rw-r--r-- | desktop-widgets/locationinformation.cpp | 8 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 8 | ||||
-rw-r--r-- | mobile-widgets/qmlmapwidgethelper.cpp | 8 |
5 files changed, 18 insertions, 18 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp index 22525ca3d..753b4a72f 100644 --- a/core/gpslocation.cpp +++ b/core/gpslocation.cpp @@ -171,8 +171,8 @@ void GpsLocation::newPosition(QGeoPositionInfo pos) gpsTracker gt; gt.when = pos.timestamp().toTime_t(); gt.when += gettimezoneoffset(gt.when); - gt.latitude.udeg = (int)(pos.coordinate().latitude() * 1000000); - gt.longitude.udeg = (int)(pos.coordinate().longitude() * 1000000); + gt.latitude.udeg = lrint(pos.coordinate().latitude() * 1000000); + gt.longitude.udeg = lrint(pos.coordinate().longitude() * 1000000); addFixToStorage(gt); } } @@ -626,8 +626,8 @@ void GpsLocation::downloadFromServer() struct gpsTracker gt; gt.when = timestamp.toMSecsSinceEpoch() / 1000; - gt.latitude.udeg = (int)(latitude.toDouble() * 1000000); - gt.longitude.udeg = (int)(longitude.toDouble() * 1000000); + gt.latitude.udeg = lrint(latitude.toDouble() * 1000000); + gt.longitude.udeg = lrint(longitude.toDouble() * 1000000); gt.name = name; // add this GPS fix to the QMap and the settings (remove existing fix at the same timestamp first) if (m_trackers.keys().contains(gt.when)) { diff --git a/core/qthelper.cpp b/core/qthelper.cpp index e6a4e056a..b7db56a20 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1290,8 +1290,8 @@ extern "C" void picture_load_exif_data(struct picture *p) goto picture_load_exit; if (exif.parseFrom((const unsigned char *)mem.buffer, (unsigned)mem.size) != PARSE_EXIF_SUCCESS) goto picture_load_exit; - p->longitude.udeg= llrint(1000000.0 * exif.GeoLocation.Longitude); - p->latitude.udeg = llrint(1000000.0 * exif.GeoLocation.Latitude); + p->longitude.udeg = lrint(1000000.0 * exif.GeoLocation.Longitude); + p->latitude.udeg = lrint(1000000.0 * exif.GeoLocation.Latitude); picture_load_exit: free(mem.buffer); diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp index 542d268fb..6382378da 100644 --- a/desktop-widgets/locationinformation.cpp +++ b/desktop-widgets/locationinformation.cpp @@ -187,8 +187,8 @@ void LocationInformationWidget::acceptChanges() if (!ui.diveSiteCoordinates->text().isEmpty()) { double lat, lon; parseGpsText(ui.diveSiteCoordinates->text(), &lat, &lon); - currentDs->latitude.udeg = (int)(lat * 1000000.0); - currentDs->longitude.udeg = (int)(lon * 1000000.0); + currentDs->latitude.udeg = lrint(lat * 1000000.0); + currentDs->longitude.udeg = lrint(lon * 1000000.0); } if (dive_site_is_empty(currentDs)) { LocationInformationModel::instance()->removeRow(get_divesite_idx(currentDs)); @@ -265,8 +265,8 @@ void LocationInformationWidget::on_diveSiteCoordinates_textChanged(const QString if (!same_string(qPrintable(text), coords)) { double latitude, longitude; if (parseGpsText(text, &latitude, &longitude)) { - displayed_dive_site.latitude.udeg = (int)(latitude * 1000000); - displayed_dive_site.longitude.udeg = (int)(longitude * 1000000); + displayed_dive_site.latitude.udeg = lrint(latitude * 1000000); + displayed_dive_site.longitude.udeg = lrint(longitude * 1000000); markChangedWidget(ui.diveSiteCoordinates); emit coordinatesChanged(); ui.geoCodeButton->setEnabled(latitude != 0 && longitude != 0); diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 7305166e8..dc37fd4b0 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -654,12 +654,12 @@ void QMLManager::refreshDiveList() static void setupDivesite(struct dive *d, struct dive_site *ds, double lat, double lon, const char *locationtext) { if (ds) { - ds->latitude.udeg = (int) (lat * 1000000); - ds->longitude.udeg = (int) (lon * 1000000); + ds->latitude.udeg = lrint(lat * 1000000); + ds->longitude.udeg = lrint(lon * 1000000); } else { degrees_t latData, lonData; - latData.udeg = (int) lat; - lonData.udeg = (int) lon; + latData.udeg = lrint(lat); + lonData.udeg = lrint(lon); d->dive_site_uuid = create_dive_site_with_gps(locationtext, latData, lonData, d->when); } } diff --git a/mobile-widgets/qmlmapwidgethelper.cpp b/mobile-widgets/qmlmapwidgethelper.cpp index 7745bf71c..1ad5503dc 100644 --- a/mobile-widgets/qmlmapwidgethelper.cpp +++ b/mobile-widgets/qmlmapwidgethelper.cpp @@ -201,8 +201,8 @@ void MapWidgetHelper::copyToClipboardCoordinates(QGeoCoordinate coord, bool form bool savep = prefs.coordinates_traditional; prefs.coordinates_traditional = formatTraditional; - const int lat = llrint(1000000.0 * coord.latitude()); - const int lon = llrint(1000000.0 * coord.longitude()); + const int lat = lrint(1000000.0 * coord.latitude()); + const int lon = lrint(1000000.0 * coord.longitude()); const char *coordinates = printGPSCoords(lat, lon); QApplication::clipboard()->setText(QString(coordinates), QClipboard::Clipboard); @@ -215,8 +215,8 @@ void MapWidgetHelper::updateCurrentDiveSiteCoordinates(quint32 uuid, QGeoCoordin MapLocation *loc = m_mapLocationModel->getMapLocationForUuid(uuid); if (loc) loc->setCoordinate(coord); - displayed_dive_site.latitude.udeg = llrint(coord.latitude() * 1000000.0); - displayed_dive_site.longitude.udeg = llrint(coord.longitude() * 1000000.0); + displayed_dive_site.latitude.udeg = lrint(coord.latitude() * 1000000.0); + displayed_dive_site.longitude.udeg = lrint(coord.longitude() * 1000000.0); emit coordinatesChanged(); } |