mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
mapwidget: add placeholder centerOnDiveSite() public slot
This is WIP and would be developed futher, so that the new map widget can center on a divesite location. Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
This commit is contained in:
parent
b0b5f701fc
commit
a1fbffc96c
2 changed files with 21 additions and 0 deletions
|
@ -3,6 +3,8 @@
|
|||
#include <QQuickItem>
|
||||
|
||||
#include "mapwidget.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/divesite.h"
|
||||
|
||||
MapWidget *MapWidget::m_instance = NULL;
|
||||
|
||||
|
@ -14,6 +16,17 @@ MapWidget::MapWidget(QWidget *parent) : QQuickWidget(parent)
|
|||
m_rootItem = qobject_cast<QQuickItem *>(rootObject());
|
||||
}
|
||||
|
||||
void MapWidget::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;
|
||||
|
||||
qDebug() << longitude << latitude;
|
||||
}
|
||||
|
||||
MapWidget::~MapWidget()
|
||||
{
|
||||
m_instance = NULL;
|
||||
|
|
|
@ -3,17 +3,25 @@
|
|||
|
||||
#include <QQuickWidget>
|
||||
|
||||
#include "core/divesite.h"
|
||||
|
||||
class QResizeEvent;
|
||||
class QQuickItem;
|
||||
struct dive_site;
|
||||
|
||||
class MapWidget : public QQuickWidget {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MapWidget(QWidget *parent = NULL);
|
||||
~MapWidget();
|
||||
|
||||
static MapWidget *instance();
|
||||
|
||||
public slots:
|
||||
void centerOnDiveSite(struct dive_site *);
|
||||
|
||||
private:
|
||||
static MapWidget *m_instance;
|
||||
QQuickItem *m_rootItem;
|
||||
|
|
Loading…
Reference in a new issue