OpenMS
Plot3DOpenGLCanvas.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, The OpenMS Team -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Timo Sachsenberg $
6 // $Authors: Cornelia Friedle $
7 // --------------------------------------------------------------------------
8 
9 #pragma once
10 
11 // OpenMS_GUI config
12 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
13 
14 #include <QOpenGLWidget>
15 #include <QOpenGLFunctions_2_0>
16 
17 // OpenMS
19 
20 namespace OpenMS
21 {
22  class Plot3DCanvas;
23  class LayerDataBase;
24 
33  class OPENMS_GUI_DLLAPI Plot3DOpenGLCanvas :
34  public QOpenGLWidget,
35  protected QOpenGLFunctions_2_0
36  {
37  Q_OBJECT
38 
39  friend class Plot3DCanvas;
40 
41 public:
42 
44  typedef std::vector<std::vector<double> > AxisTickVector;
45 
52  Plot3DOpenGLCanvas(QWidget * parent, Plot3DCanvas & canvas_3d);
58  ~Plot3DOpenGLCanvas() override;
59 
61  void initializeGL() override;
63  void resizeGL(int w, int h) override;
65  void paintGL() override;
66 
69  void mouseMoveEvent(QMouseEvent * e) override;
70  void mouseReleaseEvent(QMouseEvent * e) override;
71  void mousePressEvent(QMouseEvent * e) override;
72  void focusOutEvent(QFocusEvent * e) override;
74 
75  void setXLabel(const QString& l) { x_label_ = l; }
76  void setYLabel(const QString& l) { y_label_ = l; }
77  void setZLabel(const QString& l) { z_label_ = l; }
78 
81 protected:
83  GLint project_(GLdouble objx, GLdouble objy, GLdouble objz, GLdouble * winx, GLdouble * winy);
85  void transformPoint_(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]);
87  void renderText_(double x, double y, double z, const QString & text);
89  void qglColor_(const QColor& color);
91  void qglClearColor_(const QColor& clearColor);
93  GLuint makeDataAsStick_();
95  GLuint makeAxes_();
97  GLuint makeAxesTicks_();
101  GLuint makeGround_();
103  GLuint makeGridLines_();
106 
109 
111  void dataToZoomArray_(double x_1, double y_1, double x_2, double y_2);
112 
114  double scaledRT_(double rt);
116  double scaledInversRT_(double mz);
118  double scaledMZ_(double mz);
120  double scaledInversMZ_(double mz);
122  double scaledIntensity_(float intensity, Size layer_index);
123 
128 
130  void normalizeAngle(int* angle);
131  // set translation vector to 0
133 
138 
141  GLuint stickdata_;
142  GLuint axes_;
143  GLuint axes_ticks_;
144  GLuint gridlines_;
145  GLuint ground_;
147 
150 
152  int xrot_;
154  int yrot_;
156  int zrot_;
157 
164 
165  QPainter* painter_ = nullptr;
166 
168  QPoint mouse_move_end_, mouse_move_begin_;
169 
171  double corner_;
173  double zoom_;
175  double zoom_tmp_;
176 
178  double near_;
180  double far_;
182  float width_;
184  float height_;
196  double x_1_;
198  double x_2_;
200  double y_1_;
202  double y_2_;
204  double trans_x_;
206  double trans_y_;
207 
208  QString x_label_;
209  QString y_label_;
210  QString z_label_;
211 
212 protected slots:
215  };
216 }
Class that stores the data for one layer.
Definition: LayerDataBase.h:169
Canvas for 3D-visualization of peak map data.
Definition: Plot3DCanvas.h:42
OpenGL Canvas for 3D-visualization of map data.
Definition: Plot3DOpenGLCanvas.h:36
double far_
member variable for the z- axis of the BB
Definition: Plot3DOpenGLCanvas.h:180
GLuint makeDataAsStick_()
Builds up a display list for the 3D view.
GLint project_(GLdouble objx, GLdouble objy, GLdouble objz, GLdouble *winx, GLdouble *winy)
helper function to project point to device space
void dataToZoomArray_(double x_1, double y_1, double x_2, double y_2)
calculates the zoom area , which is shown
void resizeGL(int w, int h) override
virtual function provided from QGLWidget
GLuint makeAxesTicks_()
Builds up a display list for axis ticks.
double near_
member variable for the z- axis of the BB
Definition: Plot3DOpenGLCanvas.h:178
Plot3DOpenGLCanvas(QWidget *parent, Plot3DCanvas &canvas_3d)
Constructor.
void setXLabel(const QString &l)
Definition: Plot3DOpenGLCanvas.h:75
void setZLabel(const QString &l)
Definition: Plot3DOpenGLCanvas.h:77
double x_2_
x2 coordinate of the zoomselection
Definition: Plot3DOpenGLCanvas.h:198
GLuint makeGridLines_()
Builds up a display list for grid lines.
int xrot_
member x-variables for the rotation
Definition: Plot3DOpenGLCanvas.h:152
void transformPoint_(GLdouble out[4], const GLdouble m[16], const GLdouble in[4])
helper function to transform point using matrix m (homogeneous coordinates)
void mousePressEvent(QMouseEvent *e) override
GLuint makeAxes_()
Builds up a display list for the axes.
GLuint ground_
Definition: Plot3DOpenGLCanvas.h:145
void mouseMoveEvent(QMouseEvent *e) override
int zrot_
member z-variables for the rotation
Definition: Plot3DOpenGLCanvas.h:156
void mouseReleaseEvent(QMouseEvent *e) override
void actionModeChange()
Slot that reacts on action mode changes.
double scaledRT_(double rt)
returns the BB-rt-coordinate : value --> BB-coordinates
int zrot_tmp_
member z-variable that stores the original angle during zoom mode
Definition: Plot3DOpenGLCanvas.h:163
void qglClearColor_(const QColor &clearColor)
helper function to replicate old behaviour of QGLWidget
int yrot_tmp_
member y-variable that stores the original angle during zoom mode
Definition: Plot3DOpenGLCanvas.h:161
AxisTickVector grid_mz_
member gridvectors which contains the data for the mz-axis-ticks
Definition: Plot3DOpenGLCanvas.h:190
void paintGL() override
virtual function provided from QGLWidget
double corner_
member variable for the x and y axis of the BB
Definition: Plot3DOpenGLCanvas.h:171
DRange< 3 > overall_values_
object which contains the min and max values of mz, rt and intensity
Definition: Plot3DOpenGLCanvas.h:186
double y_1_
y1 coordinate of the zoomselection
Definition: Plot3DOpenGLCanvas.h:200
double x_1_
x1 coordinate of the zoomselection
Definition: Plot3DOpenGLCanvas.h:196
~Plot3DOpenGLCanvas() override
Destructor.
void qglColor_(const QColor &color)
helper function to replicate old behaviour of QGLWidget
GLuint makeDataAsTopView_()
Builds up a display list for the birds-eye view.
void renderText_(double x, double y, double z, const QString &text)
helper function to replicate old behaviour of QGLWidget
double zoom_tmp_
member variable that stores original zoom factor during zoom mode
Definition: Plot3DOpenGLCanvas.h:175
void focusOutEvent(QFocusEvent *e) override
double scaledInversRT_(double mz)
returns the rt-value : BB-coordinates --> value
int xrot_tmp_
member x-variable that stores the original angle during zoom mode
Definition: Plot3DOpenGLCanvas.h:159
void storeRotationAndZoom()
stores the original rotation and zoom factor (e.g. before changing into zoom mode)
double trans_y_
y_translation
Definition: Plot3DOpenGLCanvas.h:206
double scaledIntensity_(float intensity, Size layer_index)
returns the BB-intensity -coordinate : values --> BB-coordinates
GLuint axes_
Definition: Plot3DOpenGLCanvas.h:142
QPoint mouse_move_begin_
Definition: Plot3DOpenGLCanvas.h:168
void restoreRotationAndZoom()
restores the original rotation and zoom factor (e.g. before changing into zoom mode)
GLuint makeGround_()
Builds up a display list for the background.
GLuint axes_ticks_
Definition: Plot3DOpenGLCanvas.h:143
GLuint stickdata_
Definition: Plot3DOpenGLCanvas.h:141
AxisTickVector grid_rt_
member gridvectors which contains the data for the rt-axis-ticks
Definition: Plot3DOpenGLCanvas.h:192
double zoom_
member variable for the zoom mode
Definition: Plot3DOpenGLCanvas.h:173
void computeSelection_()
computes the dataset supposed to be drawn when a section has been selected in zoom mode
DRange< 1 > int_scale_
object which contains the values of the current min and max intensity
Definition: Plot3DOpenGLCanvas.h:188
QString x_label_
Definition: Plot3DOpenGLCanvas.h:208
AxisTickVector grid_intensity_
member gridvectors which contains the data for the intensity-axis-ticks
Definition: Plot3DOpenGLCanvas.h:194
void updateIntensityScale()
updates the min and max values of the intensity
double scaledMZ_(double mz)
returns the BB-mz-coordinate : values --> BB-coordinates
float width_
the width of the viewport
Definition: Plot3DOpenGLCanvas.h:182
void normalizeAngle(int *angle)
normalize the angle by "angle % 360*16"
void calculateGridLines_()
calculate the ticks for the gridlines
GLuint gridlines_
Definition: Plot3DOpenGLCanvas.h:144
double y_2_
y2 coordinate of the zoomselection
Definition: Plot3DOpenGLCanvas.h:202
void initializeGL() override
virtual function provided from QGLWidget
Plot3DCanvas & canvas_3d_
reference to Plot3DCanvas
Definition: Plot3DOpenGLCanvas.h:149
double trans_x_
x- translation
Definition: Plot3DOpenGLCanvas.h:204
double scaledInversMZ_(double mz)
returns the mz-value : BB-coordinates --> value
float height_
the height of the viewport
Definition: Plot3DOpenGLCanvas.h:184
QString z_label_
Definition: Plot3DOpenGLCanvas.h:210
void drawAxesLegend_()
Draws the axis texts.
int yrot_
member y-variables for the rotation
Definition: Plot3DOpenGLCanvas.h:154
QString y_label_
Definition: Plot3DOpenGLCanvas.h:209
void setYLabel(const QString &l)
Definition: Plot3DOpenGLCanvas.h:76
std::vector< std::vector< double > > AxisTickVector
Container for axis ticks.
Definition: Plot3DOpenGLCanvas.h:44
void recalculateDotGradient_(LayerDataBase &layer)
recalculates the dot gradient interpolation values.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:97
const double h
Definition: Constants.h:141
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19