subsurface/mobile-widgets/qmlmapwidgethelper.cpp
Lubomir I. Ivanov 5f2e60142a mapwidget.qml: add the function centerOnCoordinates()
This function can be called to center the map on a specific coordinates.
For the C++ version call it via QMetaObject::invokeMethod() in
centerOnDiveSite().

TODO: add QML property animations.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
2017-07-28 07:31:11 -07:00

22 lines
579 B
C++

#include <QDebug>
#include "qmlmapwidgethelper.h"
#include "core/dive.h"
#include "core/divesite.h"
MapWidgetHelper::MapWidgetHelper(QObject *parent) : QObject(parent)
{
}
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;
QMetaObject::invokeMethod(m_map, "centerOnCoordinates",
Q_ARG(QVariant, latitude),
Q_ARG(QVariant, longitude));
}