| OpenMS 2.5.0

SpectrumWidget.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2020.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Timo Sachsenberg $
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34
35 #pragma once
36
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39
40 //OpenMS
41 #include <OpenMS/CONCEPT/Types.h>
42 #include <OpenMS/MATH/STATISTICS/Histogram.h>
43 #include <OpenMS/VISUAL/SpectrumCanvas.h>
44 #include <OpenMS/VISUAL/EnhancedTabBarWidgetInterface.h>
45
46 class QGridLayout;
47 class QScrollBar;
48 class QCloseEvent;
49 class QMimeData;
50
51 namespace OpenMS
52 {
53
54 class AxisWidget;
55
80 class OPENMS_GUI_DLLAPI SpectrumWidget :
81 public QWidget,
82 public EnhancedTabBarWidgetInterface
83 {
84 Q_OBJECT
85
86 public:
87 static const char RT_AXIS_TITLE[];
88 static const char MZ_AXIS_TITLE[];
89 static const char INTENSITY_AXIS_TITLE[];
90 static const char IM_MS_AXIS_TITLE[];
91 static const char IM_ONEKZERO_AXIS_TITLE[];
92
95
97 typedef LayerData::ExperimentType ExperimentType;
99 typedef LayerData::FeatureMapType FeatureMapType;
101 typedef ExperimentType::SpectrumType SpectrumType;
103
105 SpectrumWidget(const Param & preferences, QWidget * parent = nullptr);
107 ~SpectrumWidget() override;
108
115 SpectrumCanvas * canvas()
116 {
117 return canvas_;
118 }
119
120 SpectrumCanvas * canvas() const
121 {
122 return canvas_;
123 }
124
126 virtual inline AxisWidget * xAxis()
127 {
128 return x_axis_;
129 }
130
132 virtual inline AxisWidget * yAxis()
133 {
134 return y_axis_;
135 }
136
138 Int getActionMode() const;
139
141 virtual bool isLegendShown() const;
142
144 virtual void showLegend(bool show);
145
147 void setIntensityMode(SpectrumCanvas::IntensityModes mode);
148
150 virtual void hideAxes();
151
153 virtual void saveAsImage();
154
156 Int getWindowId() override;
157
159 void setWindowId(Int window_id) override;
160
161 signals:
163 void sendStatusMessage(std::string, OpenMS::UInt);
165 void sendCursorStatus(double mz = -1.0, double rt = -1.0);
167 void aboutToBeDestroyed(int window_id);
169 void openPreferences();
171 void dropReceived(const QMimeData * data, QWidget * source, int id);
172
173 public slots:
175 void showStatistics();
177 void showIntensityDistribution();
179 void showMetaDistribution(const String & name);
181 void updateAxes();
190 void updateHScrollbar(float min, float disp_min, float disp_max, float max);
199 void updateVScrollbar(float min, float disp_min, float disp_max, float max);
201 virtual void showGoToDialog() = 0;
203 void changeLegendVisibility();
204
205 protected:
207
208 void closeEvent(QCloseEvent * e) override;
210
217 void setCanvas_(SpectrumCanvas * canvas, UInt row = 0, UInt col = 2);
219 virtual void intensityModeChange_();
221 virtual Math::Histogram<> createIntensityDistribution_() const = 0;
223 virtual Math::Histogram<> createMetaDistribution_(const String & name) const = 0;
225 virtual void recalculateAxes_() = 0;
227 void correctAreaToObeyMinMaxRanges_(SpectrumCanvas::AreaType& area);
228
230
231 void dragEnterEvent(QDragEnterEvent * event) override;
232 void dragMoveEvent(QDragMoveEvent * event) override;
233 void dropEvent(QDropEvent * event) override;
235
237 SpectrumCanvas * canvas_;
239 QGridLayout * grid_;
241 AxisWidget * y_axis_;
243 AxisWidget * x_axis_;
245 QScrollBar * x_scrollbar_;
247 QScrollBar * y_scrollbar_;
248
249 Int window_id_;
250 };
251 }
252
EnhancedTabBarWidgetInterface.h
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::SpectrumWidget::x_axis_
AxisWidget * x_axis_
Horizontal axis.
Definition: SpectrumWidget.h:243
QWidget
OpenMS::SpectrumWidget::canvas_
SpectrumCanvas * canvas_
Pointer to the canvas widget.
Definition: SpectrumWidget.h:237
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS::SpectrumWidget
Base class for spectrum widgets.
Definition: SpectrumWidget.h:80
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:95
OpenMS::SpectrumWidget::window_id_
Int window_id_
Definition: SpectrumWidget.h:249
Types.h
OpenMS::AxisWidget
Widget that represents an axis of a graph.
Definition: AxisWidget.h:63
OpenMS::SpectrumCanvas
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:98
OpenMS::EnhancedTabBarWidgetInterface
Widgets that are placed into an EnhancedTabBar must implement this interface.
Definition: EnhancedTabBarWidgetInterface.h:51
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
OpenMS::SpectrumCanvas::IntensityModes
IntensityModes
Display modes of intensity.
Definition: SpectrumCanvas.h:147
OpenMS::SpectrumWidget::yAxis
virtual AxisWidget * yAxis()
Returns a pointer to the y-axis axis widget.
Definition: SpectrumWidget.h:132
OpenMS::SpectrumWidget::canvas
SpectrumCanvas * canvas()
Returns a pointer to canvas object.
Definition: SpectrumWidget.h:115
OpenMS::SpectrumWidget::FeatureMapType
LayerData::FeatureMapType FeatureMapType
Main data type (features)
Definition: SpectrumWidget.h:99
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
OpenMS::DRange< 2 >
OpenMS::SpectrumWidget::x_scrollbar_
QScrollBar * x_scrollbar_
Horizontal scrollbar.
Definition: SpectrumWidget.h:245
SpectrumCanvas.h
OpenMS::SpectrumWidget::SpectrumType
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: SpectrumWidget.h:101
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::Math::Histogram
Representation of a histogram.
Definition: Histogram.h:63
OpenMS::SpectrumWidget::grid_
QGridLayout * grid_
Main layout.
Definition: SpectrumWidget.h:239
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:73
OpenMS::SpectrumWidget::canvas
SpectrumCanvas * canvas() const
Definition: SpectrumWidget.h:120
int
OpenMS::SpectrumWidget::ExperimentType
LayerData::ExperimentType ExperimentType
Main data type (experiment)
Definition: SpectrumWidget.h:97
OpenMS::SpectrumWidget::y_axis_
AxisWidget * y_axis_
Vertical axis.
Definition: SpectrumWidget.h:241
OpenMS::SpectrumWidget::y_scrollbar_
QScrollBar * y_scrollbar_
Vertical scrollbar.
Definition: SpectrumWidget.h:247
OpenMS::SpectrumWidget::xAxis
virtual AxisWidget * xAxis()
Returns a pointer to the x-axis axis widget.
Definition: SpectrumWidget.h:126
Histogram.h