Go to the documentation of this file.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 #ifndef DATA_PICKER_TOOL_H
00030 #define DATA_PICKER_TOOL_H
00031
00032 #include "PlotToolInterface.h"
00033 #include <qwt_plot_marker.h>
00034 #include <qwt_plot_picker.h>
00035
00036 class ApplicationWindow;
00037 class QwtPlotCurve;
00038 class QPoint;
00039
00041 class DataPickerTool : public QwtPlotPicker, public PlotToolInterface
00042 {
00043 Q_OBJECT
00044 public:
00045 enum Mode { Display, Move, Remove, MoveCurve};
00046 enum MoveMode {Free, Vertical, Horizontal};
00047 DataPickerTool(Graph *graph, ApplicationWindow *app, Mode mode, const QObject *status_target=NULL, const char *status_slot="");
00048 virtual ~DataPickerTool();
00049 virtual bool eventFilter(QObject *obj, QEvent *event);
00050 bool keyEventFilter(QKeyEvent *ke);
00051 QwtPlotCurve *selectedCurve() const { return d_selected_curve; }
00052 void setSelectedCurve(QwtPlotCurve *c){if (c) setSelection(c, 0);};
00053 int selectedPointIndex(){return d_selected_point;};
00054
00055 void copySelection();
00056 void cutSelection();
00057 void pasteSelection();
00058 void removePoint();
00059
00061 Mode mode(){return d_mode;};
00062 void setMode(Mode m){d_mode = m;};
00063
00065 int findClosestPoint(QwtPlotCurve *c, double x, bool up);
00066
00067 virtual int rtti() const {return PlotToolInterface::Rtti_DataPicker;};
00068
00069 void selectTableRow();
00070
00071 ApplicationWindow *applicationWindow(){return d_app;};
00072
00073 public slots:
00074 void pasteSelectionAsLayerText();
00075
00076 signals:
00081 void statusText(const QString&);
00083 void selected(QwtPlotCurve*, int);
00084 protected:
00085 void movePoint(const QPoint &cursor);
00086 virtual void append(const QPoint &point);
00087 virtual void move(const QPoint &point);
00088 virtual bool end(bool ok);
00089 virtual void setSelection(QwtPlotCurve *curve, int point_index);
00090 void moveBy(int dx, int dy);
00091
00092 ApplicationWindow *d_app;
00093 QwtPlotMarker d_selection_marker;
00094 Mode d_mode;
00095 QwtPlotCurve *d_selected_curve;
00096 int d_selected_point;
00097 MoveMode d_move_mode;
00098 QPoint d_restricted_move_pos;
00099 };
00100
00102 class BaselineTool : public DataPickerTool
00103 {
00104 Q_OBJECT
00105
00106 public:
00107 BaselineTool(QwtPlotCurve *curve, Graph *graph, ApplicationWindow *app);
00108
00109 protected:
00110 void setSelection(QwtPlotCurve *curve, int point_index);
00111 };
00112
00113 #endif // ifndef DATA_PICKER_TOOL_H
00114