SciDAVis  1.D4
ImageMarker.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ImageMarker.h
3  Project : SciDAVis
4  --------------------------------------------------------------------
5  Copyright : (C) 2007 by Ion Vasilief, Knut Franke
6  Email (use @ for *) : ion_vasilief*yahoo.fr, knut.franke*gmx.de
7  Description : Draw images on a QwtPlot.
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef IMAGEMARKER_H
30 #define IMAGEMARKER_H
31 
32 #include <qwt_plot.h>
33 #include "PlotEnrichement.h"
34 
35 #include <QPixmap>
36 
65 {
66 public:
68  ImageMarker(const QString& fn);
69 
71  QRect rect() const;
73  void setRect(int x, int y, int w, int h);
74 
76  virtual QwtDoubleRect boundingRect() const;
78  void setBoundingRect(double left, double top, double right, double bottom);
79 
80  double right(){return d_x_right;};
81  double bottom(){return d_y_bottom;};
82 
84  QSize size() {return rect().size();};
86  void setSize(const QSize& size);
88  void setSize(int w, int h){setSize(QSize(w, h));};
89 
91  QPoint origin() const { return rect().topLeft(); };
93  void setOrigin(const QPoint &p);
94 
96  void setFileName(const QString& fn) { d_file_name = fn; };
98  QString fileName(){return d_file_name;};
99 
101  QPixmap pixmap() const {return d_pic;};
102 
103  void updateBoundingRect();
104 
105 private:
107  void draw(QPainter *p, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRect &r) const;
109  QPoint d_pos;
111  QPixmap d_pic;
113  QSize d_size;
115  QString d_file_name;
117  double d_x_right;
119  double d_y_bottom;
120 };
121 
122 #endif