QGIS API Documentation
3.36.0-Maidenhead (09951dc0acf)
Toggle main menu visibility
Main Page
Related Pages
Topics
Namespaces
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
w
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
z
Variables
Typedefs
Enumerations
Enumerator
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
2
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
c
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
y
z
Related Symbols
3
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
Files
File List
File Members
All
3
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
z
Variables
a
b
c
d
e
f
g
h
i
l
n
o
p
q
r
s
t
u
w
Typedefs
3
a
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
Enumerations
Enumerator
c
l
s
t
Macros
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
w
x
y
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
src
core
layertree
qgscolorramplegendnode.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgscolorramplegendnode.h
3
--------------------------------------
4
Date : December 2020
5
Copyright : (C) 2020 by Nyall Dawson
6
Email : nyall dot dawson 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
16
#ifndef QGSCOLORRAMPLEGENDNODE_H
17
#define QGSCOLORRAMPLEGENDNODE_H
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
#include "
qgslayertreemodellegendnode.h
"
22
#include "
qgscolorramplegendnodesettings.h
"
23
24
class
QgsColorRamp
;
25
32
class
CORE_EXPORT
QgsColorRampLegendNode
:
public
QgsLayerTreeModelLegendNode
33
{
34
Q_OBJECT
35
36
37
public
:
38
47
QgsColorRampLegendNode
(
QgsLayerTreeLayer
*nodeLayer,
QgsColorRamp
*ramp
SIP_TRANSFER
,
48
const
QString &minimumLabel,
const
QString &maximumLabel, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
49
59
QgsColorRampLegendNode
(
QgsLayerTreeLayer
*nodeLayer,
QgsColorRamp
*ramp
SIP_TRANSFER
,
60
const
QgsColorRampLegendNodeSettings
&settings,
double
minimumValue,
61
double
maximumValue, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
62
63
64
QVariant
data
(
int
role )
const override
;
65
QSizeF
drawSymbol
(
const
QgsLegendSettings
&settings,
ItemContext
*ctx,
double
itemHeight )
const override
;
66
QSizeF
drawSymbolText
(
const
QgsLegendSettings
&settings,
ItemContext
*ctx, QSizeF symbolSize )
const override
;
67
QJsonObject
exportSymbolToJson
(
const
QgsLegendSettings
&settings,
const
QgsRenderContext
&context )
const override
;
68
74
void
setIconSize
( QSize size ) { mIconSize = size; }
75
81
QSize
iconSize
()
const
{
return
mIconSize; }
82
86
const
QgsColorRamp
*ramp()
const
;
87
93
QgsColorRampLegendNodeSettings
settings()
const
;
94
100
void
setSettings(
const
QgsColorRampLegendNodeSettings
&settings );
101
102
private
:
103
void
init(
QgsLayerTreeLayer
*nodeLayer );
104
105
QString labelForMinimum()
const
;
106
QString labelForMaximum()
const
;
107
108
std::unique_ptr< QgsColorRamp > mRamp;
109
110
mutable
QPixmap mPixmap;
// cached symbol preview
111
QSize mIconSize;
112
113
QgsColorRampLegendNodeSettings
mSettings;
114
double
mMinimumValue = 0;
115
double
mMaximumValue = 0;
116
117
};
32
class
CORE_EXPORT
QgsColorRampLegendNode
:
public
QgsLayerTreeModelLegendNode
{
…
};
118
119
120
121
#endif
// QGSCOLORRAMPLEGENDNODE_H
QgsColorRampLegendNodeSettings
Settings for a color ramp legend node.
Definition
qgscolorramplegendnodesettings.h:38
QgsColorRampLegendNode
A legend node which renders a color ramp.
Definition
qgscolorramplegendnode.h:33
QgsColorRampLegendNode::iconSize
QSize iconSize() const
Returns the icon size, which is how large the ramp will render in a layer tree widget.
Definition
qgscolorramplegendnode.h:81
QgsColorRampLegendNode::setIconSize
void setIconSize(QSize size)
Set the icon size, which controls how large the ramp will render in a layer tree widget.
Definition
qgscolorramplegendnode.h:74
QgsColorRamp
Abstract base class for color ramps.
Definition
qgscolorramp.h:29
QgsLayerTreeLayer
Layer tree node points to a map layer.
Definition
qgslayertreelayer.h:43
QgsLayerTreeModelLegendNode
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
Definition
qgslayertreemodellegendnode.h:52
QgsLayerTreeModelLegendNode::data
virtual QVariant data(int role) const =0
Returns data associated with the item. Must be implemented in derived class.
QgsLayerTreeModelLegendNode::exportSymbolToJson
virtual QJsonObject exportSymbolToJson(const QgsLegendSettings &settings, const QgsRenderContext &context) const
Adds a symbol in base64 string within a JSON object with the key "icon".
Definition
qgslayertreemodellegendnode.cpp:169
QgsLayerTreeModelLegendNode::drawSymbol
virtual QSizeF drawSymbol(const QgsLegendSettings &settings, ItemContext *ctx, double itemHeight) const
Draws symbol on the left side of the item.
Definition
qgslayertreemodellegendnode.cpp:129
QgsLayerTreeModelLegendNode::drawSymbolText
virtual QSizeF drawSymbolText(const QgsLegendSettings &settings, ItemContext *ctx, QSizeF symbolSize) const
Draws label on the right side of the item.
Definition
qgslayertreemodellegendnode.cpp:186
QgsLegendSettings
The QgsLegendSettings class stores the appearance and layout settings for legend drawing with QgsLege...
Definition
qgslegendsettings.h:38
QgsRenderContext
Contains information about the context of a rendering operation.
Definition
qgsrendercontext.h:61
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:53
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:36
qgscolorramplegendnodesettings.h
qgslayertreemodellegendnode.h
QgsLayerTreeModelLegendNode::ItemContext
Definition
qgslayertreemodellegendnode.h:180
Generated on Mon Feb 26 2024 10:02:44 for QGIS API Documentation by
1.9.8