2017-07-28 22:01:33 -07:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef QMLMAPWIDGETHELPER_H
|
|
|
|
#define QMLMAPWIDGETHELPER_H
|
|
|
|
|
2018-10-08 12:57:46 +02:00
|
|
|
#include "core/units.h"
|
2019-05-09 21:33:01 +02:00
|
|
|
#include "core/subsurface-qt/DiveListNotifier.h"
|
2017-07-28 22:01:33 -07:00
|
|
|
#include <QObject>
|
2018-03-08 21:35:44 +02:00
|
|
|
#include <QGeoCoordinate>
|
2017-07-28 22:01:33 -07:00
|
|
|
|
2018-04-06 13:52:09 -03:00
|
|
|
#if defined(Q_OS_IOS)
|
|
|
|
#include <QtPlugin>
|
|
|
|
Q_IMPORT_PLUGIN(QGeoServiceProviderFactoryGooglemaps)
|
|
|
|
#endif
|
|
|
|
|
2017-07-28 22:01:33 -07: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 15:00:12 +02:00
|
|
|
Q_PROPERTY(bool editMode MEMBER m_editMode NOTIFY editModeChanged)
|
2017-08-12 03:58:26 +03:00
|
|
|
Q_PROPERTY(QString pluginObject READ pluginObject NOTIFY pluginObjectChanged)
|
2017-07-28 22:01:33 -07:00
|
|
|
|
|
|
|
public:
|
|
|
|
explicit MapWidgetHelper(QObject *parent = NULL);
|
|
|
|
|
2018-10-08 21:16:40 +02:00
|
|
|
void centerOnSelectedDiveSite();
|
2018-10-28 22:04:56 +01:00
|
|
|
Q_INVOKABLE QGeoCoordinate getCoordinates(struct dive_site *ds);
|
|
|
|
Q_INVOKABLE void centerOnDiveSite(struct dive_site *ds);
|
2018-03-08 21:38:14 +02:00
|
|
|
Q_INVOKABLE void reloadMapLocations();
|
2017-07-28 22:01:33 -07:00
|
|
|
Q_INVOKABLE void copyToClipboardCoordinates(QGeoCoordinate coord, bool formatTraditional);
|
|
|
|
Q_INVOKABLE void calculateSmallCircleRadius(QGeoCoordinate coord);
|
2018-10-26 17:03:54 +02:00
|
|
|
Q_INVOKABLE void updateCurrentDiveSiteCoordinatesFromMap(struct dive_site *ds, QGeoCoordinate coord);
|
2017-08-07 02:58:19 +03:00
|
|
|
Q_INVOKABLE void selectVisibleLocations();
|
2019-08-30 12:38:25 +02:00
|
|
|
Q_INVOKABLE void selectedLocationChanged(struct dive_site *ds);
|
2019-08-30 16:51:59 +02:00
|
|
|
void selectionChanged();
|
2019-08-30 17:38:54 +02:00
|
|
|
void setSelected(const QVector<dive_site *> &divesites);
|
2017-08-12 03:58:26 +03:00
|
|
|
QString pluginObject();
|
2019-08-30 15:25:59 +02:00
|
|
|
bool editMode() const;
|
2017-07-28 22:01:33 -07:00
|
|
|
|
|
|
|
private:
|
2019-08-30 22:19:23 +02:00
|
|
|
void updateEditMode();
|
2017-07-28 22:01:33 -07:00
|
|
|
QObject *m_map;
|
|
|
|
MapLocationModel *m_mapLocationModel;
|
|
|
|
qreal m_smallCircleRadius;
|
|
|
|
bool m_editMode;
|
|
|
|
|
|
|
|
private slots:
|
2019-05-09 21:33:01 +02:00
|
|
|
void diveSiteChanged(struct dive_site *ds, int field);
|
2017-07-28 22:01:33 -07:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void modelChanged();
|
|
|
|
void editModeChanged();
|
2019-05-02 22:41:24 +02:00
|
|
|
void selectedDivesChanged(const QList<int> &list);
|
2019-03-14 23:28:45 +01:00
|
|
|
void coordinatesChanged(struct dive_site *ds, const location_t &);
|
2017-08-12 03:58:26 +03:00
|
|
|
void pluginObjectChanged();
|
2017-07-28 22:01:33 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|