summaryrefslogtreecommitdiffstats
path: root/mobile-widgets/qmlmapwidgethelper.cpp
blob: 2bd27fce8e133e2b5a8239b81806f20824ecafb1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#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));
}