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 <DoubleSpinBox.h> 00034 00035 #include <QObject> 00036 #include <QPointer> 00037 #include <QLabel> 00038 #include <QSpinBox> 00039 00040 #include <qwt_double_rect.h> 00041 #include <qwt_plot_marker.h> 00042 #include <qwt_plot_picker.h> 00043 00044 class ApplicationWindow; 00045 class Table; 00046 class Matrix; 00047 class DataCurve; 00048 00054 class ScreenPickerTool : public QwtPlotPicker, public PlotToolInterface 00055 { 00056 Q_OBJECT 00057 public: 00058 enum MoveRestriction { NoRestriction, Vertical, Horizontal }; 00059 ScreenPickerTool(Graph *graph, const QObject *status_target=NULL, const char *status_slot=""); 00060 virtual ~ScreenPickerTool(); 00061 virtual void append(const QwtDoublePoint &pos); 00062 void setMoveRestriction(ScreenPickerTool::MoveRestriction r){d_move_restriction = r;}; 00063 00064 double xValue(){return d_selection_marker.xValue();}; 00065 double yValue(){return d_selection_marker.yValue();}; 00066 00067 signals: 00072 void statusText(const QString&); 00073 protected: 00074 virtual bool eventFilter(QObject *obj, QEvent *event); 00075 virtual void append(const QPoint &point); 00076 QwtPlotMarker d_selection_marker; 00077 MoveRestriction d_move_restriction; 00078 }; 00079 00083 class DrawPointTool : public ScreenPickerTool 00084 { 00085 Q_OBJECT 00086 public: 00087 DrawPointTool(ApplicationWindow *app, Graph *graph, const QObject *status_target=NULL, const char *status_slot=""); 00088 virtual int rtti() const { return Rtti_DrawDataPoints;}; 00089 00090 protected: 00091 virtual bool eventFilter(QObject *obj, QEvent *event); 00092 void appendPoint(const QwtDoublePoint &point); 00093 DataCurve *d_curve; 00094 Table *d_table; 00095 ApplicationWindow *d_app; 00096 }; 00097 00101 class ImageProfilesTool : public ScreenPickerTool 00102 { 00103 Q_OBJECT 00104 public: 00105 ImageProfilesTool(ApplicationWindow *app, Graph *graph, Matrix *m, Table *horTable, Table *verTable); 00106 void connectPlotLayers(); 00107 00108 ImageProfilesTool* clone(Graph *g); 00109 00110 virtual ~ImageProfilesTool(); 00111 virtual void append(const QwtDoublePoint &pos); 00112 virtual int rtti() const { return Rtti_ImageProfilesTool;}; 00113 00114 int averagePixels(){return averageBox->value();} 00115 void setAveragePixels(int pixels); 00116 00117 QPointer<Matrix> matrix(){return d_matrix;}; 00118 QPointer<Table> horizontalTable(){return d_hor_table;}; 00119 QPointer<Table> verticalTable(){return d_ver_table;}; 00120 00121 private slots: 00122 void modifiedMatrix(Matrix *); 00123 void updateCursorPosition(); 00124 void updateCursorWidth(int width); 00125 00126 private: 00127 void setCursorWidth(int width); 00128 00129 protected: 00130 ApplicationWindow *d_app; 00131 QPointer<Matrix> d_matrix; 00132 QPointer<Table> d_hor_table, d_ver_table; 00133 DoubleSpinBox *horSpinBox, *vertSpinBox; 00134 QSpinBox *averageBox; 00135 QLabel *zLabel; 00136 QWidget *d_box; 00137 }; 00138 00139 #endif // ifndef SCREEN_PICKER_TOOL_H