00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef QGSCOMPOSERPICTURE_H
00018 #define QGSCOMPOSERPICTURE_H
00019
00020 #include "qgscomposeritem.h"
00021 #include <QFile>
00022 #include <QImage>
00023
00027 class CORE_EXPORT QgsComposerPicture: public QgsComposerItem
00028 {
00029 Q_OBJECT
00030 public:
00031 QgsComposerPicture( QgsComposition *composition );
00032 ~QgsComposerPicture();
00033
00035 void paint( QPainter* painter, const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
00036
00038 void setPictureFile( const QString& path );
00039 QString pictureFile() const;
00040
00043 void setSceneRect( const QRectF& rectangle );
00044
00049 bool writeXML( QDomElement& elem, QDomDocument & doc ) const;
00050
00055 bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
00056
00058 void setRotationMap( int composerMapId );
00060 int rotationMap() const;
00062 bool useRotationMap() const {return mRotationMap;}
00063
00064 public slots:
00066 virtual void setRotation( double r );
00067
00068 private:
00069
00070 enum Mode
00071 {
00072 SVG,
00073 RASTER,
00074 Unknown
00075 };
00076
00077
00078 QgsComposerPicture();
00080 QRectF boundedSVGRect( double deviceWidth, double deviceHeight );
00082 QRectF boundedImageRect( double deviceWidth, double deviceHeight );
00083
00085 void updateImageFromSvg();
00086
00087
00088 QImage mImage;
00089 QFile mSourceFile;
00090 Mode mMode;
00092 bool mSvgCacheUpToDate;
00093 int mCachedDpi;
00094 double mCachedRotation;
00095 double mCachedViewScaleFactor;
00096
00097 QSize mDefaultSvgSize;
00099 const QgsComposerMap* mRotationMap;
00101 double mPictureWidth;
00103 double mPictureHeight;
00104
00105 signals:
00107 void settingsChanged();
00108 };
00109
00110 #endif