QgsComposerPicture Class Reference
[MapComposer]

A composer class that displays svg files or raster format (jpg, png, . More...

#include <qgscomposerpicture.h>

Inheritance diagram for QgsComposerPicture:

Inheritance graph
[legend]
Collaboration diagram for QgsComposerPicture:

Collaboration graph
[legend]

List of all members.

Public Slots

virtual void setRotation (double r)
 Sets the rotation and adapts the item rect.

Signals

void settingsChanged ()
 Tell the configuration widget that the settings need to be updated.

Public Member Functions

 QgsComposerPicture (QgsComposition *composition)
 ~QgsComposerPicture ()
void paint (QPainter *painter, const QStyleOptionGraphicsItem *itemStyle, QWidget *pWidget)
 Reimplementation of QCanvasItem::paint.
void setPictureFile (const QString &path)
 Sets the source file of the image (may be svg or a raster format).
QString pictureFile () const
void setSceneRect (const QRectF &rectangle)
 Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size unit and resizes the svg symbol / image.
bool writeXML (QDomElement &elem, QDomDocument &doc) const
 stores state in Dom element
bool readXML (const QDomElement &itemElem, const QDomDocument &doc)
 sets state from Dom document
void setRotationMap (int composerMapId)
 Sets the map object for rotation (by id).
int rotationMap () const
 Returns the id of the rotation map.
bool useRotationMap () const
 True if the rotation is taken from a map item.

Private Types

enum  Mode { SVG, RASTER, Unknown }

Private Member Functions

 QgsComposerPicture ()
QRectF boundedSVGRect (double deviceWidth, double deviceHeight)
 Calculates bounding rect for svg file (mSourcefile) such that aspect ratio is correct.
QRectF boundedImageRect (double deviceWidth, double deviceHeight)
 Calculates bounding rect for image such that aspect ratio is correct.
void updateImageFromSvg ()
 Updates content of mImage using svg generator.

Private Attributes

QImage mImage
QFile mSourceFile
Mode mMode
bool mSvgCacheUpToDate
 False if image needs to be rendered from svg.
int mCachedDpi
double mCachedRotation
double mCachedViewScaleFactor
QSize mDefaultSvgSize
const QgsComposerMapmRotationMap
 Map that sets the rotation (or 0 if this picture uses map independent rotation).
double mPictureWidth
 Width of the picture (in mm).
double mPictureHeight
 Height of the picture (in mm).


Detailed Description

A composer class that displays svg files or raster format (jpg, png, .

..)

Definition at line 27 of file qgscomposerpicture.h.


Member Enumeration Documentation

enum QgsComposerPicture::Mode [private]

Enumerator:
SVG 
RASTER 
Unknown 

Definition at line 70 of file qgscomposerpicture.h.


Constructor & Destructor Documentation

QgsComposerPicture::QgsComposerPicture ( QgsComposition composition  ) 

Definition at line 30 of file qgscomposerpicture.cpp.

References mPictureWidth.

QgsComposerPicture::~QgsComposerPicture (  ) 

Definition at line 41 of file qgscomposerpicture.cpp.

QgsComposerPicture::QgsComposerPicture (  )  [private]

Definition at line 36 of file qgscomposerpicture.cpp.

References mPictureHeight.


Member Function Documentation

void QgsComposerPicture::paint ( QPainter *  painter,
const QStyleOptionGraphicsItem *  itemStyle,
QWidget *  pWidget 
)

void QgsComposerPicture::setPictureFile ( const QString &  path  ) 

Sets the source file of the image (may be svg or a raster format).

Definition at line 119 of file qgscomposerpicture.cpp.

References mDefaultSvgSize, mImage, mMode, mSourceFile, mSvgCacheUpToDate, RASTER, setSceneRect(), settingsChanged(), SVG, and Unknown.

Referenced by readXML().

QString QgsComposerPicture::pictureFile (  )  const

Definition at line 290 of file qgscomposerpicture.cpp.

References mSourceFile.

void QgsComposerPicture::setSceneRect ( const QRectF &  rectangle  )  [virtual]

Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size unit and resizes the svg symbol / image.

Reimplemented from QgsComposerItem.

Definition at line 232 of file qgscomposerpicture.cpp.

References QgsComposerItem::imageSizeConsideringRotation(), mPictureHeight, mPictureWidth, mSvgCacheUpToDate, QgsComposerItem::setSceneRect(), and settingsChanged().

Referenced by QgsComposerView::mousePressEvent(), and setPictureFile().

bool QgsComposerPicture::writeXML ( QDomElement &  elem,
QDomDocument &  doc 
) const [virtual]

stores state in Dom element

Parameters:
elem is Dom element corresponding to 'Composer' tag
doc is Dom document

Implements QgsComposerItem.

Definition at line 295 of file qgscomposerpicture.cpp.

References QgsComposerItem::_writeXML(), QgsComposerMap::id(), QgsProject::instance(), mPictureHeight, mPictureWidth, mRotationMap, and mSourceFile.

bool QgsComposerPicture::readXML ( const QDomElement &  itemElem,
const QDomDocument &  doc 
) [virtual]

void QgsComposerPicture::setRotationMap ( int  composerMapId  ) 

Sets the map object for rotation (by id).

A value of -1 disables the map rotation

Definition at line 262 of file qgscomposerpicture.cpp.

References QgsComposition::getComposerMapById(), QgsComposerItem::mComposition, QgsComposerItem::mRotation, mRotationMap, QgsComposerItem::rotation(), QgsComposerItem::rotationChanged(), and setRotation().

int QgsComposerPicture::rotationMap (  )  const

Returns the id of the rotation map.

Definition at line 363 of file qgscomposerpicture.cpp.

References QgsComposerMap::id(), and mRotationMap.

bool QgsComposerPicture::useRotationMap (  )  const [inline]

True if the rotation is taken from a map item.

Definition at line 62 of file qgscomposerpicture.h.

void QgsComposerPicture::setRotation ( double  r  )  [virtual, slot]

Sets the rotation and adapts the item rect.

Reimplemented from QgsComposerItem.

Definition at line 247 of file qgscomposerpicture.cpp.

References mPictureHeight, mPictureWidth, QgsComposerItem::setRotation(), QgsComposerItem::setSceneRect(), and QgsComposerItem::sizeChangedByRotation().

Referenced by readXML(), and setRotationMap().

QRectF QgsComposerPicture::boundedSVGRect ( double  deviceWidth,
double  deviceHeight 
) [private]

Calculates bounding rect for svg file (mSourcefile) such that aspect ratio is correct.

Definition at line 184 of file qgscomposerpicture.cpp.

References mDefaultSvgSize.

Referenced by paint().

QRectF QgsComposerPicture::boundedImageRect ( double  deviceWidth,
double  deviceHeight 
) [private]

Calculates bounding rect for image such that aspect ratio is correct.

Definition at line 167 of file qgscomposerpicture.cpp.

References mImage.

Referenced by paint().

void QgsComposerPicture::updateImageFromSvg (  )  [private]

Updates content of mImage using svg generator.

Definition at line 220 of file qgscomposerpicture.cpp.

References mImage, mSourceFile, and mSvgCacheUpToDate.

Referenced by paint().

void QgsComposerPicture::settingsChanged (  )  [signal]

Tell the configuration widget that the settings need to be updated.

Referenced by setPictureFile(), and setSceneRect().


Member Data Documentation

QImage QgsComposerPicture::mImage [private]

Definition at line 88 of file qgscomposerpicture.h.

Referenced by boundedImageRect(), paint(), setPictureFile(), and updateImageFromSvg().

Definition at line 89 of file qgscomposerpicture.h.

Referenced by pictureFile(), setPictureFile(), updateImageFromSvg(), and writeXML().

Definition at line 90 of file qgscomposerpicture.h.

Referenced by paint(), and setPictureFile().

False if image needs to be rendered from svg.

Definition at line 92 of file qgscomposerpicture.h.

Referenced by paint(), readXML(), setPictureFile(), setSceneRect(), and updateImageFromSvg().

Definition at line 93 of file qgscomposerpicture.h.

Referenced by paint(), and readXML().

Definition at line 94 of file qgscomposerpicture.h.

Referenced by paint().

Definition at line 95 of file qgscomposerpicture.h.

Referenced by paint().

Definition at line 97 of file qgscomposerpicture.h.

Referenced by boundedSVGRect(), readXML(), and setPictureFile().

Map that sets the rotation (or 0 if this picture uses map independent rotation).

Definition at line 99 of file qgscomposerpicture.h.

Referenced by readXML(), rotationMap(), setRotationMap(), and writeXML().

Width of the picture (in mm).

Definition at line 101 of file qgscomposerpicture.h.

Referenced by paint(), QgsComposerPicture(), readXML(), setRotation(), setSceneRect(), and writeXML().

Height of the picture (in mm).

Definition at line 103 of file qgscomposerpicture.h.

Referenced by paint(), QgsComposerPicture(), readXML(), setRotation(), setSceneRect(), and writeXML().


The documentation for this class was generated from the following files:

Generated on Sat Feb 4 19:17:27 2012 for Quantum GIS API Documentation by  doxygen 1.5.6