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

Spectrum1DCanvas.h (Maintainer: Marc Sturm)

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // --------------------------------------------------------------------------
00005 //                   OpenMS Mass Spectrometry Framework 
00006 // --------------------------------------------------------------------------
00007 //  Copyright (C) 2003-2008 -- Oliver Kohlbacher, Knut Reinert
00008 //
00009 //  This library is free software; you can redistribute it and/or
00010 //  modify it under the terms of the GNU Lesser General Public
00011 //  License as published by the Free Software Foundation; either
00012 //  version 2.1 of the License, or (at your option) any later version.
00013 //
00014 //  This library is distributed in the hope that it will be useful,
00015 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 //  Lesser General Public License for more details.
00018 //
00019 //  You should have received a copy of the GNU Lesser General Public
00020 //  License along with this library; if not, write to the Free Software
00021 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 //
00023 // --------------------------------------------------------------------------
00024 // $Maintainer: Marc Sturm $
00025 // --------------------------------------------------------------------------
00026 
00027 #ifndef OPENMS_VISUAL_SPECTRUM1DCANVAS_H
00028 #define OPENMS_VISUAL_SPECTRUM1DCANVAS_H
00029 
00030 // STL
00031 #include <vector>
00032 
00033 // OpenMS
00034 #include <OpenMS/VISUAL/SpectrumCanvas.h>
00035 
00036 //QT
00037 class QAction;
00038 
00039 namespace OpenMS
00040 {
00052   class Spectrum1DCanvas 
00053     : public SpectrumCanvas
00054   {
00055     Q_OBJECT
00056     
00057     public:
00059       enum LabelMode
00060       {
00061         LM_XABSOLUTE_YABSOLUTE,
00062         LM_XPERCENT_YABSOLUTE,
00063         LM_XABSOLUTE_YPERCENT,
00064         LM_XPERCENT_YPERCENT
00065       };
00066       
00068       Spectrum1DCanvas(const Param& preferences, QWidget* parent = 0);
00070       virtual ~Spectrum1DCanvas();
00071     
00073       enum DrawModes 
00074       {
00075         DM_PEAKS,           //< draw data as peak
00076         DM_CONNECTEDLINES   //< draw as connected lines
00077       };
00078   
00080       inline void setPeakIcon(unsigned int index, unsigned int icon) 
00081       { 
00082         currentPeakData_()[0].getContainer()[index].setMetaValue(UInt(4),Int(icon)); 
00083       }
00084   
00090       std::vector<SpectrumIteratorType> getSelectedPeaks();
00091       
00093       DrawModes getDrawMode() const;
00094   
00096       void setDrawMode(DrawModes mode);
00097   
00098       // Docu in base class
00099       virtual void showCurrentLayerPreferences();
00100 
00101       // Docu in base class
00102       virtual void saveCurrentLayer(bool visible);
00103   
00104     public slots:
00105       // Docu in base class
00106       void activateLayer(int layer_index);
00107       // Docu in base class
00108       void removeLayer(int layer_index);
00109       // Docu in base class
00110       Int finishAdding();
00111       
00118       void setVisibleArea(DRange<2> range); //Do not change this to AreaType the signal needs QT needs the exact type...
00119       // Docu in base class
00120       virtual void horizontalScrollBarChange(int value);
00121     
00122     protected:
00128       void changeVisibleArea_(double lo, double hi, bool add_to_stack = false);  
00129       
00131       void dataToWidget_(const PeakType& peak, QPoint& point);
00132       
00142       virtual void changeVisibleArea_(const AreaType& new_area, bool add_to_stack = false);
00143       // Docu in base class
00144       virtual void currentLayerParamtersChanged_();
00145       // Docu in base class
00146       virtual void recalculateSnapFactor_();
00147       // Docu in base class
00148       virtual void updateScrollbars_();
00149       
00151       std::vector<SpectrumIteratorType> selected_peaks_;
00152   
00154       std::vector<DrawModes> draw_modes_; 
00156       SpectrumIteratorType selected_peak_;
00158       SpectrumIteratorType findPeakAtPosition_(QPoint);  
00159   
00162       void paintEvent(QPaintEvent* e);
00163       void mousePressEvent(QMouseEvent* e);
00164       void mouseDoubleClickEvent(QMouseEvent* e);
00165       void mouseReleaseEvent(QMouseEvent* e);
00166       void mouseMoveEvent(QMouseEvent* e);
00167       void wheelEvent(QWheelEvent* e);
00168       void contextMenuEvent(QContextMenuEvent* e);
00170       
00171       bool draw_metainfo_;
00172 
00173   };
00174 } // namespace OpenMS
00175 
00176 #endif

Generated Tue Apr 1 15:36:38 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1