1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2  * Qwt Widget Library
3  * Copyright (C) 1997   Josef Wilgen
4  * Copyright (C) 2002   Uwe Rathmann
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the Qwt License, Version 1.0
8  *****************************************************************************/
9 
10 #ifndef QWT_PLOT_SVGITEM_H
11 #define QWT_PLOT_SVGITEM_H
12 
13 #include <qglobal.h>
14 
15 #include <qstring.h>
16 #include "qwt_double_rect.h"
17 #include "qwt_plot_item.h"
18 
19 #if QT_VERSION >= 0x040100
20 class QSvgRenderer;
21 class QByteArray;
22 #endif
23 
24 /*!
25   \brief A plot item, which displays
26          data in Scalable Vector Graphics (SVG) format.
27 
28   SVG images are often used to display maps
29 */
30 
31 class QWT_EXPORT QwtPlotSvgItem: public QwtPlotItem
32 {
33 public:
34     explicit QwtPlotSvgItem(const QString& title = QString() );
35     explicit QwtPlotSvgItem(const QwtText& title );
36     virtual ~QwtPlotSvgItem();
37 
38     bool loadFile(const QwtDoubleRect&, const QString &fileName);
39     bool loadData(const QwtDoubleRect&, const QByteArray &);
40 
41     virtual QwtDoubleRect boundingRect() const;
42 
43     virtual void draw(QPainter *p,
44         const QwtScaleMap &xMap, const QwtScaleMap &yMap,
45         const QRect &rect) const;
46 
47     virtual int rtti() const;
48 
49 protected:
50 #if QT_VERSION >= 0x040100
51     const QSvgRenderer &renderer() const;
52     QSvgRenderer &renderer();
53 #endif
54 
55     void render(QPainter *painter,
56         const QwtDoubleRect &viewBox, const QRect &rect) const;
57     QwtDoubleRect viewBox(const QwtDoubleRect &area) const;
58 
59 private:
60     void init();
61 
62     class PrivateData;
63     PrivateData *d_data;
64 };
65 
66 #endif
67