forked from mapsme/omim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw_widget.hpp
111 lines (78 loc) · 2.68 KB
/
draw_widget.hpp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#pragma once
#include "qt/qtoglcontextfactory.hpp"
#include "map/framework.hpp"
#include "drape_frontend/gui/skin.hpp"
#include "drape_frontend/drape_engine.hpp"
#include "std/unique_ptr.hpp"
#include "std/mutex.hpp"
#include "std/condition_variable.hpp"
#include <QtWidgets/QOpenGLWidget>
class QQuickWindow;
namespace qt
{
class QScaleSlider;
class DrawWidget : public QOpenGLWidget
{
using TBase = QOpenGLWidget;
drape_ptr<QtOGLContextFactory> m_contextFactory;
unique_ptr<Framework> m_framework;
qreal m_ratio;
Q_OBJECT
public Q_SLOTS:
void ScalePlus();
void ScaleMinus();
void ScalePlusLight();
void ScaleMinusLight();
void ShowAll();
void ScaleChanged(int action);
void SliderPressed();
void SliderReleased();
public:
DrawWidget(QWidget * parent);
~DrawWidget();
void SetScaleControl(QScaleSlider * pScale);
bool Search(search::SearchParams params);
string GetDistance(search::Result const & res) const;
void ShowSearchResult(search::Result const & res);
void OnLocationUpdate(location::GpsInfo const & info);
void SaveState();
void LoadState();
void UpdateAfterSettingsChanged();
void PrepareShutdown();
Framework & GetFramework() { return *m_framework.get(); }
void SetMapStyle(MapStyle mapStyle);
void SetRouter(routing::RouterType routerType);
Q_SIGNAL void BeforeEngineCreation();
void CreateEngine();
protected:
void initializeGL() override;
void paintGL() override;
void resizeGL(int width, int height) override;
/// @name Overriden from QOpenGLWindow.
//@{
void mousePressEvent(QMouseEvent * e) override;
void mouseDoubleClickEvent(QMouseEvent * e) override;
void mouseMoveEvent(QMouseEvent * e) override;
void mouseReleaseEvent(QMouseEvent * e) override;
void wheelEvent(QWheelEvent * e) override;
void keyPressEvent(QKeyEvent * e) override;
void keyReleaseEvent(QKeyEvent * e) override;
//@}
private:
void SubmitFakeLocationPoint(m2::PointD const & pt);
void SubmitRoutingPoint(m2::PointD const & pt);
void ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt);
void OnViewportChanged(ScreenBase const & screen);
void UpdateScaleControl();
df::Touch GetTouch(QMouseEvent * e);
df::Touch GetSymmetrical(const df::Touch & touch);
df::TouchEvent GetTouchEvent(QMouseEvent * e, df::TouchEvent::ETouchType type);
inline int L2D(int px) const { return px * m_ratio; }
m2::PointD GetDevicePoint(QMouseEvent * e) const;
QScaleSlider * m_pScale;
bool m_enableScaleUpdate;
bool m_emulatingLocation;
void InitRenderPolicy();
unique_ptr<gui::Skin> m_skin;
};
}