-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgsrendererv2registry.sip
81 lines (63 loc) · 2.69 KB
/
qgsrendererv2registry.sip
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
class QgsRendererV2Widget /External/;
class QgsRendererV2AbstractMetadata
{
%TypeHeaderCode
#include <qgsrendererv2registry.h>
%End
public:
QgsRendererV2AbstractMetadata( QString name, QString visibleName, QIcon icon = QIcon() );
virtual ~QgsRendererV2AbstractMetadata();
QString name() const;
QString visibleName() const;
QIcon icon() const;
void setIcon( const QIcon& icon );
/** Return new instance of the renderer given the DOM element. Returns NULL on error.
* Pure virtual function: must be implemented in derived classes. */
virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) = 0;
/** Return new instance of settings widget for the renderer. Returns NULL on error. */
virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) /Factory/;
virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) /Factory/;
};
/**
Convenience metadata class that uses static functions to create renderer and its widget.
*/
class QgsRendererV2Metadata : QgsRendererV2AbstractMetadata
{
%TypeHeaderCode
#include <qgsrendererv2registry.h>
%End
public:
virtual QgsFeatureRendererV2* createRenderer( QDomElement& elem ) /Factory/;
virtual QgsRendererV2Widget* createRendererWidget( QgsVectorLayer* layer, QgsStyleV2* style, QgsFeatureRendererV2* renderer ) /Factory/;
virtual QgsFeatureRendererV2* createRendererFromSld( QDomElement& elem, QGis::GeometryType geomType ) /Factory/;
// QgsRendererV2CreateFunc createFunction() const;
// QgsRendererV2WidgetFunc widgetFunction() const;
// QgsFeatureRendererV2* (*)( QDomElement&, QGis::GeometryType geomType ) createFromSldFunction() const;
// void setWidgetFunction( QgsRendererV2WidgetFunc f );
private:
QgsRendererV2Metadata(); // pretend this is private
};
/**
Registry of renderers.
This is a singleton, renderers can be added / removed at any time
*/
class QgsRendererV2Registry
{
%TypeHeaderCode
#include <qgsrendererv2registry.h>
%End
public:
static QgsRendererV2Registry* instance();
//! add a renderer to registry. Takes ownership of the metadata object.
bool addRenderer( QgsRendererV2AbstractMetadata* metadata /Transfer/ );
//! remove renderer from registry
bool removeRenderer( QString rendererName );
//! get metadata for particular renderer. Returns NULL if not found in registry.
QgsRendererV2AbstractMetadata* rendererMetadata( QString rendererName );
//! return a list of available renderers
QStringList renderersList();
protected:
//! protected constructor
QgsRendererV2Registry();
~QgsRendererV2Registry();
};