diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-05-02 21:44:05 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-05-11 12:06:19 -0700 |
commit | 7c99b3a76fc2d257b5d89f271154cf4b91574d0c (patch) | |
tree | 724254d0516a0bdc6a8b96f0fd59a73de6eff19f /map-widget | |
parent | a35d1bd0e79e83b5ef49b76087e7cfe5a38d829c (diff) | |
download | subsurface-7c99b3a76fc2d257b5d89f271154cf4b91574d0c.tar.gz |
Map: don't update map-selection in centerOnSelectedDiveSite()
To detangle this code a little bit, let centerOnSelectedDiveSite()
just do what is says: center on the selected dive sites.
Don't update the selected dive site by calling
MapLocationModel::setSelected().
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'map-widget')
-rw-r--r-- | map-widget/qmlmapwidgethelper.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/map-widget/qmlmapwidgethelper.cpp b/map-widget/qmlmapwidgethelper.cpp index f00105f04..57ad01ad5 100644 --- a/map-widget/qmlmapwidgethelper.cpp +++ b/map-widget/qmlmapwidgethelper.cpp @@ -63,14 +63,13 @@ void MapWidgetHelper::centerOnSelectedDiveSite() if (selDS.isEmpty()) { // no selected dives with GPS coordinates - m_mapLocationModel->setSelected(nullptr, false); QMetaObject::invokeMethod(m_map, "deselectMapLocation"); } else if (selDS.size() == 1) { - centerOnDiveSite(selDS[0]); - } else if (selDS.size() > 1) { + QGeoCoordinate dsCoord (selDS[0]->location.lat.udeg * 0.000001, selDS[0]->location.lon.udeg * 0.000001); + QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, QVariant::fromValue(dsCoord))); + } else { /* more than one dive sites with GPS selected. * find the most top-left and bottom-right dive sites on the map coordinate system. */ - m_mapLocationModel->setSelected(selDS[0], false); qreal minLat = 0.0, minLon = 0.0, maxLat = 0.0, maxLon = 0.0; bool start = true; for(struct dive_site *dss: selDS) { |