QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsmaplayerstyle.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmaplayersty.h
3
--------------------------------------
4
Date : September 2019
5
Copyright : (C) 2018 by Denis Rouzaud
6
Email : denis@opengis.ch
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 QGSMAPLAYERSTYLE_H
17
#define QGSMAPLAYERSTYLE_H
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
22
#include <QByteArray>
23
#include <QMap>
24
#include <QObject>
25
#include <QStringList>
26
27
class
QDomElement;
28
class
QgsMapLayer
;
29
40
class
CORE_EXPORT
QgsMapLayerStyle
41
{
42
public
:
44
QgsMapLayerStyle
() =
default
;
45
47
explicit
QgsMapLayerStyle
(
const
QString &
xmlData
);
48
50
bool
isValid
()
const
;
51
53
void
clear
();
54
56
QString
xmlData
()
const
;
57
59
void
readFromLayer
(
QgsMapLayer
*layer );
61
void
writeToLayer
(
QgsMapLayer
*layer )
const
;
62
64
void
readXml
(
const
QDomElement &styleElement );
66
void
writeXml
( QDomElement &styleElement )
const
;
67
68
private
:
69
QString mXmlData;
70
};
71
72
79
class
CORE_EXPORT
QgsMapLayerStyleOverride
80
{
81
public
:
86
QgsMapLayerStyleOverride
(
QgsMapLayer
*layer )
87
: mLayer( layer )
88
{}
89
90
~QgsMapLayerStyleOverride
();
91
96
void
setOverrideStyle(
const
QString &style );
97
98
private
:
99
QgsMapLayer
*mLayer =
nullptr
;
100
bool
mStyleOverridden =
false
;
101
};
102
#endif
// QGSMAPLAYERSTYLE_H
QgsMapLayerStyleOverride
Restore overridden layer style on destruction.
Definition
qgsmaplayerstyle.h:80
QgsMapLayerStyleOverride::QgsMapLayerStyleOverride
QgsMapLayerStyleOverride(QgsMapLayer *layer)
Construct a style override object associated with a map layer.
Definition
qgsmaplayerstyle.h:86
QgsMapLayerStyle::readXml
void readXml(const QDomElement &styleElement)
Read style configuration (for project file reading).
Definition
qgsmaplayerstyle.cpp:86
QgsMapLayerStyle::readFromLayer
void readFromLayer(QgsMapLayer *layer)
Store layer's active style information in the instance.
Definition
qgsmaplayerstyle.cpp:48
QgsMapLayerStyle::clear
void clear()
Remove any stored style data (will get invalid).
Definition
qgsmaplayerstyle.cpp:38
QgsMapLayerStyle::writeToLayer
void writeToLayer(QgsMapLayer *layer) const
Apply stored layer's style information to the layer.
Definition
qgsmaplayerstyle.cpp:65
QgsMapLayerStyle::isValid
bool isValid() const
Tell whether the style is valid (i.e. there is something stored in it).
Definition
qgsmaplayerstyle.cpp:33
QgsMapLayerStyle::writeXml
void writeXml(QDomElement &styleElement) const
Write style configuration (for project file writing).
Definition
qgsmaplayerstyle.cpp:93
QgsMapLayerStyle::xmlData
QString xmlData() const
Returns XML content of the style.
Definition
qgsmaplayerstyle.cpp:43
QgsMapLayerStyle::QgsMapLayerStyle
QgsMapLayerStyle()=default
construct invalid style
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:83
qgis_sip.h
Generated on
for QGIS API Documentation by
1.17.0