QtiPlot 0.9.7.3
|
00001 /*************************************************************************** 00002 File : LineProfileTool.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 calculating intensity profiles of 00008 image markers. 00009 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * * 00014 * This program is free software; you can redistribute it and/or modify * 00015 * it under the terms of the GNU General Public License as published by * 00016 * the Free Software Foundation; either version 2 of the License, or * 00017 * (at your option) any later version. * 00018 * * 00019 * This program is distributed in the hope that it will be useful, * 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00022 * GNU General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU General Public License * 00025 * along with this program; if not, write to the Free Software * 00026 * Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00027 * Boston, MA 02110-1301 USA * 00028 * * 00029 ***************************************************************************/ 00030 #ifndef LINE_PROFILE_TOOL_H 00031 #define LINE_PROFILE_TOOL_H 00032 00033 #include "PlotToolInterface.h" 00034 00035 #include <QWidget> 00036 00037 class QPoint; 00038 class QImage; 00039 class ImageWidget; 00040 class ApplicationWindow; 00041 00061 class LineProfileTool : public QWidget, public PlotToolInterface 00062 { 00063 Q_OBJECT 00064 00065 public: 00067 LineProfileTool(Graph *graph, ApplicationWindow *app, int average_pixels); 00068 void calculateLineProfile(const QPoint &start, const QPoint &end); 00069 00070 virtual int rtti() const {return PlotToolInterface::Rtti_LineProfileTool;}; 00071 00072 signals: 00077 void statusText(const QString&); 00078 00079 protected: 00080 double averageImagePixel(const QImage &image, int px, int py, bool moreHorizontal); 00083 virtual void paintEvent(QPaintEvent *e); 00088 virtual void mousePressEvent(QMouseEvent *e); 00091 virtual void mouseMoveEvent(QMouseEvent *e); 00094 virtual void mouseReleaseEvent(QMouseEvent *e); 00095 00096 private: 00097 ApplicationWindow *d_app; 00099 int d_average_pixels; 00101 ImageWidget *d_target; 00104 QPoint d_op_start; 00106 QPoint d_op_dp; 00107 }; 00108 00109 #endif // ifndef LINE_PROFILE_TOOL_H 00110