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
00028 #ifndef OPENMS_VISUAL_SPECTRUM2DCANVAS_H
00029 #define OPENMS_VISUAL_SPECTRUM2DCANVAS_H
00030
00031
00032 #include <OpenMS/VISUAL/SpectrumCanvas.h>
00033 #include <OpenMS/VISUAL/Spectrum1DCanvas.h>
00034 #include <OpenMS/VISUAL/MultiGradient.h>
00035
00036
00037 class QPainter;
00038 class QMouseEvent;
00039 class QWheelEvent;
00040
00041 namespace OpenMS
00042 {
00056 class Spectrum2DCanvas
00057 : public SpectrumCanvas
00058 {
00059 Q_OBJECT
00060
00061 public:
00063 Spectrum2DCanvas(const Param& preferences, QWidget* parent = 0);
00064
00066 ~Spectrum2DCanvas();
00067
00068
00069 virtual void showCurrentLayerPreferences();
00070
00071
00072 virtual void saveCurrentLayer(bool visible);
00073
00074 signals:
00076 void showProjectionHorizontal(const MSExperiment<>&, Spectrum1DCanvas::DrawModes);
00078 void showProjectionVertical(const MSExperiment<>&, Spectrum1DCanvas::DrawModes);
00080 void showProjectionInfo(int, double, double);
00082 void showCurrentPeaksAs3D();
00084 void showSpectrumAs1D(int index);
00085
00086 public slots:
00087
00088
00089 void activateLayer(int layer_index);
00090
00091 void removeLayer(int layer_index);
00092
00093 Int finishAdding();
00094
00095 virtual void horizontalScrollBarChange(int value);
00096
00097 virtual void verticalScrollBarChange(int value);
00107 void showProjections();
00108
00109 protected:
00112 void mousePressEvent(QMouseEvent* e);
00113 void mouseReleaseEvent(QMouseEvent* e);
00114 void mouseMoveEvent(QMouseEvent* e);
00115 void wheelEvent(QWheelEvent* e);
00116 void mouseDoubleClickEvent(QMouseEvent* e);
00117 void paintEvent(QPaintEvent* e);
00118 void contextMenuEvent(QContextMenuEvent* e);
00120
00121
00122 virtual void updateScrollbars_();
00123
00133 void paintDots_(UInt layer_index, QPainter& p);
00134
00141 void paintTraceConvexHulls_(UInt layer_index, QPainter& p);
00142
00149 void paintFeatureConvexHulls_(UInt layer_index, QPainter& p);
00150
00157 void paintConvexHulls_(const std::vector<ConvexHull2D>& hulls, QPainter& p);
00158
00165 void paintFeaturePairConnections_(UInt layer_index, QPainter& p);
00166
00167
00168 virtual void intensityModeChange_();
00169
00170 virtual void recalculateSnapFactor_();
00171
00172 virtual void currentLayerParamtersChanged_();
00174 void recalculateDotGradient_(UInt layer);
00175
00177 MSExperiment<> projection_mz_;
00179 MSExperiment<> projection_rt_;
00180
00181
00183 float betweenFactor_(float v1, float v2, float val);
00189 inline const QColor& heightColor_(float val, const MultiGradient& gradient)
00190 {
00191 switch (intensity_mode_)
00192 {
00193 case IM_NONE:
00194 return gradient.precalculatedColorAt(val);
00195 break;
00196 case IM_PERCENTAGE:
00197 return gradient.precalculatedColorAt(val*percentage_factor_);
00198 break;
00199 case IM_SNAP:
00200 return gradient.precalculatedColorAt(val*snap_factor_);
00201 break;
00202 default:
00203 throw Exception::NotImplemented(__FILE__, __LINE__, __PRETTY_FUNCTION__);
00204 }
00205 }
00206
00208 void highlightPeak_(QPainter& p, const Feature* peak);
00209
00211 const Feature* findNearestPeak_(const QPoint& pos);
00212
00214 const Feature* selected_peak_;
00216 const Feature* measurement_start_;
00218 const Feature* measurement_stop_;
00220 Feature tmp_peak_;
00221
00222 };
00223 }
00224
00225 #endif