2017-04-27 18:26:05 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-05-17 11:14:10 +00:00
|
|
|
#ifndef GLOBE_H
|
|
|
|
#define GLOBE_H
|
|
|
|
|
2015-06-05 13:52:52 +00:00
|
|
|
#include <stdint.h>
|
2015-06-09 08:19:52 +00:00
|
|
|
|
|
|
|
#ifndef NO_MARBLE
|
2013-05-17 11:14:10 +00:00
|
|
|
#include <marble/MarbleWidget.h>
|
2013-05-17 19:12:55 +00:00
|
|
|
#include <marble/GeoDataCoordinates.h>
|
|
|
|
|
2013-05-17 17:09:10 +00:00
|
|
|
#include <QHash>
|
2013-05-17 11:14:10 +00:00
|
|
|
|
2014-06-26 17:01:31 +00:00
|
|
|
namespace Marble{
|
|
|
|
class GeoDataDocument;
|
|
|
|
}
|
|
|
|
|
2013-05-18 00:58:49 +00:00
|
|
|
class KMessageWidget;
|
2013-05-17 19:12:55 +00:00
|
|
|
using namespace Marble;
|
|
|
|
struct dive;
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class GlobeGPS : public MarbleWidget {
|
2013-05-17 11:14:10 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-05-17 19:12:55 +00:00
|
|
|
using MarbleWidget::centerOn;
|
2015-07-31 00:51:38 +00:00
|
|
|
static GlobeGPS *instance();
|
2013-05-17 16:28:02 +00:00
|
|
|
void reload();
|
2014-02-28 04:09:57 +00:00
|
|
|
bool eventFilter(QObject *, QEvent *);
|
|
|
|
|
2013-05-17 19:12:55 +00:00
|
|
|
protected:
|
2013-10-17 21:53:12 +00:00
|
|
|
/* reimp */ void resizeEvent(QResizeEvent *event);
|
2014-02-28 04:09:57 +00:00
|
|
|
/* reimp */ void mousePressEvent(QMouseEvent *event);
|
|
|
|
/* reimp */ void contextMenuEvent(QContextMenuEvent *);
|
|
|
|
|
2013-05-17 16:28:02 +00:00
|
|
|
private:
|
2013-05-17 19:12:55 +00:00
|
|
|
GeoDataDocument *loadedDives;
|
2014-02-28 04:09:57 +00:00
|
|
|
KMessageWidget *messageWidget;
|
2013-10-17 21:53:12 +00:00
|
|
|
QTimer *fixZoomTimer;
|
|
|
|
int currentZoomLevel;
|
2014-05-01 21:48:14 +00:00
|
|
|
bool needResetZoom;
|
2013-12-02 17:06:19 +00:00
|
|
|
bool editingDiveLocation;
|
2014-06-11 16:25:55 +00:00
|
|
|
bool doubleClick;
|
2015-07-31 00:51:38 +00:00
|
|
|
GlobeGPS(QWidget *parent = 0);
|
2013-05-17 19:12:55 +00:00
|
|
|
|
2015-01-19 05:32:17 +00:00
|
|
|
signals:
|
2015-06-02 01:30:33 +00:00
|
|
|
void coordinatesChanged();
|
2015-01-19 05:32:17 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
2015-05-22 19:15:53 +00:00
|
|
|
void repopulateLabels();
|
2014-02-28 04:09:57 +00:00
|
|
|
void changeDiveGeoPosition(qreal lon, qreal lat, GeoDataCoordinates::Unit);
|
2013-06-05 05:44:12 +00:00
|
|
|
void mouseClicked(qreal lon, qreal lat, GeoDataCoordinates::Unit);
|
2015-07-08 20:45:24 +00:00
|
|
|
void fixZoom(bool now = false);
|
2014-05-01 17:47:52 +00:00
|
|
|
void zoomOutForNoGPS();
|
2014-05-07 21:01:05 +00:00
|
|
|
void prepareForGetDiveCoordinates();
|
2015-06-04 01:53:38 +00:00
|
|
|
void endGetDiveCoordinates();
|
2015-07-16 19:41:04 +00:00
|
|
|
void centerOnDiveSite(struct dive_site *ds);
|
2015-07-16 21:47:57 +00:00
|
|
|
void centerOnIndex(const QModelIndex& idx);
|
2013-05-17 11:14:10 +00:00
|
|
|
};
|
|
|
|
|
2014-03-26 22:08:56 +00:00
|
|
|
#else // NO_MARBLE
|
|
|
|
/* Dummy widget for when we don't have MarbleWidget */
|
|
|
|
#include <QLabel>
|
|
|
|
|
|
|
|
class GlobeGPS : public QLabel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2015-07-31 18:01:16 +00:00
|
|
|
GlobeGPS(QWidget *parent = 0);
|
|
|
|
static GlobeGPS *instance();
|
2014-03-26 22:08:56 +00:00
|
|
|
void reload();
|
|
|
|
void repopulateLabels();
|
2015-06-05 13:52:52 +00:00
|
|
|
void centerOnDiveSite(uint32_t uuid);
|
2015-07-16 21:47:57 +00:00
|
|
|
void centerOnIndex(const QModelIndex& idx);
|
2015-06-09 08:19:52 +00:00
|
|
|
void centerOnCurrentDive();
|
2014-05-22 18:40:22 +00:00
|
|
|
bool eventFilter(QObject *, QEvent *);
|
|
|
|
public
|
|
|
|
slots:
|
2014-05-13 22:32:44 +00:00
|
|
|
void prepareForGetDiveCoordinates();
|
2015-06-04 14:25:06 +00:00
|
|
|
void endGetDiveCoordinates();
|
2014-03-26 22:08:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // NO_MARBLE
|
2015-06-10 18:45:34 +00:00
|
|
|
|
|
|
|
extern "C" double getDistance(int lat1, int lon1, int lat2, int lon2);
|
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // GLOBE_H
|