-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsscalebarrendererregistry.h
90 lines (76 loc) · 2.91 KB
/
qgsscalebarrendererregistry.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/***************************************************************************
QgsScaleBarRendererRegistry.h
---------------------
begin : March 2020
copyright : (C) 2020 by Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* 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 QGSSCALEBARRENDERERREGISTRY_H
#define QGSSCALEBARRENDERERREGISTRY_H
#include "qgis_core.h"
#include "qgis.h"
class QgsScaleBarRenderer;
/**
* \ingroup core
* The QgsScaleBarRendererRegistry manages registered scalebar renderers.
*
* A reference to the QgsScaleBarRendererRegistry can be obtained from
* QgsApplication::scalebarRendererRegistry().
*
* \since QGIS 3.14
*/
class CORE_EXPORT QgsScaleBarRendererRegistry
{
public:
/**
* You should not normally need to create your own scalebar renderer registry.
*
* Use the one provided by `QgsApplication::scalebarRendererRegistry()` instead.
*/
explicit QgsScaleBarRendererRegistry();
~QgsScaleBarRendererRegistry();
/**
* Returns a list of the renderer ids currently contained in the registry.
*/
QStringList renderers() const;
/**
* Returns a list of the renderer ids currently contained in the registry,
* sorted in an order respecting the renderer's sort keys and display strings.
*/
QStringList sortedRendererList() const;
/**
* Adds a new \a renderer to the registry.
*
* Ownership is transferred to the registry.
*/
void addRenderer( QgsScaleBarRenderer *renderer SIP_TRANSFER );
/**
* Removes the renderer with matching \a id from the registry.
*/
void removeRenderer( const QString &id );
/**
* Creates a new scalebar renderer by \a id. If there is no such \a id registered,
* NULLPTR will be returned instead.
*
* The caller takes ownership of the returned object.
*/
QgsScaleBarRenderer *renderer( const QString &id ) const SIP_TRANSFERBACK;
/**
* Returns the translated, user-visible name for the renderer with matching \a id.
*/
QString visibleName( const QString &id ) const;
/**
* Returns the sorting key for the renderer with matching \a id.
*/
int sortKey( const QString &id ) const;
private:
QHash<QString, QgsScaleBarRenderer *> mRenderers;
};
#endif // QGSSCALEBARRENDERERREGISTRY_H