-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmapwidget.h
76 lines (66 loc) · 1.77 KB
/
mapwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef MAPWIDGET_H
#define MAPWIDGET_H
#include <math.h>
#include <QApplication>
#include <QClipboard>
#include <QDesktopServices>
#include <QKeyEvent>
#include <QLineEdit>
#include <QMessageBox>
#include <QMouseEvent>
#include <QShortcut>
#include <QTimer>
#include <QWidget>
#include "overlays.h"
#include "pointdialog.h"
#include "tilesmap.h"
class MapWidget : public QWidget
{
Q_OBJECT
public:
explicit MapWidget(QWidget *parent = 0);
int zoom() { return m_zoom; }
bool online() { return m_online; }
signals:
void zoomChanged(int zoom);
void tilesLoading(int count);
void onlineSwitched(bool online);
private slots:
void updateMap(const QRect &r) { update(r); }
void unlockWheel() { m_lockWheel = false; }
void panLeft() { pan(QPoint(-100, 0)); }
void panRight() { pan(QPoint(100, 0)); }
void panDown() { pan(QPoint(0, 100)); }
void panUp() { pan(QPoint(0, -100)); }
void zoomIn();
void zoomOut();
void hideAll();
void openAddPointDialog();
void openEditPointDialog();
void openDeletePointDialog();
void pointDialogAccepted();
void switchOnline();
void openInOSM();
void openInGoogleMaps();
void openInYandexMaps();
protected:
void resizeEvent(QResizeEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
private:
TilesMap *m_tiles;
Overlays *m_overlays;
LatLon m_center;
int m_zoom;
bool m_online;
QPoint m_pressPos;
QPoint m_movePos;
bool m_lockWheel;
PointDialog *m_pointDialog;
void pan(const QPoint &delta);
QPointF latLonToPoint(LatLon latlon);
LatLon pointToLatLon(QPointF point);
};
#endif // MAPWIDGET_H