QGIS API Documentation
2.8.2-Wien
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
src
core
symbology-ng
qgsrendererv2registry.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsrendererv2registry.cpp
3
---------------------
4
begin : November 2009
5
copyright : (C) 2009 by Martin Dobias
6
email : wonder dot sk at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#include "
qgsrendererv2registry.h
"
16
17
// default renderers
18
#include "
qgssinglesymbolrendererv2.h
"
19
#include "
qgscategorizedsymbolrendererv2.h
"
20
#include "
qgsgraduatedsymbolrendererv2.h
"
21
#include "
qgsrulebasedrendererv2.h
"
22
#include "
qgspointdisplacementrenderer.h
"
23
#include "
qgsinvertedpolygonrenderer.h
"
24
#include "
qgsheatmaprenderer.h
"
25
26
QgsRendererV2Registry::QgsRendererV2Registry
()
27
{
28
// add default renderers
29
addRenderer
(
new
QgsRendererV2Metadata
(
"singleSymbol"
,
30
QObject::tr
(
"Single Symbol"
),
31
QgsSingleSymbolRendererV2::create
,
32
QgsSingleSymbolRendererV2::createFromSld
) );
33
34
addRenderer
(
new
QgsRendererV2Metadata
(
"categorizedSymbol"
,
35
QObject::tr
(
"Categorized"
),
36
QgsCategorizedSymbolRendererV2::create
) );
37
38
addRenderer
(
new
QgsRendererV2Metadata
(
"graduatedSymbol"
,
39
QObject::tr
(
"Graduated"
),
40
QgsGraduatedSymbolRendererV2::create
) );
41
42
addRenderer
(
new
QgsRendererV2Metadata
(
"RuleRenderer"
,
43
QObject::tr
(
"Rule-based"
),
44
QgsRuleBasedRendererV2::create
,
45
QgsRuleBasedRendererV2::createFromSld
) );
46
47
addRenderer
(
new
QgsRendererV2Metadata
(
"pointDisplacement"
,
48
QObject::tr
(
"Point displacement"
),
49
QgsPointDisplacementRenderer::create
) );
50
51
addRenderer
(
new
QgsRendererV2Metadata
(
"invertedPolygonRenderer"
,
52
QObject::tr
(
"Inverted polygons"
),
53
QgsInvertedPolygonRenderer::create
) );
54
55
addRenderer
(
new
QgsRendererV2Metadata
(
"heatmapRenderer"
,
56
QObject::tr
(
"Heatmap"
),
57
QgsHeatmapRenderer::create
) );
58
}
59
60
QgsRendererV2Registry::~QgsRendererV2Registry
()
61
{
62
foreach
( QString name,
mRenderers
.keys() )
63
{
64
delete
mRenderers
[name];
65
}
66
mRenderers
.clear();
67
}
68
69
QgsRendererV2Registry
*
QgsRendererV2Registry::instance
()
70
{
71
static
QgsRendererV2Registry
mInstance;
72
return
&mInstance;
73
}
74
75
76
bool
QgsRendererV2Registry::addRenderer
(
QgsRendererV2AbstractMetadata
* metadata )
77
{
78
if
( metadata == NULL ||
mRenderers
.contains( metadata->
name
() ) )
79
return
false
;
80
81
mRenderers
[metadata->
name
()] = metadata;
82
mRenderersOrder
<< metadata->
name
();
83
return
true
;
84
}
85
86
bool
QgsRendererV2Registry::removeRenderer
( QString rendererName )
87
{
88
if
( !
mRenderers
.contains( rendererName ) )
89
return
false
;
90
91
delete
mRenderers
[rendererName];
92
mRenderers
.remove( rendererName );
93
mRenderersOrder
.removeAll( rendererName );
94
return
true
;
95
}
96
97
QgsRendererV2AbstractMetadata
*
QgsRendererV2Registry::rendererMetadata
( QString rendererName )
98
{
99
return
mRenderers
.value( rendererName );
100
}
101
102
QgsRendererV2Metadata::~QgsRendererV2Metadata
() {}
103
104
QStringList
QgsRendererV2Registry::renderersList
()
105
{
106
return
mRenderersOrder
;
107
}
Generated on Sun May 10 2015 16:33:25 for QGIS API Documentation by
1.8.1.2