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>
|
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)
|
2018-10-08 13:00:12 +00:00
|
|
|
Q_PROPERTY(bool editMode MEMBER m_editMode 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);
|
|
|
|
|
2018-10-08 19:16:40 +00:00
|
|
|
void centerOnSelectedDiveSite();
|
2018-10-28 21:04:56 +00:00
|
|
|
Q_INVOKABLE QGeoCoordinate getCoordinates(struct dive_site *ds);
|
|
|
|
Q_INVOKABLE void centerOnDiveSite(struct dive_site *ds);
|
2018-03-08 19:38:14 +00:00
|
|
|
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);
|
2018-10-26 15:03:54 +00:00
|
|
|
Q_INVOKABLE void updateCurrentDiveSiteCoordinatesFromMap(struct dive_site *ds, QGeoCoordinate coord);
|
2017-08-06 23:58:19 +00:00
|
|
|
Q_INVOKABLE void selectVisibleLocations();
|
2018-10-25 10:23:19 +00:00
|
|
|
void updateDiveSiteCoordinates(struct dive_site *ds, const location_t &);
|
2018-10-25 08:07:45 +00:00
|
|
|
void enterEditMode(struct dive_site *ds);
|
2018-10-08 13:00:12 +00:00
|
|
|
void exitEditMode();
|
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-20 18:12:15 +00:00
|
|
|
void coordinatesChanged(const location_t &);
|
2017-08-12 00:58:26 +00:00
|
|
|
void pluginObjectChanged();
|
2017-07-29 05:01:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|