-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.h
251 lines (210 loc) · 6.43 KB
/
MainWindow.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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
/**
* @file MainWindow.h
* @author Donal Evans
* @date 03 Jun 2016
* @brief This class provides the main window for the application.
*
* UI elements are created and initialized, connection between signals and
* slots are established, and user inputs are managed.
*/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QGraphicsScene>
#include <QTimer>
#include <QElapsedTimer>
#include "Residue.h"
#include "FileReader.h"
#include "Vertex.h"
#include "ColourMaps.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
/**
* @brief Constructor
* @param parent The parent QWidget for this window.
*/
explicit MainWindow(QWidget *parent = 0);
/**
* @brief Destructor
*/
~MainWindow();
private slots:
/**
* @brief Increments the frame counter, and resets it if the final frame
* has been reached.
*/
void incrementFrame();
/**
* @brief Function describing actions to be taken upon clicking the .gro
* file select button.
*/
void on_groSelectButton_clicked();
/**
* @brief Function describing actions to be taken upon clicking the load
* data button.
*/
void on_loadDataButton_clicked();
/**
* @brief Function describing actions to be taken upon releasing the
* Apply Colour Mapping button.
*/
void on_m_ApplyColour_released();
/**
* @brief Function describing actions to be taken upon changing the
* value of the colour map selection spin box.
* @param arg1 The new value of the colour map selection spin box.
*/
void on_m_ColourSpinBox_valueChanged(int arg1);
/**
* @brief Function describing actions to be taken upon editing the contents
* of the maximum legend value line edit.
* @param arg1 The new contents of the maximum legend value line edit.
*/
void on_m_LegendMax_textEdited(const QString &arg1);
/**
* @brief Function describing actions to be taken upon editing the contents
* of the minimum legend value line edit.
* @param arg1 The new contents of the minimum legend value line edit.
*/
void on_m_LegendMin_textEdited(const QString &arg1);
/**
* @brief Function describing actions to be taken upon changing the
* value of the refresh rate slider.
* @param value The new value of the refresh rate slider.
*/
void on_m_RefreshRateSlider_valueChanged(int value);
/**
* @brief Function describing actions to be taken upon releasing the
* reset legend scale button.
*/
void on_m_ResetLegendScale_released();
/**
* @brief Function describing actions to be taken upon clicking the .xtc
* file select button.
*/
void on_xtcSelectButton_clicked();
/**
* @brief Outputs the current value of m_FPS to the status bar.
*/
void outputFPS();
/**
* @brief Prints a string to the console and to the status bar for duration
* miliseconds.
* @param string The QString to be printed.
* @param duration The duration of the message in the status bar, in ms.
*/
void printString(QString string, int duration);
/**
* @brief Determines if the timers associated with stepping through the
* frames of the data are running or not.
* @param running If true, the timers begin running and the visualization
* will animate successive frames. If false, the frame being displayed will
* not change.
*/
void setTimerStatus(bool running);
private:
/**
* @brief Getter for the @Atom pointer vector.
* @return A reference to a QVector of @Atom pointers.
*/
QVector<Atom*>& getAtomVectorRef();
/**
* @brief Setter for the @Atom pointer vector.
* @param atomVector The new value of the @Atom pointer vector.
*/
void setAtomVector(QVector<Atom*> atomVector);
/**
* @brief Calculates the range of values for the currently colour-mapped
* variable and updates the maximum and minimum mapping values accordingly.
*/
void calculateDataRange();
/**
* @brief Generates a list of @Vertex objects from the @Atoms in
* m_AtomVector and adds them to the OpenGL drawing surface.
*/
void createVertices();
/**
* @brief Applies the currently selected colour mapping to the data.
*/
void mapColour();
/**
* @brief Resets the maximum and minimum values of the legend to the
* default values.
*/
void resetLegend();
/**
* @brief Sorts m_AtomVector by path length.
*/
void sort();
/**
* @brief The UI for this window.
*/
Ui::MainWindow *ui;
/**
* @brief A QVector of @Atom pointers.
*/
QVector<Atom*> m_AtomVector;
/**
* @brief The @ColourMaps object to be used.
*/
ColourMaps m_ColourMaps;
/**
* @brief The @FileReader object to be used.
*/
FileReader* m_FileReader = new FileReader;
/**
* @brief A counter for the number of frames drawn that gets reset every
* second.
*/
int m_FPS = 0;
/**
* @brief The timer that determines when the FPS value is output.
*/
QTimer* m_FPSTimer = new QTimer(this);
/**
* @brief QString containing the name of the value to which colour was last
* mapped.
* Used to prevent unwanted actions if the mapping dropdown has not changed
* since the last time colour was mapped.
*/
QString m_LastMappedTo;
/**
* @brief The actual maximum value of the variable to which colour is
* currently mapped.
*/
float m_RealMapMax = -INFINITY;
/**
* @brief The actual minimum value of the variable to which colour is
* currently mapped.
*/
float m_RealMapMin = INFINITY;
/**
* @brief The time between painting events when animation is occurring.
*/
int m_RefreshTime = 1000;
/**
* @brief The timer that determines the rate at which frames are iterated
* through.
*/
QTimer* m_Timer = new QTimer(this);
/**
* @brief The user-defined maximum value for use in colour mapping, used to
* rescale the colour legend.
*/
float m_UserMapMax;
/**
* @brief The user-defined minimum value for use in colour mapping, used to
* rescale the colour legend.
*/
float m_UserMapMin;
/**
* @brief The number of miliseconds in a second.
*/
const int MS_SECOND = 1000;
};
#endif // MAINWINDOW_H