Quantum GIS API Documentation
1.7.4
|
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 00028 class CORE_EXPORT QgsComposerPicture: public QgsComposerItem 00029 { 00030 Q_OBJECT 00031 public: 00032 QgsComposerPicture( QgsComposition *composition ); 00033 ~QgsComposerPicture(); 00034 00036 virtual int type() const { return ComposerPicture; } 00037 00039 void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget ); 00040 00042 void setPictureFile( const QString& path ); 00043 QString pictureFile() const; 00044 00047 void setSceneRect( const QRectF& rectangle ); 00048 00053 bool writeXML( QDomElement& elem, QDomDocument & doc ) const; 00054 00059 bool readXML( const QDomElement& itemElem, const QDomDocument& doc ); 00060 00062 void setRotationMap( int composerMapId ); 00064 int rotationMap() const; 00066 bool useRotationMap() const {return mRotationMap;} 00067 00068 public slots: 00070 virtual void setRotation( double r ); 00071 00072 private: 00073 00074 enum Mode //SVG or raster graphic format 00075 { 00076 SVG, 00077 RASTER, 00078 Unknown 00079 }; 00080 00081 //default constructor is forbidden 00082 QgsComposerPicture(); 00084 QRectF boundedSVGRect( double deviceWidth, double deviceHeight ); 00086 QRectF boundedImageRect( double deviceWidth, double deviceHeight ); 00087 00088 00089 QImage mImage; 00090 QSvgRenderer mSVG; 00091 QFile mSourceFile; 00092 Mode mMode; 00093 00094 QSize mDefaultSvgSize; 00096 const QgsComposerMap* mRotationMap; 00098 double mPictureWidth; 00100 double mPictureHeight; 00101 }; 00102 00103 #endif