2017-07-29 05:01:33 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef QMLMAPWIDGETHELPER_H
|
|
|
|
#define QMLMAPWIDGETHELPER_H
|
|
|
|
|
2018-10-08 10:57:46 +00:00
|
|
|
#include "core/units.h"
|
2017-07-29 05:01:33 +00:00
|
|
|
#include <QObject>
|
2018-03-08 19:35:44 +00:00
|
|
|
#include <QGeoCoordinate>
|
|
|
|
#include <QVariant>
|
2017-07-29 05:01:33 +00:00
|
|
|
|
2018-04-06 16:52:09 +00:00
|
|
|
#if defined(Q_OS_IOS)
|
|
|
|
#include <QtPlugin>
|
|
|
|
Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGooglemaps)
|
|
|
|
#endif
|
|
|
|
|
2017-07-29 05:01:33 +00:00
|
|
|
class MapLocationModel;
|
|
|
|
class MapLocation;
|
|
|
|
struct dive_site;
|
|
|
|
|
|
|
|
class MapWidgetHelper : public QObject {
|
|
|
|
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QObject *map MEMBER m_map)
|
|
|
|
Q_PROPERTY(MapLocationModel *model MEMBER m_mapLocationModel NOTIFY modelChanged)
|
|
|
|
Q_PROPERTY(bool editMode READ editMode WRITE setEditMode NOTIFY editModeChanged)
|
2017-08-12 00:58:26 +00:00
|
|
|
Q_PROPERTY(QString pluginObject READ pluginObject NOTIFY pluginObjectChanged)
|
2017-07-29 05:01:33 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MapWidgetHelper(QObject *parent = NULL);
|
|
|
|
|
|
|
|
void centerOnDiveSite(struct dive_site *);
|
2018-10-08 19:16:40 +00:00
|
|
|
void centerOnSelectedDiveSite();
|
2018-04-02 19:48:23 +00:00
|
|
|
Q_INVOKABLE QGeoCoordinate getCoordinatesForUUID(QVariant dive_site_uuid);
|
2018-03-08 19:38:14 +00:00
|
|
|
Q_INVOKABLE void centerOnDiveSiteUUID(QVariant dive_site_uuid);
|
|
|
|
Q_INVOKABLE void reloadMapLocations();
|
2017-07-29 05:01:33 +00:00
|
|
|
Q_INVOKABLE void copyToClipboardCoordinates(QGeoCoordinate coord, bool formatTraditional);
|
|
|
|
Q_INVOKABLE void calculateSmallCircleRadius(QGeoCoordinate coord);
|
2017-11-09 16:43:21 +00:00
|
|
|
Q_INVOKABLE void updateCurrentDiveSiteCoordinatesFromMap(quint32 uuid, QGeoCoordinate coord);
|
2017-08-06 23:58:19 +00:00
|
|
|
Q_INVOKABLE void selectVisibleLocations();
|
2018-10-08 10:57:46 +00:00
|
|
|
void updateDiveSiteCoordinates(uint32_t uuid, degrees_t latitude, degrees_t longitude);
|
2017-07-29 05:01:33 +00:00
|
|
|
bool editMode();
|
|
|
|
void setEditMode(bool editMode);
|
2017-08-12 00:58:26 +00:00
|
|
|
QString pluginObject();
|
2017-07-29 05:01:33 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QObject *m_map;
|
|
|
|
MapLocationModel *m_mapLocationModel;
|
|
|
|
qreal m_smallCircleRadius;
|
|
|
|
QList<int> m_selectedDiveIds;
|
|
|
|
bool m_editMode;
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void selectedLocationChanged(MapLocation *);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void modelChanged();
|
|
|
|
void editModeChanged();
|
|
|
|
void selectedDivesChanged(QList<int> list);
|
2018-10-08 11:51:57 +00:00
|
|
|
void coordinatesChanged(degrees_t latitude, degrees_t longitude);
|
2017-08-12 00:58:26 +00:00
|
|
|
void pluginObjectChanged();
|
2017-07-29 05:01:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|