17 #ifndef QGSLAYOUTITEMPICTURE_H 18 #define QGSLAYOUTITEMPICTURE_H 20 #include "qgis_core.h" 24 #include <QSvgRenderer> 73 int type()
const override;
74 QIcon
icon()
const override;
90 void setPicturePath(
const QString &path );
99 QString picturePath()
const;
155 void setNorthOffset(
double offset );
192 void setSvgFillColor(
const QColor &color );
209 void setSvgStrokeColor(
const QColor &color );
225 void setSvgStrokeWidth(
double width );
240 bool isMissingImage()
const;
249 QString evaluatedPath()
const;
258 void setPictureRotation(
double rotation );
277 void recalculateSize();
283 void pictureRotationChanged(
double newRotation );
297 QRectF boundedSVGRect(
double deviceWidth,
double deviceHeight );
299 QRectF boundedImageRect(
double deviceWidth,
double deviceHeight );
302 QSizeF pictureSize();
308 Format mMode = FormatUnknown;
310 QSize mDefaultSvgSize;
313 double mPictureRotation = 0;
315 QString mRotationMapUuid;
317 QPointer< QgsLayoutItemMap > mRotationMap;
322 double mNorthOffset = 0.0;
325 double mPictureWidth = 0.0;
327 double mPictureHeight = 0.0;
332 QColor mSvgFillColor = QColor( 255, 255, 255 );
333 QColor mSvgStrokeColor = QColor( 0, 0, 0 );
334 double mSvgStrokeWidth = 0.2;
336 bool mHasExpressionError =
false;
337 bool mLoaded =
false;
338 bool mLoadingSvg =
false;
339 bool mIsMissingImage =
false;
340 QString mEvaluatedPath;
343 void loadPicture(
const QString &path );
349 QRect clippedImageRect(
double &boundRectWidthMM,
double &boundRectHeightMM, QSize imageRectPixels );
354 void loadRemotePicture(
const QString &url );
359 void loadLocalPicture(
const QString &path );
365 void updateMapRotation();
370 friend class TestQgsCompositionConverter;
374 #endif // QGSLAYOUTITEMPICTURE_H Class for parsing and evaluation of expressions (formerly called "search strings").
The class is used as a container of context for various read/write operations on other objects...
virtual QIcon icon() const
Returns the item's icon.
Base class for graphical items within a QgsLayout.
int type() const override
Returns a unique graphics item type identifier.
double northOffset() const
Returns the offset added to the picture's rotation from a map's North.
Stretches image to fit frame, ignores aspect ratio.
QColor svgStrokeColor() const
Returns the stroke color used for parametrized SVG files.
A layout item subclass that displays SVG files or raster format images (jpg, png, ...
double pictureRotation() const
Returns the rotation used for drawing the picture within the item's frame, in degrees clockwise...
Format mode() const
Returns the current picture mode (image format).
virtual void refreshDataDefinedProperty(QgsLayoutObject::DataDefinedProperty property=QgsLayoutObject::AllProperties)
Refreshes a data defined property for the item by reevaluating the property's value and redrawing the...
NorthMode northMode() const
Returns the mode used to align the picture to a map's North.
ReferencePoint
Fixed position reference point.
Invalid or unknown image type.
QgsLayoutItem::ReferencePoint pictureAnchor() const
Returns the picture's current anchor, which controls how it is placed within the picture item's frame...
Layout graphical items for displaying a map.
virtual bool readPropertiesFromElement(const QDomElement &element, const QDomDocument &document, const QgsReadWriteContext &context)
Sets item state from a DOM element.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
double svgStrokeWidth() const
Returns the stroke width (in layout units) used for parametrized SVG files.
Upper left corner of item.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
QColor svgFillColor() const
Returns the fill color used for parametrized SVG files.
ResizeMode resizeMode() const
Returns the resize mode used for drawing the picture within the composer item's frame.
Contains settings and helpers relating to a render of a QgsLayoutItem.
virtual void finalizeRestoreFromXml()
Called after all pending items have been restored from XML.
Enlarges image to fit frame, then resizes frame to fit resultant image.
QgsCompositionConverter class converts a QGIS 2.x composition to a QGIS 3.x layout.
NorthMode
Method for syncing rotation to a map's North direction.
Format
Format of source image.
ResizeMode
Controls how pictures are scaled within the item's frame.
virtual QSizeF applyItemSizeConstraint(QSizeF targetSize)
Applies any item-specific size constraint handling to a given targetSize in layout units...
virtual bool writePropertiesToElement(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const
Stores item state within an XML DOM element.
Draws image at original size and clips any portion which falls outside frame.
virtual void draw(QgsLayoutItemRenderContext &context)=0
Draws the item's contents using the specified item render context.
Enlarges image to fit frame while maintaining aspect ratio of picture.
DataDefinedProperty
Data defined properties for different item types.