SciDAVis  1.D4
DataPickerTool.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : DataPickerTool.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2006,2007 by Ion Vasilief,
6  Tilman Benkert, Knut Franke
7  Email (use @ for *) : ion_vasilief*yahoo.fr, thzs*gmx.net,
8  knut.franke*gmx.de
9  Description : Plot tool for selecting individual points of a curve.
10 
11  ***************************************************************************/
12 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  * This program is distributed in the hope that it will be useful, *
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
23  * GNU General Public License for more details. *
24  * *
25  * You should have received a copy of the GNU General Public License *
26  * along with this program; if not, write to the Free Software *
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
28  * Boston, MA 02110-1301 USA *
29  * *
30  ***************************************************************************/
31 #ifndef DATA_PICKER_TOOL_H
32 #define DATA_PICKER_TOOL_H
33 
34 #include "PlotToolInterface.h"
35 #include <qwt_plot_marker.h>
36 #include <qwt_plot_picker.h>
37 
38 class ApplicationWindow;
39 class QwtPlotCurve;
40 class QPoint;
41 
43 class DataPickerTool : public QwtPlotPicker, public PlotToolInterface
44 {
45  Q_OBJECT
46  public:
47  enum Mode { Display, Move, Remove };
49  DataPickerTool(Graph *graph, ApplicationWindow *app, Mode mode, const QObject *status_target=NULL, const char *status_slot="");
50  virtual RTTI rtti() const { return DataPicker; }
51  Mode mode() const { return d_mode; }
52  virtual ~DataPickerTool();
53  virtual bool eventFilter(QObject *obj, QEvent *event);
54  bool keyEventFilter(QKeyEvent *ke);
55  QwtPlotCurve *selectedCurve() const { return d_selected_curve; }
56  signals:
61  void statusText(const QString&);
63  void selected(QwtPlotCurve*, int);
64  protected:
65  void removePoint();
66  virtual void append(const QPoint &point);
67  virtual void move(const QPoint &point);
68  virtual bool end(bool ok);
69  void setSelection(QwtPlotCurve *curve, int point_index);
70  void moveBy(int dx, int dy);
71  virtual QwtText trackerText(const QwtDoublePoint &point) const;
72  private:
74  QwtPlotMarker d_selection_marker;
76  QwtPlotCurve *d_selected_curve;
80 };
81 
82 #endif // ifndef DATA_PICKER_TOOL_H
83