-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglspace.h
130 lines (119 loc) · 2.2 KB
/
glspace.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#ifndef FORM_H
#define FORM_H
#include <QWidget>
#include <QGLWidget>
#include <QVector>
#include "virtglobject.h"
#include <QVector3D>
#include <QVector2D>
#include <QPointF>
#include <QTimer>
namespace Ui {
class GLSpace;
}
class GLSpace : public QGLWidget
{
Q_OBJECT
public:
explicit GLSpace(QWidget *parent = 0);
~GLSpace();
/**
* @brief add_object
* @param obj
*/
void add_object(VirtGLObject* obj);
/**
* @brief item
* return object with current type
* @param code_enum - type of object
* @return
*/
VirtGLObject *item(int code_enum);
/**
* @brief object
* @param index
* @return
*/
VirtGLObject* object(int index);
/**
* @brief count_objects
* @return
*/
int count_objects() const;
/**
* @brief setTimeout
* @param timeout
*/
void setTimeout(int timeout);
/**
* @brief timeout
* @return
*/
int timeout() const;
/**
* @brief background
* @return
*/
QColor background() const;
/**
* @brief setBackground
* @param color
*/
void setBackground(const QColor& color);
/**
* @brief is_draw_plane
* @return
*/
bool is_draw_plane() const;
/**
* @brief set_is_draw_plane
* @param value
*/
void set_is_draw_plane(bool value);
/**
* @brief set_count_lines_plane
* @param value
*/
void set_count_lines_plane(int value);
/**
* @brief count_lines_plane
* @return
*/
int count_lines_plane() const;
/**
* @brief set_width_plane
* @param value
*/
void set_width_plane(double value);
/**
* @brief width_plane
* @return
*/
double width_plane() const;
private:
Ui::GLSpace *ui;
QTimer m_timer;
bool m_is_draw_plane;
int m_count_plane_line;
double m_plane_width;
QColor m_backround;
QVector< VirtGLObject* > m_objects;
QPointF m_mouse_move;
QPointF m_rotate;
QVector3D m_translate;
bool m_mouse_down;
// QObject interface
void calc_mouse_move(const QPointF& pos);
void draw_plane();
public:
bool event(QEvent *);
// QGLWidget interface
public slots:
void updateGL();
void on_timeout();
protected:
void initializeGL();
void resizeGL(int w, int h);
void paintGL();
};
#endif // FORM_H