Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Spectrum3DOpenGLCanvas.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: Cornelia Friedle $
33 // --------------------------------------------------------------------------
34 
35 #pragma once
36 
37 // OpenMS_GUI config
38 #include <OpenMS/VISUAL/OpenMS_GUIConfig.h>
39 
40 #include <QOpenGLWidget>
41 
42 // OpenMS
44 
45 namespace OpenMS
46 {
47  class Spectrum3DCanvas;
48 
57  class OPENMS_GUI_DLLAPI Spectrum3DOpenGLCanvas :
58  public QOpenGLWidget
59  {
60  Q_OBJECT
61 
62  friend class Spectrum3DCanvas;
63 
64 public:
65 
67  typedef std::vector<std::vector<double> > AxisTickVector;
68 
75  Spectrum3DOpenGLCanvas(QWidget * parent, Spectrum3DCanvas & canvas_3d);
81  virtual ~Spectrum3DOpenGLCanvas();
82 
84  void initializeGL() override;
86  void resizeGL(int w, int h) override;
88  void paintGL() override;
89 
92  void mouseMoveEvent(QMouseEvent * e) override;
93  void mouseReleaseEvent(QMouseEvent * e) override;
94  void mousePressEvent(QMouseEvent * e) override;
95  void focusOutEvent(QFocusEvent * e) override;
97 
99  void updateIntensityScale();
100 protected:
102  GLint project_(GLdouble objx, GLdouble objy, GLdouble objz, GLdouble * winx, GLdouble * winy);
104  void transformPoint_(GLdouble out[4], const GLdouble m[16], const GLdouble in[4]);
106  void renderText_(double x, double y, double z, const QString & text);
108  void qglColor_(QColor color);
110  void qglClearColor_(QColor clearColor);
112  GLuint makeDataAsStick_();
114  GLuint makeAxes_();
116  GLuint makeAxesTicks_();
118  GLuint makeDataAsTopView_();
120  GLuint makeGround_();
122  GLuint makeGridLines_();
124  void drawAxesLegend_();
125 
127  void computeSelection_();
128 
130  void dataToZoomArray_(double x_1, double y_1, double x_2, double y_2);
131 
133  double scaledRT_(double rt);
135  double scaledInversRT_(double mz);
137  double scaledMZ_(double mz);
139  double scaledInversMZ_(double mz);
141  double scaledIntensity_(float intensity, Size layer_index);
142 
144  void recalculateDotGradient_(Size layer);
146  void calculateGridLines_();
147 
149  void normalizeAngle(int * angle);
150  // set translation vector to 0
151  void resetTranslation();
152  //document me
153  void timeMessure();
154 
156  void storeRotationAndZoom();
158  void restoreRotationAndZoom();
159 
162  GLuint stickdata_;
163  GLuint axes_;
164  GLuint axes_ticks_;
165  GLuint gridlines_;
166  GLuint ground_;
168 
171 
173  int xrot_;
175  int yrot_;
177  int zrot_;
178 
185 
186  QPainter* painter_ = nullptr;
187 
189  QPoint mouse_move_end_, mouse_move_begin_;
190 
192  double corner_;
194  double zoom_;
196  double zoom_tmp_;
197 
199  double near_;
201  double far_;
203  float width_;
205  float height_;
217  double x_1_;
219  double x_2_;
221  double y_1_;
223  double y_2_;
225  double trans_x_;
227  double trans_y_;
228 
229 protected slots:
231  void actionModeChange();
232  };
233 }
OpenGL Canvas for 3D-visualization of map data.
Definition: Spectrum3DOpenGLCanvas.h:57
double near_
member variable for the z- axis of the BB
Definition: Spectrum3DOpenGLCanvas.h:199
double x_1_
x1 coordinate of the zoomselection
Definition: Spectrum3DOpenGLCanvas.h:217
std::vector< std::vector< double > > AxisTickVector
Container for axis ticks.
Definition: Spectrum3DOpenGLCanvas.h:67
float width_
the width of the viewport
Definition: Spectrum3DOpenGLCanvas.h:203
double x_2_
x2 coordinate of the zoomselection
Definition: Spectrum3DOpenGLCanvas.h:219
DRange< 1 > int_scale_
object which contains the values of the current min and max intensity
Definition: Spectrum3DOpenGLCanvas.h:209
double trans_y_
y_translation
Definition: Spectrum3DOpenGLCanvas.h:227
int yrot_
member y-variables for the rotation
Definition: Spectrum3DOpenGLCanvas.h:175
double far_
member variable for the z- axis of the BB
Definition: Spectrum3DOpenGLCanvas.h:201
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
double y_1_
y1 coordinate of the zoomselection
Definition: Spectrum3DOpenGLCanvas.h:221
AxisTickVector grid_rt_
member gridvectors which contains the data for the rt-axis-ticks
Definition: Spectrum3DOpenGLCanvas.h:213
double zoom_tmp_
member variable that stores original zoom factor during zoom mode
Definition: Spectrum3DOpenGLCanvas.h:196
GLuint axes_
Definition: Spectrum3DOpenGLCanvas.h:163
double zoom_
member variable for the zoom mode
Definition: Spectrum3DOpenGLCanvas.h:194
AxisTickVector grid_mz_
member gridvectors which contains the data for the mz-axis-ticks
Definition: Spectrum3DOpenGLCanvas.h:211
GLuint axes_ticks_
Definition: Spectrum3DOpenGLCanvas.h:164
double corner_
member variable for the x and y axis of the BB
Definition: Spectrum3DOpenGLCanvas.h:192
AxisTickVector grid_intensity_
member gridvectors which contains the data for the intensity-axis-ticks
Definition: Spectrum3DOpenGLCanvas.h:215
int zrot_tmp_
member z-variable that stores the original angle during zoom mode
Definition: Spectrum3DOpenGLCanvas.h:184
const double h
double y_2_
y2 coordinate of the zoomselection
Definition: Spectrum3DOpenGLCanvas.h:223
float height_
the height of the viewport
Definition: Spectrum3DOpenGLCanvas.h:205
int yrot_tmp_
member y-variable that stores the original angle during zoom mode
Definition: Spectrum3DOpenGLCanvas.h:182
int xrot_
member x-variables for the rotation
Definition: Spectrum3DOpenGLCanvas.h:173
DRange< 3 > overall_values_
object which contains the min and max values of mz, rt and intensity
Definition: Spectrum3DOpenGLCanvas.h:207
GLuint stickdata_
Definition: Spectrum3DOpenGLCanvas.h:162
QPoint mouse_move_end_
member variables for the zoom-mode
Definition: Spectrum3DOpenGLCanvas.h:189
Canvas for 3D-visualization of peak map data.
Definition: Spectrum3DCanvas.h:66
GLuint ground_
Definition: Spectrum3DOpenGLCanvas.h:166
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Spectrum3DCanvas & canvas_3d_
reference to Spectrum3DCanvas
Definition: Spectrum3DOpenGLCanvas.h:170
double trans_x_
x- translation
Definition: Spectrum3DOpenGLCanvas.h:225
GLuint gridlines_
Definition: Spectrum3DOpenGLCanvas.h:165
int xrot_tmp_
member x-variable that stores the original angle during zoom mode
Definition: Spectrum3DOpenGLCanvas.h:180
int zrot_
member z-variables for the rotation
Definition: Spectrum3DOpenGLCanvas.h:177

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