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"
|
2020-02-03 18:33:06 +00:00
|
|
|
#include "core/subsurface-qt/divelistnotifier.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
|
|
|
|
|
2022-04-09 00:31:02 +00:00
|
|
|
#include "qt-models/maplocationmodel.h"
|
2017-07-29 05:01:33 +00:00
|
|
|
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();
|
2019-08-30 10:38:25 +00:00
|
|
|
Q_INVOKABLE void selectedLocationChanged(struct dive_site *ds);
|
2019-08-30 15:38:54 +00:00
|
|
|
void setSelected(const QVector<dive_site *> &divesites);
|
2017-08-12 00:58:26 +00:00
|
|
|
QString pluginObject();
|
2019-08-30 13:25:59 +00:00
|
|
|
bool editMode() const;
|
2017-07-29 05:01:33 +00:00
|
|
|
|
|
|
|
private:
|
2019-08-30 20:19:23 +00:00
|
|
|
void updateEditMode();
|
2017-07-29 05:01:33 +00:00
|
|
|
QObject *m_map;
|
|
|
|
MapLocationModel *m_mapLocationModel;
|
|
|
|
qreal m_smallCircleRadius;
|
|
|
|
bool m_editMode;
|
|
|
|
|
|
|
|
private slots:
|
2019-05-09 19:33:01 +00:00
|
|
|
void diveSiteChanged(struct dive_site *ds, int field);
|
2017-07-29 05:01:33 +00:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void modelChanged();
|
|
|
|
void editModeChanged();
|
2019-05-02 20:41:24 +00:00
|
|
|
void selectedDivesChanged(const QList<int> &list);
|
2019-03-14 22:28:45 +00:00
|
|
|
void coordinatesChanged(struct dive_site *ds, const location_t &);
|
2017-08-12 00:58:26 +00:00
|
|
|
void pluginObjectChanged();
|
2017-07-29 05:01:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|