CycloBranch
cCalibrationChartScene.h
Go to the documentation of this file.
1
7#ifndef _CCALIBRATIONCHARTSCENE_H
8#define _CCALIBRATIONCHARTSCENE_H
9
10#include <iostream>
11#include <cmath>
12#include <deque>
13#include <QWidget>
14#include <QGraphicsView>
15#include <QRectF>
16
17
18using namespace std;
19
20
21// forward declaration
22class QPaintEvent;
23class QGraphicsScene;
24class QMatrix;
25class QGraphicsItemGroup;
26class QGraphicsRectItem;
27class QGraphicsSimpleTextItem;
28
29
38double calculateR2Value(double a, double b, vector<double> xvalues, vector<double> yvalues);
39
40
48double calculateLOD(double a, vector<double> xvalues, vector<double> yvalues);
49
50
58double calculateLOQ(double a, vector<double> xvalues, vector<double> yvalues);
59
60
64class cCalibrationChartScene : public QGraphicsView
65{
66 Q_OBJECT
67
68public:
69
70
75 cCalibrationChartScene(QWidget* parent = 0);
76
77
82
83
87 void initialize();
88
89
95 void exportToPDF(QString filename, bool postscript);
96
97
102 void exportToSVG(QString filename);
103
104
109 void exportToPNG(QString filename);
110
111
116 void hideLabels(bool state);
117
118
128 void setLineParameters(int equationtype, double a, double b, vector<double> xvalues, vector<double> yvalues, vector<double> sd);
129
130
139 void setData(vector<double> datax, vector<double> datay, vector<double> datasd, vector<string> datagroups, vector<int> datatimevalues);
140
141
146 void setGraphType(int type);
147
148
154
155
161
162
163protected:
164
165
170 void wheelEvent(QWheelEvent *event);
171
172
177 void mouseMoveEvent(QMouseEvent *event);
178
179
184 void mouseReleaseEvent(QMouseEvent *event);
185
186
191 void mousePressEvent(QMouseEvent *event);
192
193
198 void showEvent(QShowEvent *event);
199
200
205 void resizeEvent(QResizeEvent *event);
206
207
208private:
209
210 QWidget* parent;
211 QGraphicsScene* scene;
212 QMatrix originalmatrix;
213
214 QGraphicsItemGroup* zoomgroup;
215 QGraphicsRectItem* zoomrect;
216 QGraphicsSimpleTextItem* zoomsimpletextitem;
217
218 QGraphicsSimpleTextItem* cursorsimpletextitem;
219
220 //cPeaksList isotopicpattern;
221
222 int graphtype;
223
224 qreal currentscale;
225 qreal factor;
226
227 int origwidth;
228 int origheight;
229
230 bool calledbyresizeevent;
231 deque<int> oldwidth;
232 deque<int> oldheight;
233
234 int pressedx;
235 int pressedy;
236
237 int currentx;
238 int currenty;
239
240 double minxvalue;
241 double maxxvalue;
242
243 int topmargin;
244 int bottommargin;
245 int leftmargin;
246 int rightmargin;
247
248 bool firstshow;
249 bool enablemousexvalueselection;
250
251 int equationtype;
252
253 double a;
254 double b;
255
256 vector<double> xvalues;
257 vector<double> yvalues;
258
259 vector<double> sd;
260
261 vector<double> datax;
262 vector<double> datay;
263
264 vector<double> datasd;
265 vector<string> datagroups;
266
267 vector<int> datatimevalues;
268
269 bool hidelabels;
270
271
272 double getValueFromXPosition(int x, int w);
273
274
275 int getXPositionFromValue(double value, int w);
276
277
278 double getValueFromYPosition(int y, int h);
279
280
281 int getYPositionFromValue(double intensity, int h);
282
283
284 void redrawScene();
285
286
287 void updateZoomGroup();
288
289
290 void calculateMinMaxXValue();
291
292
293 double getMaximumYValue();
294
295
296signals:
297
298
304 void updateXValueInterval(double minxvalue, double maxxvalue);
305
306
307private slots:
308
309
310 void zoomIn();
311
312
313 void zoomOut();
314
315
316 void normalSize();
317
318
319 void setXValueInterval(double minxvalue, double maxxvalue);
320
321
322 void resetXValueInterval();
323
324
325 //void enableMouseXValueSelectionTool(bool enable);
326
327};
328
329#endif
double calculateLOD(double a, vector< double > xvalues, vector< double > yvalues)
Calculate limit of detection.
Definition: cCalibrationChartScene.cpp:48
double calculateLOQ(double a, vector< double > xvalues, vector< double > yvalues)
Calculate limit of quantitation.
Definition: cCalibrationChartScene.cpp:89
double calculateR2Value(double a, double b, vector< double > xvalues, vector< double > yvalues)
Calculate the coefficient of determination R^2.
Definition: cCalibrationChartScene.cpp:20
The implementation of an isotopic pattern simulator (graphics).
Definition: cCalibrationChartScene.h:65
void setData(vector< double > datax, vector< double > datay, vector< double > datasd, vector< string > datagroups, vector< int > datatimevalues)
Set parameters of calibration curve.
Definition: cCalibrationChartScene.cpp:295
void setGraphType(int type)
Set graph type.
Definition: cCalibrationChartScene.cpp:325
void updateXValueInterval(double minxvalue, double maxxvalue)
The signal is emitted when the range of x value has been changed.
void setLineParameters(int equationtype, double a, double b, vector< double > xvalues, vector< double > yvalues, vector< double > sd)
Set parameters of calibration curve.
Definition: cCalibrationChartScene.cpp:280
void initialize()
Initialize the widget.
Definition: cCalibrationChartScene.cpp:160
void resizeEvent(QResizeEvent *event)
Handle the widget resize event.
Definition: cCalibrationChartScene.cpp:528
void wheelEvent(QWheelEvent *event)
Handle the mouse wheel event.
Definition: cCalibrationChartScene.cpp:358
~cCalibrationChartScene()
The destructor.
Definition: cCalibrationChartScene.cpp:155
int getMaximumCollectionTime()
Get the maximum collection time.
Definition: cCalibrationChartScene.cpp:347
cCalibrationChartScene(QWidget *parent=0)
The constructor.
Definition: cCalibrationChartScene.cpp:94
void hideLabels(bool state)
Hide labels of calibration points.
Definition: cCalibrationChartScene.cpp:274
double getMaximumConcentration()
Get the maximum concentration.
Definition: cCalibrationChartScene.cpp:331
void exportToPNG(QString filename)
Export spectrum scene into a PNG file.
Definition: cCalibrationChartScene.cpp:255
void mousePressEvent(QMouseEvent *event)
Handle the mouse press event.
Definition: cCalibrationChartScene.cpp:478
void mouseReleaseEvent(QMouseEvent *event)
Handle the mouse release event.
Definition: cCalibrationChartScene.cpp:433
void mouseMoveEvent(QMouseEvent *event)
Handle the mouse move event.
Definition: cCalibrationChartScene.cpp:384
void exportToSVG(QString filename)
Export spectrum scene into a SVG file.
Definition: cCalibrationChartScene.cpp:234
void showEvent(QShowEvent *event)
Handle the widget show event.
Definition: cCalibrationChartScene.cpp:518
void exportToPDF(QString filename, bool postscript)
Export spectrum scene into a PDF or a PS file.
Definition: cCalibrationChartScene.cpp:203