Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

Spectrum3DOpenGLCanvas.h

Go to the documentation of this file.
00001 // --------------------------------------------------------------------------
00002 //                   OpenMS -- Open-Source Mass Spectrometry
00003 // --------------------------------------------------------------------------
00004 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
00005 // ETH Zurich, and Freie Universitaet Berlin 2002-2012.
00006 //
00007 // This software is released under a three-clause BSD license:
00008 //  * Redistributions of source code must retain the above copyright
00009 //    notice, this list of conditions and the following disclaimer.
00010 //  * Redistributions in binary form must reproduce the above copyright
00011 //    notice, this list of conditions and the following disclaimer in the
00012 //    documentation and/or other materials provided with the distribution.
00013 //  * Neither the name of any author or any participating institution
00014 //    may be used to endorse or promote products derived from this software
00015 //    without specific prior written permission.
00016 // For a full list of authors, refer to the file AUTHORS.
00017 // --------------------------------------------------------------------------
00018 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00019 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00020 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00021 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
00022 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00023 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00024 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00025 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00026 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00027 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00028 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029 //
00030 // --------------------------------------------------------------------------
00031 // $Maintainer: Timo Sachsenberg $
00032 // $Authors: Cornelia Friedle $
00033 // --------------------------------------------------------------------------
00034 
00035 #ifndef OPENMS_VISUAL_SPECTRUM3DOPENGLCANVAS_H
00036 #define OPENMS_VISUAL_SPECTRUM3DOPENGLCANVAS_H
00037 
00038 #include <QtOpenGL/QGLWidget>
00039 
00040 // OpenMS
00041 #include <OpenMS/DATASTRUCTURES/DRange.h>
00042 
00043 namespace OpenMS
00044 {
00045   class Spectrum3DCanvas;
00046 
00055   class OPENMS_GUI_DLLAPI Spectrum3DOpenGLCanvas :
00056     public QGLWidget
00057   {
00058     Q_OBJECT
00059 
00060     friend class Spectrum3DCanvas;
00061 
00062 public:
00063 
00065     typedef std::vector<std::vector<double> > AxisTickVector;
00066 
00073     Spectrum3DOpenGLCanvas(QWidget * parent, Spectrum3DCanvas & canvas_3d);
00079     virtual ~Spectrum3DOpenGLCanvas();
00081     void initializeGL();
00083     void resizeGL(int w, int h);
00085     void paintGL();
00087     GLuint makeDataAsStick();
00089     GLuint makeAxes();
00091     GLuint makeAxesTicks();
00093     GLuint makeDataAsTopView();
00095     GLuint makeGround();
00097     GLuint makeGridLines();
00099     void drawAxesLegend();
00100 
00103     void mouseMoveEvent(QMouseEvent * e);
00104     void mouseReleaseEvent(QMouseEvent * e);
00105     void mousePressEvent(QMouseEvent * e);
00106     void focusOutEvent(QFocusEvent * e);
00108 
00110     void computeSelection();
00111 
00113     void updateIntensityScale();
00114 
00116     void dataToZoomArray(double x_1, double y_1, double x_2, double y_2);
00117 
00119     double scaledRT(double rt);
00121     double scaledInversRT(double mz);
00123     double scaledMZ(double mz);
00125     double scaledInversMZ(double mz);
00127     double scaledIntensity(Real intensity, Size layer_index);
00128 
00130     void recalculateDotGradient_(Size layer);
00132     void calculateGridLines_();
00133 
00135     float width() const { return width_; }
00136     float height() const { return heigth_; }
00137 
00139     int xRotation() const { return xrot_; }
00141     int yRotation() const { return yrot_; }
00143     int zRotation() const { return zrot_; }
00145     void normalizeAngle(int * angle);
00146     //document me
00147     void setAngels(int xrot, int yrot, int zrot);
00148     //document me
00149     void resetTranslation();
00150     //document me
00151     void timeMessure();
00152 
00154     void storeRotationAndZoom();
00156     void restoreRotationAndZoom();
00157 
00160     GLuint stickdata_;
00161     GLuint axes_;
00162     GLuint axes_ticks_;
00163     GLuint gridlines_;
00164     GLuint ground_;
00166 
00168     Spectrum3DCanvas & canvas_3d_;
00169 
00171     int xrot_;
00173     int yrot_;
00175     int zrot_;
00176 
00178     int xrot_tmp_;
00180     int yrot_tmp_;
00182     int zrot_tmp_;
00183 
00184 
00185 
00187     QPoint mouse_move_end_, mouse_move_begin_;
00188 
00190     double corner_;
00192     double zoom_;
00194     double zoom_tmp_;
00195 
00197     double near_;
00199     double far_;
00201     float width_;
00203     float heigth_;
00205     DRange<3> overall_values_;
00207     DRange<1> int_scale_;
00209     AxisTickVector grid_mz_;
00211     AxisTickVector grid_rt_;
00213     AxisTickVector grid_intensity_;
00215     double x_1_;
00217     double x_2_;
00219     double y_1_;
00221     double y_2_;
00223     double trans_x_;
00225     double trans_y_;
00226 
00227 protected slots:
00229     void actionModeChange();
00230   };
00231 }
00232 #endif

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:44 using doxygen 1.7.1