17 #ifndef QGSCOMPOSERPICTURE_H
18 #define QGSCOMPOSERPICTURE_H
23 #include <QSvgRenderer>
63 void paint( QPainter* painter,
const QStyleOptionGraphicsItem* itemStyle, QWidget* pWidget );
71 void setPictureFile(
const QString& path );
79 QString pictureFile()
const;
89 bool writeXML( QDomElement& elem, QDomDocument & doc )
const;
95 bool readXML(
const QDomElement& itemElem,
const QDomDocument& doc );
100 Q_DECL_DEPRECATED
double rotation()
const {
return mPictureRotation; }
118 void setRotationMap(
int composerMapId );
127 int rotationMap()
const;
214 virtual void setPictureRotation(
double r );
221 virtual void setResizeMode( ResizeMode mode );
231 virtual void setUsePictureExpression(
bool useExpression );
240 virtual void setPictureExpression( QString expression );
246 void refreshPicture();
252 void updatePictureExpression();
257 void recalculateSize();
261 void pictureRotationChanged(
double newRotation );
268 QRectF boundedSVGRect(
double deviceWidth,
double deviceHeight );
270 QRectF boundedImageRect(
double deviceWidth,
double deviceHeight );
273 QSizeF pictureSize();
299 void loadPicture(
const QFile &
file );
302 QString evalPictureExpression();
310 QRect clippedImageRect(
double &boundRectWidthMM,
double &boundRectHeightMM, QSize imageRectPixels );
Class for parsing and evaluation of expressions (formerly called "search strings").
bool imageSizeConsideringRotation(double &width, double &height, double rotation) const
Calculates width and hight of the picture (in mm) such that it fits into the item frame with the give...
virtual bool readXML(const QDomElement &itemElem, const QDomDocument &doc)=0
sets state from Dom document
virtual void setRotation(double r)
Sets the item rotation.
Q_DECL_DEPRECATED double rotation() const
Returns the rotation used for drawing the picture within the composer item.
Mode mode() const
Returns the current picture mode (image format).
A item that forms part of a map composition.
QgsComposerItem::ItemPositionMode mPictureAnchor
A composer class that displays svg files or raster format (jpg, png, ...)
ResizeMode resizeMode() const
Returns the resize mode used for drawing the picture within the composer item's frame.
ItemPositionMode pictureAnchor() const
Returns the picture's current anchor, which controls how it is placed within the picture item's frame...
bool mUseSourceExpression
const QgsComposerMap * mRotationMap
Map that sets the rotation (or 0 if this picture uses map independent rotation)
double mPictureHeight
Height of the picture (in mm)
bool useRotationMap() const
True if the picture rotation is matched to a map item.
Graphics scene for map printing.
Object representing map window.
QString mSourceExpression
bool cornerPointOnRotatedAndScaledRect(double &x, double &y, double width, double height, double rotation) const
Calculates corner point after rotation and scaling.
QString pictureExpression() const
Returns the expression the item is using for the picture source.
virtual void setSceneRect(const QRectF &rectangle)
Sets this items bound in scene coordinates such that 1 item size units corresponds to 1 scene size un...
double mPictureWidth
Width of the picture (in mm)
double pictureRotation() const
Returns the rotation used for drawing the picture within the item's frame.
void init(bool manageZValue)
double mPictureRotation
Image rotation.
virtual bool writeXML(QDomElement &elem, QDomDocument &doc) const =0
stores state in Dom element
void sizeChangedByRotation(double &width, double &height, double rotation)
Calculates width / height of the bounding box of a rotated rectangle.
bool usePictureExpression() const
Returns whether the picture item is using an expression for the image source.
virtual int type() const
return correct graphics item type.
QgsExpression * mPictureExpr