00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OPENMS_VISUAL_SPECTRUM3DOPENGLCANVAS_H
00028 #define OPENMS_VISUAL_SPECTRUM3DOPENGLCANVAS_H
00029
00030 #include <QtOpenGL/QGLWidget>
00031
00032
00033 #include <OpenMS/VISUAL/MultiGradient.h>
00034 #include <OpenMS/DATASTRUCTURES/DRange.h>
00035 #include <OpenMS/KERNEL/DSpectrum.h>
00036 #include <OpenMS/KERNEL/DPeakArray.h>
00037
00038 namespace OpenMS
00039 {
00040 class Spectrum3DCanvas;
00041
00050 class Spectrum3DOpenGLCanvas
00051 : public QGLWidget
00052 {
00053 Q_OBJECT
00054
00055 friend class Spectrum3DCanvas;
00056
00057 public:
00058
00060 typedef std::vector<std::vector<double> > AxisTickVector;
00061
00068 Spectrum3DOpenGLCanvas(QWidget* parent, Spectrum3DCanvas& canvas_3d);
00074 virtual ~Spectrum3DOpenGLCanvas();
00076 void initializeGL();
00078 void resizeGL(int w,int h);
00080 void paintGL();
00082 GLuint makeDataAsStick();
00084 GLuint makeAxes();
00086 GLuint makeAxesTicks();
00088 GLuint makeDataAsTopView();
00090 GLuint makeGround();
00092 GLuint makeGridLines();
00094 void drawAxesLegend();
00095
00098 void focusOutEvent(QFocusEvent* e);
00099 void mouseMoveEvent(QMouseEvent* e);
00100 void mouseReleaseEvent(QMouseEvent* e);
00101 void mousePressEvent(QMouseEvent* e);
00102 void wheelEvent(QWheelEvent* e);
00103 void keyPressEvent(QKeyEvent* e);
00104 void keyReleaseEvent(QKeyEvent* e);
00106
00108 void computeSelection();
00109
00111 void updateIntensityScale();
00112
00114 void dataToZoomArray(double x_1, double y_1, double x_2, double y_2);
00115
00117 double scaledRT(double rt);
00119 double scaledInversRT(double mz);
00121 double scaledMZ(double mz);
00123 double scaledInversMZ(double mz);
00125 double scaledIntensity(double intensity,int layer_index);
00126
00128 void recalculateDotGradient_(UInt layer);
00130 void calculateGridLines_();
00131
00133 float width() const { return width_; }
00134 float height() const { return heigth_; }
00135
00137 int xRotation() const { return xrot_; }
00139 int yRotation() const { return yrot_; }
00141 int zRotation() const { return zrot_; }
00143 void normalizeAngle(int* angle);
00144
00145 void setAngels(int xrot, int yrot, int zrot);
00146
00147 void resetTranslation();
00148
00149 void timeMessure();
00150
00152 void storeRotationAndZoom();
00154 void restoreRotationAndZoom();
00155
00158 GLuint stickdata_;
00159 GLuint axes_;
00160 GLuint axes_ticks_;
00161 GLuint gridlines_;
00162 GLuint ground_;
00164
00166 Spectrum3DCanvas& canvas_3d_;
00167
00169 int xrot_;
00171 int yrot_;
00173 int zrot_;
00174
00176 int xrot_tmp_;
00178 int yrot_tmp_;
00180 int zrot_tmp_;
00181
00182
00183
00185 QPoint mouse_move_end_, mouse_move_begin_;
00186
00188 double corner_;
00190 double zoom_ ;
00192 double zoom_tmp_;
00193
00195 double near_;
00197 double far_;
00199 float width_;
00201 float heigth_;
00203 DRange<3> overall_values_;
00205 DRange<1> int_scale_;
00207 AxisTickVector grid_mz_;
00209 AxisTickVector grid_rt_;
00211 AxisTickVector grid_intensity_;
00213 double x_1_;
00215 double x_2_;
00217 double y_1_;
00219 double y_2_;
00221 double trans_x_;
00223 double trans_y_;
00224
00226 bool zoom_mode_;
00228 void setZoomFactor(double zoom, bool repaint);
00229 };
00230 }
00231 #endif