mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a35d1bd0e7
commit
7c99b3a76f
1 changed files with 3 additions and 4 deletions
|
@ -63,14 +63,13 @@ void MapWidgetHelper::centerOnSelectedDiveSite()
|
||||||
|
|
||||||
if (selDS.isEmpty()) {
|
if (selDS.isEmpty()) {
|
||||||
// no selected dives with GPS coordinates
|
// no selected dives with GPS coordinates
|
||||||
m_mapLocationModel->setSelected(nullptr, false);
|
|
||||||
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
|
QMetaObject::invokeMethod(m_map, "deselectMapLocation");
|
||||||
} else if (selDS.size() == 1) {
|
} else if (selDS.size() == 1) {
|
||||||
centerOnDiveSite(selDS[0]);
|
QGeoCoordinate dsCoord (selDS[0]->location.lat.udeg * 0.000001, selDS[0]->location.lon.udeg * 0.000001);
|
||||||
} else if (selDS.size() > 1) {
|
QMetaObject::invokeMethod(m_map, "centerOnCoordinate", Q_ARG(QVariant, QVariant::fromValue(dsCoord)));
|
||||||
|
} else {
|
||||||
/* more than one dive sites with GPS selected.
|
/* more than one dive sites with GPS selected.
|
||||||
* find the most top-left and bottom-right dive sites on the map coordinate system. */
|
* 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;
|
qreal minLat = 0.0, minLon = 0.0, maxLat = 0.0, maxLon = 0.0;
|
||||||
bool start = true;
|
bool start = true;
|
||||||
for(struct dive_site *dss: selDS) {
|
for(struct dive_site *dss: selDS) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue