QGIS API Documentation  master-6164ace
src/core/composer/qgscomposerpicture.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                          qgscomposerpicture.h
00003                              -------------------
00004     begin                : September 2005
00005     copyright            : (C) 2005 by Radim Blazek
00006     email                : radim.blazek@gmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 #ifndef QGSCOMPOSERPICTURE_H
00018 #define QGSCOMPOSERPICTURE_H
00019 
00020 #include "qgscomposeritem.h"
00021 #include <QFile>
00022 #include <QImage>
00023 #include <QSvgRenderer>
00024 
00025 class QgsComposerMap;
00026 
00030 class CORE_EXPORT QgsComposerPicture: public QgsComposerItem
00031 {
00032     Q_OBJECT
00033   public:
00034     QgsComposerPicture( QgsComposition *composition );
00035     ~QgsComposerPicture();
00036 
00038     virtual int type() const { return ComposerPicture; }
00039 
00041     void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
00042 
00044     void setPictureFile( const QString& path );
00045     QString pictureFile() const;
00046 
00049     void setSceneRect( const QRectF& rectangle );
00050 
00055     bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
00056 
00061     bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
00062 
00064     void setRotationMap( int composerMapId );
00066     int rotationMap() const;
00068     bool useRotationMap() const {return mRotationMap;}
00069 
00070   public slots:
00072     virtual void setRotation( double r );
00073 
00074   private:
00075 
00076     enum Mode //SVG or raster graphic format
00077     {
00078       SVG,
00079       RASTER,
00080       Unknown
00081     };
00082 
00083     //default constructor is forbidden
00084     QgsComposerPicture();
00086     QRectF boundedSVGRect( double deviceWidth, double deviceHeight );
00088     QRectF boundedImageRect( double deviceWidth, double deviceHeight );
00089 
00090 
00091     QImage mImage;
00092     QSvgRenderer mSVG;
00093     QFile mSourceFile;
00094     Mode mMode;
00095 
00096     QSize mDefaultSvgSize;
00098     const QgsComposerMap* mRotationMap;
00100     double mPictureWidth;
00102     double mPictureHeight;
00103 };
00104 
00105 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines