QGIS API Documentation  3.9.0-Master (224899f119)
qgssvgannotation.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgssvgannotation.h
3  ------------------------
4  begin : November, 2012
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
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 QGSSVGANNOTATION_H
19 #define QGSSVGANNOTATION_H
20 
21 #include "qgsannotation.h"
22 #include <QSvgRenderer>
23 #include "qgis_core.h"
24 
31 class CORE_EXPORT QgsSvgAnnotation: public QgsAnnotation
32 {
33  Q_OBJECT
34 
35  public:
36 
40  QgsSvgAnnotation( QObject *parent SIP_TRANSFERTHIS = nullptr );
41 
42  QgsSvgAnnotation *clone() const override SIP_FACTORY;
43 
44  void writeXml( QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context ) const override;
45  void readXml( const QDomElement &itemElem, const QgsReadWriteContext &context ) override;
46 
51  void setFilePath( const QString &file );
52 
57  QString filePath() const { return mFilePath; }
58 
62  static QgsSvgAnnotation *create() SIP_FACTORY { return new QgsSvgAnnotation(); }
63 
64  protected:
65 
66  void renderAnnotation( QgsRenderContext &context, QSizeF size ) const override;
67 
68  private:
69  mutable QSvgRenderer mSvgRenderer; // QSvgRenderer::render methods are not const?
70  QString mFilePath;
71 };
72 
73 #endif // QGSSVGANNOTATION_H
The class is used as a container of context for various read/write operations on other objects...
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
An annotation which renders the contents of an SVG file.
virtual void writeXml(QDomElement &elem, QDomDocument &doc, const QgsReadWriteContext &context) const =0
Writes the annotation state to a DOM element.
QString filePath() const
Returns the file path for the source SVG file.
Abstract base class for annotation items which are drawn over a map.
Definition: qgsannotation.h:49
virtual void renderAnnotation(QgsRenderContext &context, QSizeF size) const =0
Renders the annotation&#39;s contents to a target /a context at the specified /a size.
virtual void readXml(const QDomElement &itemElem, const QgsReadWriteContext &context)=0
Restores the annotation&#39;s state from a DOM element.
#define SIP_FACTORY
Definition: qgis_sip.h:76
static QgsSvgAnnotation * create()
Returns a new QgsSvgAnnotation object.
Contains information about the context of a rendering operation.
virtual QgsAnnotation * clone() const =0
Clones the annotation, returning a new copy of the annotation reflecting the annotation&#39;s current sta...