QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsmaplayerstylemanager.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmaplayerstylemanager.h
3
--------------------------------------
4
Date : January 2015
5
Copyright : (C) 2015 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
16
#ifndef QGSMAPLAYERSTYLEMANAGER_H
17
#define QGSMAPLAYERSTYLEMANAGER_H
18
19
#include "qgis_core.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsmaplayerstyle.h
"
22
23
#include <QByteArray>
24
#include <QMap>
25
#include <QObject>
26
#include <QStringList>
27
28
class
QDomElement;
29
30
class
QgsMapLayer
;
31
55
class
CORE_EXPORT
QgsMapLayerStyleManager
:
public
QObject
56
{
57
Q_OBJECT
58
public
:
63
QgsMapLayerStyleManager
(
QgsMapLayer
*
layer
SIP_TRANSFERTHIS
);
64
66
QgsMapLayer
*
layer
()
const
{
return
mLayer; }
67
69
void
reset();
70
72
void
readXml(
const
QDomElement &mgrElement );
74
void
writeXml( QDomElement &mgrElement )
const
;
75
77
QStringList styles()
const
;
78
83
QMap<QString, QgsMapLayerStyle> mapLayerStyles()
const
;
84
86
QgsMapLayerStyle
style(
const
QString &name )
const
;
87
92
bool
addStyle(
const
QString &name,
const
QgsMapLayerStyle
&style );
93
98
bool
addStyleFromLayer(
const
QString &name );
99
104
bool
removeStyle(
const
QString &name );
105
110
bool
renameStyle(
const
QString &name,
const
QString &newName );
111
113
QString currentStyle()
const
;
114
119
bool
setCurrentStyle(
const
QString &name );
120
126
bool
setOverrideStyle(
const
QString &styleDef );
128
bool
restoreOverrideStyle();
129
134
static
bool
isDefault(
const
QString &styleName );
135
142
void
copyStylesFrom(
QgsMapLayerStyleManager
*other );
143
144
signals:
146
void
styleAdded
(
const
QString &name );
148
void
styleRemoved
(
const
QString &name );
150
void
styleRenamed
(
const
QString &oldName,
const
QString &newName );
152
void
currentStyleChanged
(
const
QString ¤tName );
153
154
private
:
155
QgsMapLayer
*mLayer =
nullptr
;
156
QMap<QString, QgsMapLayerStyle> mStyles;
157
QString mCurrentStyle;
158
QgsMapLayerStyle
*mOverriddenOriginalStyle =
nullptr
;
159
static
QString defaultStyleName();
160
};
161
162
#endif
// QGSMAPLAYERSTYLEMANAGER_H
QgsMapLayerStyleManager
Management of styles for use with one map layer.
Definition
qgsmaplayerstylemanager.h:56
QgsMapLayerStyleManager::styleAdded
void styleAdded(const QString &name)
Emitted when a new style has been added.
QgsMapLayerStyleManager::styleRenamed
void styleRenamed(const QString &oldName, const QString &newName)
Emitted when a style has been renamed.
QgsMapLayerStyleManager::layer
QgsMapLayer * layer() const
Gets pointer to the associated map layer.
Definition
qgsmaplayerstylemanager.h:66
QgsMapLayerStyleManager::QgsMapLayerStyleManager
QgsMapLayerStyleManager(QgsMapLayer *layer)
Construct a style manager associated with a map layer (must not be nullptr).
Definition
qgsmaplayerstylemanager.cpp:31
QgsMapLayerStyleManager::currentStyleChanged
void currentStyleChanged(const QString ¤tName)
Emitted when the current style has been changed.
QgsMapLayerStyleManager::styleRemoved
void styleRemoved(const QString &name)
Emitted when a style has been removed.
QgsMapLayerStyle
Stores style information (renderer, opacity, labeling, diagrams etc.) applicable to a map layer.
Definition
qgsmaplayerstyle.h:41
QgsMapLayer
Base class for all map layer types.
Definition
qgsmaplayer.h:83
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
qgsmaplayerstyle.h
Generated on
for QGIS API Documentation by
1.17.0