QGIS API Documentation 4.3.0-Master (d57cc4a041c)
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:
40
41 QString type() const override;
42 bool writeXml( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
43 bool readXml( const QDomElement &element, const QgsReadWriteContext &context ) override;
45
50
56 QString path() const { return mPath; }
57
61 Qgis::PictureFormat format() const { return mFormat; }
62
69 void setPath( Qgis::PictureFormat format, const QString &path );
70
76 bool lockAspectRatio() const;
77
83 void setLockAspectRatio( bool locked );
84
91 Qgis::BillboardScaleMode billboard3DScaleMode() const { return m3DBillboardScaleMode; }
92
99 void setBillboard3DScaleMode( Qgis::BillboardScaleMode mode ) { m3DBillboardScaleMode = mode; }
100
107 QSizeF billboard3DSize() const { return m3DSize; }
108
115 void setBillboard3DSize( const QSizeF &size ) { m3DSize = size; }
116
117 protected:
118 void renderInBounds( QgsRenderContext &context, const QRectF &painterBounds, QgsFeedback *feedback ) override;
119
120 private:
121 QString mPath;
123 bool mLockAspectRatio = true;
124
126 QSizeF m3DSize;
127
128#ifdef SIP_RUN
130#endif
131};
132#endif // QGSANNOTATIONPICTUREITEM_H
PictureFormat
Picture formats.
Definition qgis.h:5776
@ Unknown
Invalid or unknown image type.
Definition qgis.h:5779
BillboardScaleMode
3D billboard scaling modes.
Definition qgis.h:4441
@ ViewIndependent
Billboard has a fixed pixel size on the screen, regardless of the camera distance.
Definition qgis.h:4442
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.
QString path() const
Returns the path of the image used to render the item.
QSizeF billboard3DSize() const
Returns the 3D billboard size for the picture.
~QgsAnnotationPictureItem() override
void setBillboard3DScaleMode(Qgis::BillboardScaleMode mode)
Sets the 3D billboard scale mode for the picture.
QgsAnnotationPictureItem(Qgis::PictureFormat format, const QString &path, const QgsRectangle &bounds)
Constructor for QgsAnnotationPictureItem, rendering the specified image path within the specified bou...
Qgis::BillboardScaleMode billboard3DScaleMode() const
Returns the 3D billboard scale mode for the picture.
void setBillboard3DSize(const QSizeF &size)
Sets the 3D billboard size for the picture.
static QgsAnnotationPictureItem * create()
Creates a new polygon annotation item.
virtual void renderInBounds(QgsRenderContext &context, const QRectF &painterRect, QgsFeedback *feedback)=0
Renders the item to the specified render context.
QgsRectangle bounds() const
Returns the bounds of the item.
QgsAnnotationRectItem(const QgsRectangle &bounds)
Constructor for QgsAnnotationRectItem, rendering the annotation within the specified bounds geometry.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
A container for the context for various read/write operations on objects.
A rectangle specified with double values.
Contains information about the context of a rendering operation.
#define SIP_FACTORY
Definition qgis_sip.h:83