QtiPlot 0.9.8.2
|
00001 /*************************************************************************** 00002 File : ScreenPickerTool.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2006,2007 by Ion Vasilief, Knut Franke 00006 Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de 00007 Description : Plot tool for selecting arbitrary points. 00008 00009 ***************************************************************************/ 00010 00011 /*************************************************************************** 00012 * * 00013 * This program is free software; you can redistribute it and/or modify * 00014 * it under the terms of the GNU General Public License as published by * 00015 * the Free Software Foundation; either version 2 of the License, or * 00016 * (at your option) any later version. * 00017 * * 00018 * This program is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00021 * GNU General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU General Public License * 00024 * along with this program; if not, write to the Free Software * 00025 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00026 * Boston, MA 02110-1301 USA * 00027 * * 00028 ***************************************************************************/ 00029 #ifndef SCREEN_PICKER_TOOL_H 00030 #define SCREEN_PICKER_TOOL_H 00031 00032 #include "PlotToolInterface.h" 00033 #include <QObject> 00034 #include <QPointer> 00035 #include <QLabel> 00036 #include <DoubleSpinBox.h> 00037 00038 #include <qwt_double_rect.h> 00039 #include <qwt_plot_marker.h> 00040 #include <qwt_plot_picker.h> 00041 00042 class ApplicationWindow; 00043 class Table; 00044 class Matrix; 00045 class DataCurve; 00046 00052 class ScreenPickerTool : public QwtPlotPicker, public PlotToolInterface 00053 { 00054 Q_OBJECT 00055 public: 00056 enum MoveRestriction { NoRestriction, Vertical, Horizontal }; 00057 ScreenPickerTool(Graph *graph, const QObject *status_target=NULL, const char *status_slot=""); 00058 virtual ~ScreenPickerTool(); 00059 virtual void append(const QwtDoublePoint &pos); 00060 void setMoveRestriction(ScreenPickerTool::MoveRestriction r){d_move_restriction = r;}; 00061 00062 double xValue(){return d_selection_marker.xValue();}; 00063 double yValue(){return d_selection_marker.yValue();}; 00064 00065 signals: 00070 void statusText(const QString&); 00071 protected: 00072 virtual bool eventFilter(QObject *obj, QEvent *event); 00073 virtual void append(const QPoint &point); 00074 QwtPlotMarker d_selection_marker; 00075 MoveRestriction d_move_restriction; 00076 }; 00077 00081 class DrawPointTool : public ScreenPickerTool 00082 { 00083 Q_OBJECT 00084 public: 00085 DrawPointTool(ApplicationWindow *app, Graph *graph, const QObject *status_target=NULL, const char *status_slot=""); 00086 virtual int rtti() const { return Rtti_DrawDataPoints;}; 00087 00088 protected: 00089 virtual bool eventFilter(QObject *obj, QEvent *event); 00090 void appendPoint(const QwtDoublePoint &point); 00091 DataCurve *d_curve; 00092 Table *d_table; 00093 ApplicationWindow *d_app; 00094 }; 00095 00099 class ImageProfilesTool : public ScreenPickerTool 00100 { 00101 Q_OBJECT 00102 public: 00103 ImageProfilesTool(ApplicationWindow *app, Graph *graph, Matrix *m, Table *horTable, Table *verTable, 00104 const QObject *status_target=NULL, const char *status_slot=""); 00105 00106 ImageProfilesTool* clone(Graph *g); 00107 00108 virtual ~ImageProfilesTool(); 00109 virtual void append(const QwtDoublePoint &pos); 00110 virtual int rtti() const { return Rtti_ImageProfilesTool;}; 00111 00112 00113 QPointer<Matrix> matrix(){return d_matrix;}; 00114 QPointer<Table> horizontalTable(){return d_hor_table;}; 00115 QPointer<Table> verticalTable(){return d_ver_table;}; 00116 00117 private slots: 00118 void modifiedMatrix(Matrix *); 00119 void updateCursorPosition(); 00120 00121 protected: 00122 ApplicationWindow *d_app; 00123 QPointer<Matrix> d_matrix; 00124 QPointer<Table> d_hor_table, d_ver_table; 00125 DoubleSpinBox *horSpinBox, *vertSpinBox; 00126 QLabel *zLabel; 00127 }; 00128 00129 #endif // ifndef SCREEN_PICKER_TOOL_H