DataPickerTool.h
Go to the documentation of this file.
/***************************************************************************
File : DataPickerTool.h
Project : QtiPlot
--------------------------------------------------------------------
Copyright : (C) 2006,2007 by Ion Vasilief, Knut Franke
Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de
Description : Plot tool for selecting individual points of a curve.
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301 USA *
* *
***************************************************************************/
#ifndef DATA_PICKER_TOOL_H
#define DATA_PICKER_TOOL_H
#include "PlotToolInterface.h"
#include <qwt_plot_marker.h>
#include <qwt_plot_picker.h>
class ApplicationWindow;
class QwtPlotCurve;
class QPoint;
class DataPickerTool : public QwtPlotPicker, public PlotToolInterface
{
Q_OBJECT
public:
enum Mode { Display, Move, Remove, MoveCurve};
enum MoveMode {Free, Vertical, Horizontal};
DataPickerTool(Graph *graph, ApplicationWindow *app, Mode mode, const QObject *status_target=NULL, const char *status_slot="");
virtual ~DataPickerTool();
virtual bool eventFilter(QObject *obj, QEvent *event);
bool keyEventFilter(QKeyEvent *ke);
QwtPlotCurve *selectedCurve() const { return d_selected_curve; }
void setSelectedCurve(QwtPlotCurve *c){if (c) setSelection(c, 0);};
int selectedPointIndex(){return d_selected_point;};
void copySelection();
void cutSelection();
void pasteSelection();
void removePoint();
Mode mode(){return d_mode;};
void setMode(Mode m){d_mode = m;};
int findClosestPoint(QwtPlotCurve *c, double x, bool up);
virtual int rtti() const {return PlotToolInterface::Rtti_DataPicker;};
void selectTableRow();
ApplicationWindow *applicationWindow(){return d_app;};
public slots:
void pasteSelectionAsLayerText();
signals:
void statusText(const QString&);
void selected(QwtPlotCurve*, int);
protected:
void movePoint(const QPoint &cursor);
virtual void append(const QPoint &point);
virtual void move(const QPoint &point);
virtual bool end(bool ok);
virtual void setSelection(QwtPlotCurve *curve, int point_index);
void moveBy(int dx, int dy);
ApplicationWindow *d_app;
QwtPlotMarker d_selection_marker;
Mode d_mode;
QwtPlotCurve *d_selected_curve;
int d_selected_point;
MoveMode d_move_mode;
QPoint d_restricted_move_pos;
};
class BaselineTool : public DataPickerTool
{
Q_OBJECT
public:
BaselineTool(QwtPlotCurve *curve, Graph *graph, ApplicationWindow *app);
protected:
void setSelection(QwtPlotCurve *curve, int point_index);
};
#endif // ifndef DATA_PICKER_TOOL_H
DataPickerTool::selectedCurve
QwtPlotCurve * selectedCurve() const
Definition: DataPickerTool.h:51
DataPickerTool::selectTableRow
void selectTableRow()
Definition: DataPickerTool.cpp:553
DataPickerTool::append
virtual void append(const QPoint &point)
Definition: DataPickerTool.cpp:91
DataPickerTool::Display
Definition: DataPickerTool.h:45
BaselineTool
Plot tool for selecting and moving individual points of a baseline curve.
Definition: DataPickerTool.h:102
DataPickerTool::statusText
void statusText(const QString &)
DataPickerTool::setSelectedCurve
void setSelectedCurve(QwtPlotCurve *c)
Definition: DataPickerTool.h:52
DataPickerTool::copySelection
void copySelection()
Definition: DataPickerTool.cpp:480
DataPickerTool::moveBy
void moveBy(int dx, int dy)
Definition: DataPickerTool.cpp:464
Graph
A 2D-plotting widget.
Definition: Graph.h:123
DataPickerTool::mode
Mode mode()
Returns the information about the functioning mode of the tool.
Definition: DataPickerTool.h:61
DataPickerTool::cutSelection
void cutSelection()
Definition: DataPickerTool.cpp:474
DataPickerTool::d_selected_point
int d_selected_point
Definition: DataPickerTool.h:96
DataPickerTool::keyEventFilter
bool keyEventFilter(QKeyEvent *ke)
Definition: DataPickerTool.cpp:201
DataPickerTool::d_restricted_move_pos
QPoint d_restricted_move_pos
Definition: DataPickerTool.h:98
DataPickerTool::~DataPickerTool
virtual ~DataPickerTool()
Definition: DataPickerTool.cpp:85
DataPickerTool::setMode
void setMode(Mode m)
Definition: DataPickerTool.h:62
DataPickerTool::d_selection_marker
QwtPlotMarker d_selection_marker
Definition: DataPickerTool.h:93
DataPickerTool::d_mode
Mode d_mode
Definition: DataPickerTool.h:94
DataPickerTool::removePoint
void removePoint()
Definition: DataPickerTool.cpp:319
DataPickerTool::setSelection
virtual void setSelection(QwtPlotCurve *curve, int point_index)
Definition: DataPickerTool.cpp:108
DataPickerTool::MoveCurve
Definition: DataPickerTool.h:45
DataPickerTool::end
virtual bool end(bool ok)
Definition: DataPickerTool.cpp:457
ApplicationWindow
QtiPlot&#39;s main window.
Definition: ApplicationWindow.h:133
DataPickerTool::d_app
ApplicationWindow * d_app
Definition: DataPickerTool.h:92
DataPickerTool::selected
void selected(QwtPlotCurve *, int)
Emitted whenever a new data point has been selected.
DataPickerTool::selectedPointIndex
int selectedPointIndex()
Definition: DataPickerTool.h:53
DataPickerTool::d_selected_curve
QwtPlotCurve * d_selected_curve
Definition: DataPickerTool.h:95
DataPickerTool::movePoint
void movePoint(const QPoint &cursor)
Definition: DataPickerTool.cpp:347
PlotToolInterface::Rtti_DataPicker
Definition: PlotToolInterface.h:69
DataPickerTool::DataPickerTool
DataPickerTool(Graph *graph, ApplicationWindow *app, Mode mode, const QObject *status_target=NULL, const char *status_slot="")
Definition: DataPickerTool.cpp:48
DataPickerTool::findClosestPoint
int findClosestPoint(QwtPlotCurve *c, double x, bool up)
Searches the index of the closest point to the given x coordinate.
Definition: DataPickerTool.cpp:574
DataPickerTool::Mode
Mode
Definition: DataPickerTool.h:45
DataPickerTool::Free
Definition: DataPickerTool.h:46
DataPickerTool::Move
Definition: DataPickerTool.h:45
DataPickerTool::applicationWindow
ApplicationWindow * applicationWindow()
Definition: DataPickerTool.h:71
DataPickerTool::pasteSelectionAsLayerText
void pasteSelectionAsLayerText()
Definition: DataPickerTool.cpp:491
DataPickerTool::Horizontal
Definition: DataPickerTool.h:46
PlotToolInterface.h
PlotToolInterface
Definition: PlotToolInterface.h:60
DataPickerTool::d_move_mode
MoveMode d_move_mode
Definition: DataPickerTool.h:97
DataPickerTool::eventFilter
virtual bool eventFilter(QObject *obj, QEvent *event)
Definition: DataPickerTool.cpp:167
DataPickerTool::Remove
Definition: DataPickerTool.h:45
DataPickerTool::MoveMode
MoveMode
Definition: DataPickerTool.h:46
DataPickerTool::move
virtual void move(const QPoint &point)
Definition: DataPickerTool.cpp:438
DataPickerTool::Vertical
Definition: DataPickerTool.h:46
DataPickerTool
Plot tool for selecting, moving or removing individual points of a curve.
Definition: DataPickerTool.h:41
DataPickerTool::rtti
virtual int rtti() const
Definition: DataPickerTool.h:67
DataPickerTool::pasteSelection
void pasteSelection()
Definition: DataPickerTool.cpp:503