CycloBranch
cLinearWidget.h
Go to the documentation of this file.
1
7#ifndef _CLINEARWIDGET_H
8#define _CLINEARWIDGET_H
9
10#include <QWidget>
11
13
14
15// forward declaration
16class QPaintEvent;
17
18
22struct cIonLabel {
23
27 int x;
28
29
33 int y;
34
35
39 set<string> labelset;
40
41
46
47
52 clear();
53 }
54
55
59 void clear() {
60 x = 0;
61 y = 0;
62 labelset.clear();
63 alignright = false;
64 }
65
66};
67
68
73
79 size_t operator()(const cIonLabel& label) const {
80 return std::hash<string>()(to_string(label.x) + to_string(label.y));
81 }
82
83};
84
85
92bool operator == (cIonLabel const& a, cIonLabel const& b);
93
94
103void insertLabel(unordered_set<cIonLabel, hash_cIonLabel>& labels, int x, int y, string& description, bool alignright);
104
105
112void drawLabels(QPainter& painter, unordered_set<cIonLabel, hash_cIonLabel>& labels, int width);
113
114
118class cLinearWidget : public QWidget
119{
120 Q_OBJECT
121
122public:
123
124
129
130
136 void initialize(cParameters* parameters, cTheoreticalSpectrum* theoreticalspectrum);
137
138
144 void exportToPDF(QString filename, bool postscript);
145
146
151 void exportToPNG(QString filename);
152
153
158 void exportToSVG(QString filename);
159
160
165 void setReportIsomers(bool reportisomers);
166
167
172 void hidePeakLabels(bool state);
173
174
175protected:
176
177
182 void paintEvent(QPaintEvent *event);
183
184
185private:
186
187 void paint(QPainter& painter);
188
189 cParameters* parameters;
190 cTheoreticalSpectrum* theoreticalspectrum;
191
192 string visibleionseries;
193 string visibleneutralloss;
194
195 bool reportisomers;
196 bool hidelabels;
197
198
199private slots:
200
201 void ionSeriesChanged(QString text);
202
203 void neutralLossChanged(QString text);
204
205};
206
207#endif
bool operator==(cIonLabel const &a, cIonLabel const &b)
Overloaded operator ==.
Definition: cLinearWidget.cpp:12
void insertLabel(unordered_set< cIonLabel, hash_cIonLabel > &labels, int x, int y, string &description, bool alignright)
Insert a fragment ion label into an unordered set of labels and concatenate descriptions of labels on...
Definition: cLinearWidget.cpp:17
void drawLabels(QPainter &painter, unordered_set< cIonLabel, hash_cIonLabel > &labels, int width)
Draw labels of fragment ions.
Definition: cLinearWidget.cpp:35
The representation of a theoretical mass spectrum.
Visualization of a linear peptide.
Definition: cLinearWidget.h:119
void initialize(cParameters *parameters, cTheoreticalSpectrum *theoreticalspectrum)
Initialize the widget.
Definition: cLinearWidget.cpp:72
void paintEvent(QPaintEvent *event)
Handle the paint event.
Definition: cLinearWidget.cpp:162
void exportToPDF(QString filename, bool postscript)
Export peptide into a PDF or a PS file.
Definition: cLinearWidget.cpp:78
void exportToSVG(QString filename)
Export peptide scene into a SVG file.
Definition: cLinearWidget.cpp:129
void setReportIsomers(bool reportisomers)
Set the report isomers state.
Definition: cLinearWidget.cpp:150
void hidePeakLabels(bool state)
Hide/Show labels of peaks.
Definition: cLinearWidget.cpp:156
cLinearWidget()
The constructor.
Definition: cLinearWidget.cpp:60
void exportToPNG(QString filename)
Export peptide scene into a PNG file.
Definition: cLinearWidget.cpp:109
The class storing parameters of the application.
Definition: cParameters.h:82
The class representing a theoretical mass spectrum.
Definition: cTheoreticalSpectrum.h:106
Auxiliary structure for visualization of labels of fragment ions.
Definition: cLinearWidget.h:22
cIonLabel()
The constructor.
Definition: cLinearWidget.h:51
int y
y coordinate.
Definition: cLinearWidget.h:33
void clear()
Clear the structure.
Definition: cLinearWidget.h:59
set< string > labelset
Set of labels to be merged.
Definition: cLinearWidget.h:39
int x
x coordinate.
Definition: cLinearWidget.h:27
bool alignright
True when the label is aligned right.
Definition: cLinearWidget.h:45
The structure defining a hash function of cIonLabel.
Definition: cLinearWidget.h:72
size_t operator()(const cIonLabel &label) const
Hash a ion label.
Definition: cLinearWidget.h:79