QGIS API Documentation 3.41.0-Master (3c143d501a8)
Loading...
Searching...
No Matches
qgsannotationpictureitem.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsannotationpictureitem.h
3 ----------------
4 begin : July 2024
5 copyright : (C) 2024 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSANNOTATIONPICTUREITEM_H
19#define QGSANNOTATIONPICTUREITEM_H
20
21#include "qgis_core.h"
22#include "qgis_sip.h"
24
32{
33 public:
34
39 QgsAnnotationPictureItem( Qgis::PictureFormat format, const QString &path, const QgsRectangle &bounds );
41
42 QString type() const override;
43 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
44 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
46
51
57 QString path() const { return mPath; }
58
62 Qgis::PictureFormat format() const { return mFormat; }
63
70 void setPath( Qgis::PictureFormat format, const QString &path );
71
77 bool lockAspectRatio() const;
78
84 void setLockAspectRatio( bool locked );
85
86 protected:
87
88 void renderInBounds( QgsRenderContext &context, const QRectF &painterBounds, QgsFeedback *feedback ) override;
89
90 private:
91
92 QString mPath;
94 bool mLockAspectRatio = true;
95
96#ifdef SIP_RUN
98#endif
99
100};
101#endif // QGSANNOTATIONPICTUREITEM_H
PictureFormat
Picture formats.
Definition qgis.h:4946
@ Unknown
Invalid or unknown image type.
virtual bool writeXml(QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context) const =0
Writes the item's state into an XML element.
virtual QString type() const =0
Returns a unique (untranslated) string identifying the type of item.
virtual bool readXml(const QDomElement &element, const QgsReadWriteContext &context)=0
Reads the item's state from the given DOM element.
virtual QgsAnnotationItem * clone() const =0
Returns a clone of the item.
An annotation item which renders a picture.
Qgis::PictureFormat format() const
Returns the picture format.
~QgsAnnotationPictureItem() override
Abstract base class for annotation items which render annotations in a rectangular shape.
virtual void renderInBounds(QgsRenderContext &context, const QRectF &painterRect, QgsFeedback *feedback)=0
Renders the item to the specified render context.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
The class is used as a container of context for various read/write operations on other objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
#define SIP_FACTORY
Definition qgis_sip.h:76