CycloBranch
cSpectrumSceneWidget.h
Go to the documentation of this file.
1
7#ifndef _CSPECTRUMSCENEWIDGET_H
8#define _CSPECTRUMSCENEWIDGET_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
32class cSpectrumSceneWidget : public QGraphicsView
33{
34 Q_OBJECT
35
36public:
37
38
43 cSpectrumSceneWidget(QWidget* parent = 0);
44
45
50
51
60 void initialize(cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum, cPeakListSeries* rawdata, int rowid, int activefileid);
61
62
68 void exportToPDF(QString filename, bool postscript);
69
70
75 void exportToSVG(QString filename);
76
77
82 void exportToPNG(QString filename);
83
84
89 void hideUnmatchedPeaks(bool state);
90
91
96 void hideMatchedPeaks(bool state);
97
98
103 void hideScrambledPeaks(bool state);
104
105
110 void hidePeakLabels(bool state);
111
112
113protected:
114
115
120 void wheelEvent(QWheelEvent *event);
121
122
127 void mouseMoveEvent(QMouseEvent *event);
128
129
134 void mouseReleaseEvent(QMouseEvent *event);
135
136
141 void mousePressEvent(QMouseEvent *event);
142
143
148 void showEvent(QShowEvent *event);
149
150
155 void resizeEvent(QResizeEvent *event);
156
157
158private:
159
160 QWidget* parent;
161 QGraphicsScene* scene;
162 QMatrix originalmatrix;
163
164 QGraphicsItemGroup* zoomgroup;
165 QGraphicsRectItem* zoomrect;
166 QGraphicsSimpleTextItem* zoomsimpletextitem;
167
168 QGraphicsSimpleTextItem* cursorsimpletextitem;
169
170 cParameters* parameters;
171 cTheoreticalSpectrum* theoreticalspectrum;
172 cPeaksList* rawdatapeaklist;
173
174 qreal currentscale;
175 qreal factor;
176
177 int origwidth;
178 int origheight;
179
180 bool calledbyresizeevent;
181 deque<int> oldwidth;
182 deque<int> oldheight;
183
184 string visibleionseriespart1;
185 string visibleionseriespart2;
186 string visibleneutralloss;
187 int coloredrotationid;
188 string coloredrotationstring;
189 int coloredtrotationid;
190
191 bool absoluteintensity;
192 bool rawdatastate;
193 bool hideunmatched;
194 bool hidematched;
195 bool hidescrambled;
196 bool hidelabels;
197
198 int pressedx;
199 int pressedy;
200
201 int currentx;
202 int currenty;
203
204 double minmzratio;
205 double maxmzratio;
206
207 int topmargin;
208 int bottommargin;
209 int leftmargin;
210 int rightmargin;
211
212 bool firstshow;
213 bool enablemousemzselection;
214
215 double maxmzoverhead;
216
217 int activefileid;
218
219
220 double getMZRatioFromXPosition(int x, int w);
221
222
223 int getXPositionFromMZRatio(double mzratio, int w);
224
225
226 double getIntensityFromYPosition(int y, int h);
227
228
229 void redrawScene();
230
231
232 void updateZoomGroup();
233
234
235 void calculateMinMaxMZ();
236
237
238 double getMaximumIntensity();
239
240
241signals:
242
243
249 void updateMZInterval(double minmz, double maxmz);
250
251
252private slots:
253
254
255 void zoomIn();
256
257
258 void zoomOut();
259
260
261 void normalSize();
262
263
264 void absoluteIntensityStateChanged(bool state);
265
266
267 void rawDataStateChanged(bool state);
268
269
270 void setMZInterval(double minmz, double maxmz);
271
272
273 void resetMZInterval();
274
275
276 void ionSeriesChanged(QString text);
277
278
279 void neutralLossChanged(QString text);
280
281
282 void rotationChanged(int index);
283
284
285 void trotationChanged(int index);
286
287
288 void rotationChanged(QString text);
289
290
291 void enableMouseMzSelectionTool(bool enable);
292
293
294};
295
296#endif
The representation of a theoretical mass spectrum.
The class storing parameters of the application.
Definition: cParameters.h:82
The class representing a series of peaklists.
Definition: cPeakListSeries.h:21
The class representing a peak list.
Definition: cPeaksList.h:68
The widget representing a 2D mass spectrum.
Definition: cSpectrumSceneWidget.h:33
void resizeEvent(QResizeEvent *event)
Handle the widget resize event.
Definition: cSpectrumSceneWidget.cpp:385
void exportToSVG(QString filename)
Export spectrum scene into a SVG file.
Definition: cSpectrumSceneWidget.cpp:145
void hideUnmatchedPeaks(bool state)
Hide/Show unmatched peaks.
Definition: cSpectrumSceneWidget.cpp:185
void exportToPNG(QString filename)
Export spectrum scene into a PNG file.
Definition: cSpectrumSceneWidget.cpp:166
void hideMatchedPeaks(bool state)
Hide/Show matched peaks.
Definition: cSpectrumSceneWidget.cpp:191
void mouseMoveEvent(QMouseEvent *event)
Handle the mouse move event.
Definition: cSpectrumSceneWidget.cpp:235
void showEvent(QShowEvent *event)
Handle the widget show event.
Definition: cSpectrumSceneWidget.cpp:375
void hideScrambledPeaks(bool state)
Hide/Show scrambled peaks.
Definition: cSpectrumSceneWidget.cpp:197
void updateMZInterval(double minmz, double maxmz)
The signal is emitted when the range of m/z ratios has been changed.
cSpectrumSceneWidget(QWidget *parent=0)
The constructor.
Definition: cSpectrumSceneWidget.cpp:22
~cSpectrumSceneWidget()
The destructor.
Definition: cSpectrumSceneWidget.cpp:79
void mousePressEvent(QMouseEvent *event)
Handle the mouse press event.
Definition: cSpectrumSceneWidget.cpp:335
void hidePeakLabels(bool state)
Hide/Show labels of peaks.
Definition: cSpectrumSceneWidget.cpp:203
void mouseReleaseEvent(QMouseEvent *event)
Handle the mouse release event.
Definition: cSpectrumSceneWidget.cpp:287
void initialize(cParameters *parameters, cTheoreticalSpectrum *theoreticalspectrum, cPeakListSeries *rawdata, int rowid, int activefileid)
Initialize the widget.
Definition: cSpectrumSceneWidget.cpp:84
void exportToPDF(QString filename, bool postscript)
Export spectrum scene into a PDF or a PS file.
Definition: cSpectrumSceneWidget.cpp:114
void wheelEvent(QWheelEvent *event)
Handle the mouse wheel event.
Definition: cSpectrumSceneWidget.cpp:209
The class representing a theoretical mass spectrum.
Definition: cTheoreticalSpectrum.h:106