Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
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-2017.
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 QGridLayout;
47 class QScrollBar;
48 class QCloseEvent;
49 class QMimeData;
50 
51 namespace OpenMS
52 {
53 
54  class AxisWidget;
55 
73  class OPENMS_GUI_DLLAPI SpectrumWidget :
74  public QWidget,
76  {
77  Q_OBJECT
78 
79 public:
82 
90 
92  SpectrumWidget(const Param & preferences, QWidget * parent = nullptr);
94  ~SpectrumWidget() override;
95 
103  {
104  return canvas_;
105  }
106 
108  {
109  return canvas_;
110  }
111 
113  virtual inline AxisWidget * xAxis()
114  {
115  return x_axis_;
116  }
117 
119  virtual inline AxisWidget * yAxis()
120  {
121  return y_axis_;
122  }
123 
125  Int getActionMode() const;
126 
128  virtual bool isLegendShown() const;
129 
131  virtual void showLegend(bool show);
132 
134  void setIntensityMode(SpectrumCanvas::IntensityModes mode);
135 
137  virtual void hideAxes();
138 
140  virtual void saveAsImage();
141 
143  Int getWindowId() override;
144 
146  void setWindowId(Int window_id) override;
147 signals:
149  void sendStatusMessage(std::string, OpenMS::UInt);
151  void sendCursorStatus(double mz = -1.0, double rt = -1.0);
153  void aboutToBeDestroyed(int window_id);
155  void openPreferences();
157  void dropReceived(const QMimeData * data, QWidget * source, int id);
158 
159 public slots:
161  void showStatistics();
163  void showIntensityDistribution();
165  void showMetaDistribution(const String & name);
167  void updateAxes();
176  void updateHScrollbar(float min, float disp_min, float disp_max, float max);
185  void updateVScrollbar(float min, float disp_min, float disp_max, float max);
187  virtual void showGoToDialog() = 0;
189  void changeLegendVisibility();
190 
191 protected:
193 
194  void closeEvent(QCloseEvent * e) override;
196 
203  void setCanvas_(SpectrumCanvas * canvas, UInt row = 0, UInt col = 2);
205  virtual void intensityModeChange_();
207  virtual Math::Histogram<> createIntensityDistribution_() const = 0;
209  virtual Math::Histogram<> createMetaDistribution_(const String & name) const = 0;
211  virtual void recalculateAxes_() = 0;
213  void correctAreaToObeyMinMaxRanges_(SpectrumCanvas::AreaType& area);
214 
216 
217  void dragEnterEvent(QDragEnterEvent * event) override;
218  void dragMoveEvent(QDragMoveEvent * event) override;
219  void dropEvent(QDropEvent * event) override;
221 
225  QGridLayout * grid_;
231  QScrollBar * x_scrollbar_;
233  QScrollBar * y_scrollbar_;
234 
236  };
237 }
238 
SpectrumCanvas * canvas()
Returns a pointer to canvas object.
Definition: SpectrumWidget.h:102
A more convenient string class.
Definition: String.h:57
Widget that represents an axis of a graph.
Definition: AxisWidget.h:63
virtual AxisWidget * yAxis()
Returns a pointer to the y-axis axis widget.
Definition: SpectrumWidget.h:119
A container for features.
Definition: FeatureMap.h:93
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
Base class for visualization canvas classes.
Definition: SpectrumCanvas.h:96
QGridLayout * grid_
Main layout.
Definition: SpectrumWidget.h:225
virtual AxisWidget * xAxis()
Returns a pointer to the x-axis axis widget.
Definition: SpectrumWidget.h:113
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
SpectrumCanvas * canvas() const
Definition: SpectrumWidget.h:107
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
AxisWidget * x_axis_
Horizontal axis.
Definition: SpectrumWidget.h:229
QScrollBar * y_scrollbar_
Vertical scrollbar.
Definition: SpectrumWidget.h:233
Base class for spectrum widgets.
Definition: SpectrumWidget.h:73
Representation of a histogram.
Definition: Histogram.h:63
LayerData::ExperimentType ExperimentType
Main data type (experiment)
Definition: SpectrumWidget.h:84
Int window_id_
Definition: SpectrumWidget.h:235
ExperimentType::SpectrumType SpectrumType
Spectrum type.
Definition: SpectrumWidget.h:88
LayerData::FeatureMapType FeatureMapType
Main data type (features)
Definition: SpectrumWidget.h:86
SpectrumCanvas * canvas_
Pointer to the canvas widget.
Definition: SpectrumWidget.h:223
Management and storage of parameters / INI files.
Definition: Param.h:74
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
Widgets that are placed into an EnhancedTabBar must implement this interface.
Definition: EnhancedTabBarWidgetInterface.h:51
AxisWidget * y_axis_
Vertical axis.
Definition: SpectrumWidget.h:227
IntensityModes
Display modes of intensity.
Definition: SpectrumCanvas.h:143
int Int
Signed integer type.
Definition: Types.h:102
QScrollBar * x_scrollbar_
Horizontal scrollbar.
Definition: SpectrumWidget.h:231

OpenMS / TOPP release 2.3.0 Documentation generated on Wed Apr 18 2018 19:29:08 using doxygen 1.8.14