-
Notifications
You must be signed in to change notification settings - Fork 0
/
view2d.h
executable file
·71 lines (51 loc) · 1.45 KB
/
view2d.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
#ifndef VIEW2D_H
#define VIEW2D_H
#include <QGLWidget>
#include <QTimer>
#include <QPoint>
#include <QRect>
#include <QKeyEvent>
#include <QMouseEvent>
#include "glarray.h"
class View2D : public QGLWidget
{
Q_OBJECT
public:
View2D(QWidget* parent = 0);
virtual void initializeGL();
virtual void paintGL();
virtual void resizeGL(int width, int height);
void initMap();
void centerOnPoint(float x, float y);
void scrollTo(float x, float y) { scrollX = x; scrollY = y; }
float getScrollX() { return scrollX; }
float getScrollY() { return scrollY; }
float getMouseX() { return mouseXScaled; }
float getMouseY() { return mouseYScaled; }
virtual void mouseMoveEvent(QMouseEvent* e);
virtual void mousePressEvent(QMouseEvent* e);
virtual void mouseReleaseEvent(QMouseEvent* e);
virtual void wheelEvent(QWheelEvent* e);
virtual void keyPressEvent(QKeyEvent* e);
virtual void keyReleaseEvent(QKeyEvent* e);
public slots:
void repaintTimerHandler();
private:
void setClipRect(int x, int y, int w, int h);
QTimer* repaintTimer;
float scrollX;
float scrollY;
float scale;
int gridSize;
int mouseX;
int mouseY;
float mouseXScaled;
float mouseYScaled;
//
bool scrolling;
int scrollMouseX;
int scrollMouseY;
GLArray linesArray;
bool linesUpdate;
};
#endif // VIEW2D_H