QtiPlot  0.9.8.2
DataPickerTool.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : DataPickerTool.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2006,2007 by Ion Vasilief, Knut Franke
6  Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de
7  Description : Plot tool for selecting individual points of a curve.
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef DATA_PICKER_TOOL_H
30 #define DATA_PICKER_TOOL_H
31 
32 #include "PlotToolInterface.h"
33 #include <qwt_plot_marker.h>
34 #include <qwt_plot_picker.h>
35 
36 class ApplicationWindow;
37 class QwtPlotCurve;
38 class QPoint;
39 
41 class DataPickerTool : public QwtPlotPicker, public PlotToolInterface
42 {
43  Q_OBJECT
44  public:
47  DataPickerTool(Graph *graph, ApplicationWindow *app, Mode mode, const QObject *status_target=NULL, const char *status_slot="");
48  virtual ~DataPickerTool();
49  virtual bool eventFilter(QObject *obj, QEvent *event);
50  bool keyEventFilter(QKeyEvent *ke);
51  QwtPlotCurve *selectedCurve() const { return d_selected_curve; }
52  void setSelectedCurve(QwtPlotCurve *c){if (c) setSelection(c, 0);};
54 
55  void copySelection();
56  void cutSelection();
57  void pasteSelection();
58  void removePoint();
59 
61  Mode mode(){return d_mode;};
62  void setMode(Mode m){d_mode = m;};
63 
65  int findClosestPoint(QwtPlotCurve *c, double x, bool up);
66 
67  virtual int rtti() const {return PlotToolInterface::Rtti_DataPicker;};
68 
69  void selectTableRow();
70 
72 
73  public slots:
75 
76  signals:
81  void statusText(const QString&);
83  void selected(QwtPlotCurve*, int);
84  protected:
85  void movePoint(const QPoint &cursor);
86  virtual void append(const QPoint &point);
87  virtual void move(const QPoint &point);
88  virtual bool end(bool ok);
89  virtual void setSelection(QwtPlotCurve *curve, int point_index);
90  void moveBy(int dx, int dy);
91 
93  QwtPlotMarker d_selection_marker;
95  QwtPlotCurve *d_selected_curve;
99 };
100 
103 {
104  Q_OBJECT
105 
106  public:
107  BaselineTool(QwtPlotCurve *curve, Graph *graph, ApplicationWindow *app);
108 
109  protected:
110  void setSelection(QwtPlotCurve *curve, int point_index);
111 };
112 
113 #endif // ifndef DATA_PICKER_TOOL_H
114 
void selectTableRow()
Definition: DataPickerTool.cpp:553
virtual void append(const QPoint &point)
Definition: DataPickerTool.cpp:91
Definition: DataPickerTool.h:45
Plot tool for selecting and moving individual points of a baseline curve.
Definition: DataPickerTool.h:102
void statusText(const QString &)
void setSelectedCurve(QwtPlotCurve *c)
Definition: DataPickerTool.h:52
void copySelection()
Definition: DataPickerTool.cpp:480
void moveBy(int dx, int dy)
Definition: DataPickerTool.cpp:464
A 2D-plotting widget.
Definition: Graph.h:123
Mode mode()
Returns the information about the functioning mode of the tool.
Definition: DataPickerTool.h:61
void cutSelection()
Definition: DataPickerTool.cpp:474
int d_selected_point
Definition: DataPickerTool.h:96
bool keyEventFilter(QKeyEvent *ke)
Definition: DataPickerTool.cpp:201
QPoint d_restricted_move_pos
Definition: DataPickerTool.h:98
virtual ~DataPickerTool()
Definition: DataPickerTool.cpp:85
void setMode(Mode m)
Definition: DataPickerTool.h:62
QwtPlotMarker d_selection_marker
Definition: DataPickerTool.h:93
Mode d_mode
Definition: DataPickerTool.h:94
void removePoint()
Definition: DataPickerTool.cpp:319
virtual void setSelection(QwtPlotCurve *curve, int point_index)
Definition: DataPickerTool.cpp:108
Definition: DataPickerTool.h:45
virtual bool end(bool ok)
Definition: DataPickerTool.cpp:457
QtiPlot's main window.
Definition: ApplicationWindow.h:133
ApplicationWindow * d_app
Definition: DataPickerTool.h:92
void selected(QwtPlotCurve *, int)
Emitted whenever a new data point has been selected.
int selectedPointIndex()
Definition: DataPickerTool.h:53
QwtPlotCurve * d_selected_curve
Definition: DataPickerTool.h:95
void movePoint(const QPoint &cursor)
Definition: DataPickerTool.cpp:347
Definition: PlotToolInterface.h:69
QwtPlotCurve * selectedCurve() const
Definition: DataPickerTool.h:51
DataPickerTool(Graph *graph, ApplicationWindow *app, Mode mode, const QObject *status_target=NULL, const char *status_slot="")
Definition: DataPickerTool.cpp:48
virtual int rtti() const
Definition: DataPickerTool.h:67
int findClosestPoint(QwtPlotCurve *c, double x, bool up)
Searches the index of the closest point to the given x coordinate.
Definition: DataPickerTool.cpp:574
Mode
Definition: DataPickerTool.h:45
Definition: DataPickerTool.h:46
Definition: DataPickerTool.h:45
ApplicationWindow * applicationWindow()
Definition: DataPickerTool.h:71
void pasteSelectionAsLayerText()
Definition: DataPickerTool.cpp:491
Definition: DataPickerTool.h:46
Definition: PlotToolInterface.h:60
BaselineTool(QwtPlotCurve *curve, Graph *graph, ApplicationWindow *app)
Definition: DataPickerTool.cpp:600
MoveMode d_move_mode
Definition: DataPickerTool.h:97
virtual bool eventFilter(QObject *obj, QEvent *event)
Definition: DataPickerTool.cpp:167
Definition: DataPickerTool.h:45
MoveMode
Definition: DataPickerTool.h:46
virtual void move(const QPoint &point)
Definition: DataPickerTool.cpp:438
void setSelection(QwtPlotCurve *curve, int point_index)
Definition: DataPickerTool.cpp:606
Definition: DataPickerTool.h:46
Plot tool for selecting, moving or removing individual points of a curve.
Definition: DataPickerTool.h:41
void pasteSelection()
Definition: DataPickerTool.cpp:503