QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscomposerpicture.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposerpicture.h
3  -------------------
4  begin : September 2005
5  copyright : (C) 2005 by Radim Blazek
6  email : [email protected]
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef QGSCOMPOSERPICTURE_H
18 #define QGSCOMPOSERPICTURE_H
19 
20 #include "qgscomposeritem.h"
21 #include <QFile>
22 #include <QImage>
23 #include <QSvgRenderer>
24 
25 class QgsComposerMap;
26 
30 class CORE_EXPORT QgsComposerPicture: public QgsComposerItem
31 {
32  Q_OBJECT
33  public:
34  QgsComposerPicture( QgsComposition *composition );
36 
38  virtual int type() const { return ComposerPicture; }
39 
41  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
42 
44  void setPictureFile( const QString& path );
45  QString pictureFile() const;
46 
49  void setSceneRect( const QRectF& rectangle );
50 
55  bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
56 
61  bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
62 
64  void setRotationMap( int composerMapId );
66  int rotationMap() const;
68  bool useRotationMap() const {return mRotationMap;}
69 
70  public slots:
72  virtual void setRotation( double r );
73 
74  private:
75 
76  enum Mode //SVG or raster graphic format
77  {
78  SVG,
81  };
82 
83  //default constructor is forbidden
86  QRectF boundedSVGRect( double deviceWidth, double deviceHeight );
88  QRectF boundedImageRect( double deviceWidth, double deviceHeight );
89 
90 
91  QImage mImage;
92  QSvgRenderer mSVG;
93  QFile mSourceFile;
95 
103 };
104 
105 #endif