CycloBranch
cPatternSimulatorSceneWidget.h
Go to the documentation of this file.
1
7#ifndef _CPATTERNSIMULATORSCENEWIDGET_H
8#define _CPATTERNSIMULATORSCENEWIDGET_H
9
10#include <iostream>
11#include <QWidget>
12#include <QGraphicsView>
13
15
16
17using namespace std;
18
19
20// forward declaration
21class QPaintEvent;
22class QGraphicsScene;
23class QMatrix;
24class QGraphicsItemGroup;
25class QGraphicsRectItem;
26class QGraphicsSimpleTextItem;
27
28
37double computeGaussFunction(double x, double a, double ny, double sigma);
38
39
48double computeGaussHeight(double x, double y, double ny, double sigma);
49
50
54class cPatternSimulatorSceneWidget : public QGraphicsView
55{
56 Q_OBJECT
57
58public:
59
60
65 cPatternSimulatorSceneWidget(QWidget* parent = 0);
66
67
72
73
79 void initialize(cPeaksList isotopicpattern, double fwhm);
80
81
87 void exportToPDF(QString filename, bool postscript);
88
89
94 void exportToSVG(QString filename);
95
96
101 void exportToPNG(QString filename);
102
103
108 void hidePeakLabels(bool state);
109
110
111protected:
112
113
118 void wheelEvent(QWheelEvent *event);
119
120
125 void mouseMoveEvent(QMouseEvent *event);
126
127
132 void mouseReleaseEvent(QMouseEvent *event);
133
134
139 void mousePressEvent(QMouseEvent *event);
140
141
146 void showEvent(QShowEvent *event);
147
148
153 void resizeEvent(QResizeEvent *event);
154
155
156private:
157
158 QWidget* parent;
159 QGraphicsScene* scene;
160 QMatrix originalmatrix;
161
162 QGraphicsItemGroup* zoomgroup;
163 QGraphicsRectItem* zoomrect;
164 QGraphicsSimpleTextItem* zoomsimpletextitem;
165
166 QGraphicsSimpleTextItem* cursorsimpletextitem;
167
168 cPeaksList isotopicpattern;
169
170 qreal currentscale;
171 qreal factor;
172
173 int origwidth;
174 int origheight;
175
176 bool calledbyresizeevent;
177 deque<int> oldwidth;
178 deque<int> oldheight;
179
180 bool absoluteintensity;
181 bool rawdatastate;
182 bool hidelabels;
183
184 int pressedx;
185 int pressedy;
186
187 int currentx;
188 int currenty;
189
190 double minmzratio;
191 double maxmzratio;
192
193 int topmargin;
194 int bottommargin;
195 int leftmargin;
196 int rightmargin;
197
198 bool firstshow;
199 bool enablemousemzselection;
200
201 double mzoverhead;
202 double fwhm;
203
204
205 double getMZRatioFromXPosition(int x, int w);
206
207
208 int getXPositionFromMZRatio(double mzratio, int w);
209
210
211 double getIntensityFromYPosition(int y, int h);
212
213
214 int getYPositionFromIntensity(double intensity, int h);
215
216
217 void redrawScene();
218
219
220 void updateZoomGroup();
221
222
223 void calculateMinMaxMZ();
224
225
226 double getMaximumIntensity();
227
228
229signals:
230
231
237 void updateMZInterval(double minmz, double maxmz);
238
239
240private slots:
241
242
243 void zoomIn();
244
245
246 void zoomOut();
247
248
249 void normalSize();
250
251
252 void absoluteIntensityStateChanged(bool state);
253
254
255 void rawDataStateChanged(bool state);
256
257
258 void setMZInterval(double minmz, double maxmz);
259
260
261 void resetMZInterval();
262
263
264 void enableMouseMzSelectionTool(bool enable);
265
266};
267
268#endif
double computeGaussHeight(double x, double y, double ny, double sigma)
Compute height of Gaussian function (a).
Definition: cPatternSimulatorSceneWidget.cpp:35
double computeGaussFunction(double x, double a, double ny, double sigma)
Compute value of Gaussian function.
Definition: cPatternSimulatorSceneWidget.cpp:21
The representation of a theoretical mass spectrum.
The implementation of an isotopic pattern simulator (graphics).
Definition: cPatternSimulatorSceneWidget.h:55
void exportToPDF(QString filename, bool postscript)
Export spectrum scene into a PDF or a PS file.
Definition: cPatternSimulatorSceneWidget.cpp:127
void mouseReleaseEvent(QMouseEvent *event)
Handle the mouse release event.
Definition: cPatternSimulatorSceneWidget.cpp:282
void mouseMoveEvent(QMouseEvent *event)
Handle the mouse move event.
Definition: cPatternSimulatorSceneWidget.cpp:230
void initialize(cPeaksList isotopicpattern, double fwhm)
Initialize the widget.
Definition: cPatternSimulatorSceneWidget.cpp:104
void wheelEvent(QWheelEvent *event)
Handle the mouse wheel event.
Definition: cPatternSimulatorSceneWidget.cpp:204
void resizeEvent(QResizeEvent *event)
Handle the widget resize event.
Definition: cPatternSimulatorSceneWidget.cpp:380
void mousePressEvent(QMouseEvent *event)
Handle the mouse press event.
Definition: cPatternSimulatorSceneWidget.cpp:330
~cPatternSimulatorSceneWidget()
The destructor.
Definition: cPatternSimulatorSceneWidget.cpp:99
void exportToPNG(QString filename)
Export spectrum scene into a PNG file.
Definition: cPatternSimulatorSceneWidget.cpp:179
void exportToSVG(QString filename)
Export spectrum scene into a SVG file.
Definition: cPatternSimulatorSceneWidget.cpp:158
cPatternSimulatorSceneWidget(QWidget *parent=0)
The constructor.
Definition: cPatternSimulatorSceneWidget.cpp:54
void showEvent(QShowEvent *event)
Handle the widget show event.
Definition: cPatternSimulatorSceneWidget.cpp:370
void updateMZInterval(double minmz, double maxmz)
The signal is emitted when the range of m/z ratios has been changed.
void hidePeakLabels(bool state)
Hide/Show labels of peaks.
Definition: cPatternSimulatorSceneWidget.cpp:198
The class representing a peak list.
Definition: cPeaksList.h:68