/
qgssvgannotation.h
73 lines (58 loc) · 2.37 KB
/
qgssvgannotation.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/***************************************************************************
qgssvgannotation.h
------------------------
begin : November, 2012
copyright : (C) 2012 by Marco Hugentobler
email : marco dot hugentobler at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSSVGANNOTATION_H
#define QGSSVGANNOTATION_H
#include "qgsannotation.h"
#include <QSvgRenderer>
#include "qgis_core.h"
/**
* \class QgsSvgAnnotation
* \ingroup core
* An annotation which renders the contents of an SVG file.
* \since QGIS 3.0
*/
class CORE_EXPORT QgsSvgAnnotation: public QgsAnnotation
{
Q_OBJECT
public:
/**
* Constructor for QgsSvgAnnotation.
*/
QgsSvgAnnotation( QObject *parent SIP_TRANSFERTHIS = nullptr );
QgsSvgAnnotation *clone() const override SIP_FACTORY;
virtual void writeXml( QDomElement &elem, QDomDocument &doc ) const override;
virtual void readXml( const QDomElement &itemElem, const QDomDocument &doc ) override;
/**
* Sets the file path for the source SVG file.
* \see filePath()
*/
void setFilePath( const QString &file );
/**
* Returns the file path for the source SVG file.
* \see setFilePath()
*/
QString filePath() const { return mFilePath; }
/**
* Returns a new QgsSvgAnnotation object.
*/
static QgsSvgAnnotation *create() SIP_FACTORY { return new QgsSvgAnnotation(); }
protected:
void renderAnnotation( QgsRenderContext &context, QSizeF size ) const override;
private:
mutable QSvgRenderer mSvgRenderer; // QSvgRenderer::render methods are not const?
QString mFilePath;
};
#endif // QGSSVGANNOTATION_H