00001 /*************************************************************************** 00002 File : ImageMarker.h 00003 Project : QtiPlot 00004 -------------------------------------------------------------------- 00005 Copyright : (C) 2007 by Ion Vasilief, Knut Franke 00006 Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de 00007 Description : Draw images on a QwtPlot. 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 IMAGEMARKER_H 00030 #define IMAGEMARKER_H 00031 00032 #include <qwt_plot.h> 00033 #include "PlotEnrichement.h" 00034 00035 #include <QPixmap> 00036 00064 class ImageMarker: public PlotEnrichement 00065 { 00066 public: 00068 ImageMarker(const QPixmap& p); 00069 00071 QRect rect() const; 00073 void setRect(int x, int y, int w, int h); 00074 00076 virtual QwtDoubleRect boundingRect() const; 00078 void setBoundingRect(double left, double top, double right, double bottom); 00079 00080 double right(){return d_x_right;}; 00081 double bottom(){return d_y_bottom;}; 00082 00084 QSize size() {return rect().size();}; 00086 void setSize(const QSize& size); 00087 00089 QPoint origin() const { return rect().topLeft(); }; 00091 void setOrigin(const QPoint &p); 00092 00094 void setFileName(const QString& fn) { d_file_name = fn; }; 00096 QString getFileName(){return d_file_name;}; 00097 00099 QPixmap pixmap() const {return d_pic;}; 00100 00101 void updateBoundingRect(); 00102 00103 private: 00105 void draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &r) const; 00107 QPoint d_pos; 00109 QPixmap d_pic; 00111 QSize d_size; 00113 QString d_file_name; 00115 double d_x_right; 00117 double d_y_bottom; 00118 }; 00119 00120 #endif