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_SPECTRUM1DCANVAS_H
00028 #define OPENMS_VISUAL_SPECTRUM1DCANVAS_H
00029
00030
00031 #include <vector>
00032
00033
00034 #include <OpenMS/VISUAL/SpectrumCanvas.h>
00035
00036
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,
00076 DM_CONNECTEDLINES
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
00099 virtual void showCurrentLayerPreferences();
00100
00101
00102 virtual void saveCurrentLayer(bool visible);
00103
00104 public slots:
00105
00106 void activateLayer(int layer_index);
00107
00108 void removeLayer(int layer_index);
00109
00110 Int finishAdding();
00111
00118 void setVisibleArea(DRange<2> range);
00119
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
00144 virtual void currentLayerParamtersChanged_();
00145
00146 virtual void recalculateSnapFactor_();
00147
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 }
00175
00176 #endif