OpenMS  3.0.0
PlotWidget.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-2022.
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>
45 
46 class QCloseEvent;
47 class QGridLayout;
48 class QMimeData;
49 class QScrollBar;
50 
51 namespace OpenMS
52 {
53 
54  class AxisWidget;
55 
80  class OPENMS_GUI_DLLAPI PlotWidget :
81  public QWidget,
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 
103 
105  PlotWidget(const Param & preferences, QWidget * parent = nullptr);
107  ~PlotWidget() override;
108 
116  {
117  return canvas_;
118  }
119 
120  PlotCanvas * 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(PlotCanvas::IntensityModes mode);
148 
150  virtual void hideAxes();
151 
153  virtual void saveAsImage();
154 
155 signals:
157  void sendStatusMessage(std::string, OpenMS::UInt);
159  void sendCursorStatus(double mz = -1.0, double rt = -1.0);
161  void aboutToBeDestroyed(int window_id);
163  void openPreferences();
165  void dropReceived(const QMimeData * data, QWidget * source, int id);
166 
167 public slots:
169  void showStatistics();
171  void showIntensityDistribution(const Math::Histogram<>& dist);
173  void showMetaDistribution(const String& name, const Math::Histogram<>& dist);
175  void updateAxes();
184  void updateHScrollbar(float min, float disp_min, float disp_max, float max);
193  void updateVScrollbar(float min, float disp_min, float disp_max, float max);
195  virtual void showGoToDialog() = 0;
197  void changeLegendVisibility();
198 
199 protected:
201 
202  void closeEvent(QCloseEvent * e) override;
204 
211  void setCanvas_(PlotCanvas * canvas, UInt row = 0, UInt col = 2);
213  virtual void intensityModeChange_();
215  virtual void recalculateAxes_() = 0;
217  void correctAreaToObeyMinMaxRanges_(PlotCanvas::AreaType& area);
218 
220 
221  void dragEnterEvent(QDragEnterEvent * event) override;
222  void dragMoveEvent(QDragMoveEvent * event) override;
223  void dropEvent(QDropEvent * event) override;
225  void paintEvent(QPaintEvent * /*event*/) override;
227 
231  QGridLayout * grid_;
237  QScrollBar * x_scrollbar_;
239  QScrollBar * y_scrollbar_;
240  };
241 }
242 
EnhancedTabBarWidgetInterface.h
OpenMS::PlotCanvas::IntensityModes
IntensityModes
Display modes of intensity.
Definition: PlotCanvas.h:184
OpenMS::EnhancedTabBarWidgetInterface
Widgets that are placed into an EnhancedTabBar must implement this interface.
Definition: EnhancedTabBarWidgetInterface.h:84
OpenMS::PlotWidget
Base class for spectrum widgets.
Definition: PlotWidget.h:80
Types.h
OpenMS::PlotWidget::xAxis
virtual AxisWidget * xAxis()
Returns a pointer to the x-axis axis widget.
Definition: PlotWidget.h:126
OpenMS::String
A more convenient string class.
Definition: String.h:58
OpenMS::PlotWidget::canvas_
PlotCanvas * canvas_
Pointer to the canvas widget.
Definition: PlotWidget.h:229
OpenMS::DRange< 2 >
OpenMS::PlotWidget::SpectrumType
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: PlotWidget.h:101
OpenMS::MSExperiment
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
OpenMS::PlotWidget::ExperimentType
LayerDataBase::ExperimentType ExperimentType
Main data type (experiment)
Definition: PlotWidget.h:97
OpenMS::PlotWidget::canvas
PlotCanvas * canvas()
Returns a pointer to canvas object.
Definition: PlotWidget.h:115
OpenMS::PlotWidget::x_axis_
AxisWidget * x_axis_
Horizontal axis.
Definition: PlotWidget.h:235
OpenMS::PlotWidget::FeatureMapType
LayerDataBase::FeatureMapType FeatureMapType
Main data type (features)
Definition: PlotWidget.h:99
QWidget
PlotCanvas.h
OpenMS::Int
int Int
Signed integer type.
Definition: Types.h:102
OpenMS
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
OpenMS::PlotCanvas
Base class for visualization canvas classes.
Definition: PlotCanvas.h:135
OpenMS::Math::Histogram
Representation of a histogram.
Definition: Histogram.h:63
OpenMS::PlotWidget::canvas
PlotCanvas * canvas() const
Definition: PlotWidget.h:120
OpenMS::AxisWidget
Widget that represents an axis of a graph.
Definition: AxisWidget.h:63
OpenMS::UInt
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
OpenMS::PlotWidget::yAxis
virtual AxisWidget * yAxis()
Returns a pointer to the y-axis axis widget.
Definition: PlotWidget.h:132
Histogram.h
OpenMS::PlotWidget::y_axis_
AxisWidget * y_axis_
Vertical axis.
Definition: PlotWidget.h:233
OpenMS::FeatureMap
A container for features.
Definition: FeatureMap.h:98
OpenMS::PlotWidget::y_scrollbar_
QScrollBar * y_scrollbar_
Vertical scrollbar.
Definition: PlotWidget.h:239
OpenMS::PlotWidget::x_scrollbar_
QScrollBar * x_scrollbar_
Horizontal scrollbar.
Definition: PlotWidget.h:237
OpenMS::Param
Management and storage of parameters / INI files.
Definition: Param.h:69
OpenMS::MSSpectrum
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
OpenMS::PlotWidget::grid_
QGridLayout * grid_
Main layout.
Definition: PlotWidget.h:231