2017-07-16 23:04:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2017-07-15 23:51:08 +00:00
|
|
|
#include <QDebug>
|
|
|
|
|
2017-07-17 15:02:37 +00:00
|
|
|
#include "qmlmapwidgethelper.h"
|
2017-07-16 21:06:05 +00:00
|
|
|
#include "core/dive.h"
|
|
|
|
#include "core/divesite.h"
|
2017-07-17 15:02:37 +00:00
|
|
|
#include "qt-models/maplocationmodel.h"
|
2017-07-16 21:06:05 +00:00
|
|
|
|
2017-07-15 23:51:08 +00:00
|
|
|
MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
|
|
|
|
{
|
2017-07-17 15:02:37 +00:00
|
|
|
m_mapLocationModel = new MapLocationModel(this);
|
2017-07-15 23:51:08 +00:00
|
|
|
}
|
2017-07-16 21:06:05 +00:00
|
|
|
|
|
|
|
void MapWidgetHelper::centerOnDiveSite(struct dive_site *ds)
|
|
|
|
{
|
|
|
|
if (!dive_site_has_gps_location(ds))
|
|
|
|
return;
|
|
|
|
|
|
|
|
qreal longitude = ds->longitude.udeg / 1000000.0;
|
|
|
|
qreal latitude = ds->latitude.udeg / 1000000.0;
|
2017-07-16 21:25:19 +00:00
|
|
|
|
|
|
|
QMetaObject::invokeMethod(m_map, "centerOnCoordinates",
|
|
|
|
Q_ARG(QVariant, latitude),
|
|
|
|
Q_ARG(QVariant, longitude));
|
2017-07-16 21:06:05 +00:00
|
|
|
}
|