Quantum GIS API Documentation  1.7.5-Wroclaw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 : radim.blazek@gmail.com
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 
28 class CORE_EXPORT QgsComposerPicture: public QgsComposerItem
29 {
30  Q_OBJECT
31  public:
32  QgsComposerPicture( QgsComposition *composition );
34 
36  virtual int type() const { return ComposerPicture; }
37 
39  void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
40 
42  void setPictureFile( const QString& path );
43  QString pictureFile() const;
44 
47  void setSceneRect( const QRectF& rectangle );
48 
53  bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
54 
59  bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
60 
62  void setRotationMap( int composerMapId );
64  int rotationMap() const;
66  bool useRotationMap() const {return mRotationMap;}
67 
68  public slots:
70  virtual void setRotation( double r );
71 
72  private:
73 
74  enum Mode //SVG or raster graphic format
75  {
76  SVG,
78  Unknown
79  };
80 
81  //default constructor is forbidden
84  QRectF boundedSVGRect( double deviceWidth, double deviceHeight );
86  QRectF boundedImageRect( double deviceWidth, double deviceHeight );
87 
88 
89  QImage mImage;
90  QSvgRenderer mSVG;
91  QFile mSourceFile;
93 
98  double mPictureWidth;
101 };
102 
103 #endif