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
00029
00030
00031 #ifndef DATA_PICKER_TOOL_H
00032 #define DATA_PICKER_TOOL_H
00033
00034 #include "PlotToolInterface.h"
00035 #include <qwt_plot_marker.h>
00036 #include <qwt_plot_picker.h>
00037
00038 class ApplicationWindow;
00039 class QwtPlotCurve;
00040 class QPoint;
00041
00043 class DataPickerTool : public QwtPlotPicker, public PlotToolInterface
00044 {
00045 Q_OBJECT
00046 public:
00047 enum Mode { Display, Move, Remove };
00048 DataPickerTool(Graph *graph, ApplicationWindow *app, Mode mode, const QObject *status_target=NULL, const char *status_slot="");
00049 virtual ~DataPickerTool();
00050 virtual bool eventFilter(QObject *obj, QEvent *event);
00051 bool keyEventFilter(QKeyEvent *ke);
00052 QwtPlotCurve *selectedCurve() const { return d_selected_curve; }
00053 signals:
00058 void statusText(const QString&);
00060 void selected(QwtPlotCurve*, int);
00061 protected:
00062 void movePoint(const QPoint &cursor);
00063 void removePoint();
00064 virtual void append(const QPoint &point);
00065 virtual void move(const QPoint &point);
00066 virtual bool end(bool ok);
00067 void setSelection(QwtPlotCurve *curve, int point_index);
00068 void moveBy(int dx, int dy);
00069 private:
00070 ApplicationWindow *d_app;
00071 QwtPlotMarker d_selection_marker;
00072 Mode d_mode;
00073 QwtPlotCurve *d_selected_curve;
00074 int d_selected_point;
00075 };
00076
00077 #endif // ifndef DATA_PICKER_TOOL_H
00078