-
Notifications
You must be signed in to change notification settings - Fork 0
/
tr.h
230 lines (173 loc) · 4.25 KB
/
tr.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
/*
* tr.h
*
* Copyright (c) Kartik Patel
* E-mail: letapk@gmail.com
* Download from: https://letapk.wordpress.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*/
//Last modified 26 June 2017
#define MAXTRAJPOINTS 20000
#ifndef WINDOW_H
#define WINDOW_H
#include <QApplication>
#include <QtGui>
#include <QtOpenGL>
struct POINT {
double x;
double y;
double z;
};
struct TRAJECTORY {
struct POINT trajpoint[MAXTRAJPOINTS];
double time[MAXTRAJPOINTS];
double totaltime;
double initmom, finalmom;
double initen, finalen;
};
class GLWidget;
class Window;
class GLWidget : public QGLWidget
{
Q_OBJECT
public:
GLWidget();
public slots:
void set_reset (void);
void setXRotation(int angle);
void setYRotation(int angle);
void setZRotation(int angle);
void setXShift(int x);
void setYShift(int y);
void setZShift(int z);
void setZoom(int angle);
void replot();
void change_background_color();
void change_traj_color();
signals:
void xRotationChanged(int angle);
void yRotationChanged(int angle);
void zRotationChanged(int angle);
void zoomChanged(int z);
void update_result();
protected:
void initializeGL();
void paintGL();
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
void draw_the_axes (void);
void draw_the_walls(void);
void draw_trajectory();
private:
QColor clearcolor, trajcolor;
int xRot;
int yRot;
int zRot;
QPoint lastPos;
double xShift;
double yShift;
double zShift;
float zoom;
};
class Window : public QWidget
{
Q_OBJECT
public:
Window(QMainWindow *parent);
GLWidget *glWidget;
//this has to be public because it is referenced in MainWindow
QPushButton *b1, *b2;
protected:
void keyPressEvent (QKeyEvent *event);
public slots:
void set_gui();
void setmaxtime(QString);
void setx(QString);
void sety(QString);
void setz(QString);
void setEx(QString);
void setEy(QString);
void setEz(QString);
void setdEx(QString);
void setdEy(QString);
void setdEz(QString);
void setBx(QString);
void setBy(QString);
void setBz(QString);
void setdBx(QString);
void setdBy(QString);
void setdBz(QString);
void setdbxx (int);
void setdbxy (int);
void setdbxz (int);
void setPx(QString);
void setPy(QString);
void setPz(QString);
void update_res();
private:
QTabWidget *tabcontainer;
QWidget *OptionTab;
QWidget *SliderTab;
//rotation sliders along xyz
QSlider *xSlider;
QSlider *ySlider;
QSlider *zSlider;
//shifting sliders along xyz
QSlider *xSh;
QSlider *ySh;
QSlider *zSh;
//zoom slider
QSlider *zoomSlider;
QLabel *rotlb, *shftlb, *zoomlb;
//contained on the Optiontab
//b1 is public above
QPushButton *b3, *b4;
QLabel *t1lb, *t2lb;
QLineEdit *t1a, *t1b, *t1c;
QLineEdit *t2a;
QLabel *t4lb, *t5lb, *t6lb, *t7lb, *t8lb;
QLineEdit *t4;
QLineEdit *t5a, *t5b, *t5c;
QLineEdit *t6a, *t6b, *t6c;
QLineEdit *t7a, *t7b, *t7c;
QLineEdit *t8a, *t8b, *t8c;
QCheckBox *bxx, *bxy, *bxz;
QTextEdit *result;
//functions
void creatAllOptions(void);
void creatAllSliders (void);
QSlider *createRotSlider();
QSlider *createZoomSlider();
QSlider *createShiftSlider();
void set_connections (void);
};
class MainWindow : public QMainWindow
{
Q_OBJECT
Window *window;
//menubar
QMenu *filemenu, *computemenu, *helpmenu;
//toolbar and statusbar
QToolBar *tb1;
public:
MainWindow(QWidget *parent = 0);
~MainWindow ();
public slots:
void save();
void quit();
void help();
void about();
signals:
void set_gui();
void replot();
protected:
void setup_menu_and_toolbar (void);
void initialise_default_system();
};
#endif