QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgscolorschemeregistry.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgscolorschemeregistry.h
3
------------------------
4
begin : July 2014
5
copyright : (C) 2014 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef QGSCOLORSCHEMEREGISTRY_H
19
#define QGSCOLORSCHEMEREGISTRY_H
20
21
#include "qgis_core.h"
22
#include "
qgscolorscheme.h
"
23
24
#include <QList>
25
34
class
CORE_EXPORT
QgsColorSchemeRegistry
35
{
36
public
:
40
QgsColorSchemeRegistry
() =
default
;
41
42
virtual
~QgsColorSchemeRegistry
();
43
49
void
populateFromInstance
();
50
57
void
addDefaultSchemes
();
58
63
void
initStyleScheme
();
64
71
void
addUserSchemes
();
72
80
void
addColorScheme
(
QgsColorScheme
*scheme
SIP_TRANSFER
);
81
88
bool
removeColorScheme
(
QgsColorScheme
*scheme );
89
94
QList<QgsColorScheme *>
schemes
()
const
;
95
101
QList<QgsColorScheme *>
schemes
(
QgsColorScheme::SchemeFlag
flag )
const
;
102
103
109
#ifndef SIP_RUN
110
template
<
class
T>
void
schemes
( QList<T *> &schemeList )
const
111
{
112
schemeList.clear();
113
QList<QgsColorScheme *> schemeInstanceList =
schemes
();
114
QList<QgsColorScheme *>::iterator schemeIt = schemeInstanceList.begin();
115
for
( ; schemeIt != schemeInstanceList.end(); ++schemeIt )
116
{
117
T *scheme =
dynamic_cast<
T *
>
( *schemeIt );
118
if
( scheme )
119
{
120
schemeList.push_back( scheme );
121
}
122
}
123
}
124
#endif
125
142
void
setRandomStyleColorScheme(
QgsColorScheme
*scheme );
143
154
QgsColorScheme
*randomStyleColorScheme();
155
177
QColor fetchRandomStyleColor()
const
;
178
179
private
:
180
QList< QgsColorScheme * > mColorSchemeList;
181
182
QgsColorScheme
*mRandomStyleColorScheme =
nullptr
;
183
QgsNamedColorList
mRandomStyleColors;
184
185
mutable
int
mNextRandomStyleColorIndex = 0;
186
187
int
mNextRandomStyleColorDirection = 1;
188
};
189
190
191
#endif
QgsColorSchemeRegistry::addDefaultSchemes
void addDefaultSchemes()
Adds all default color schemes to this color scheme.
Definition
qgscolorschemeregistry.cpp:51
QgsColorSchemeRegistry::addColorScheme
void addColorScheme(QgsColorScheme *scheme)
Adds a color scheme to the registry.
Definition
qgscolorschemeregistry.cpp:89
QgsColorSchemeRegistry::schemes
QList< QgsColorScheme * > schemes() const
Returns all color schemes in the registry.
Definition
qgscolorschemeregistry.cpp:94
QgsColorSchemeRegistry::populateFromInstance
void populateFromInstance()
Adds all color schemes from the global instance to this color scheme.
Definition
qgscolorschemeregistry.cpp:38
QgsColorSchemeRegistry::removeColorScheme
bool removeColorScheme(QgsColorScheme *scheme)
Removes all matching color schemes from the registry.
Definition
qgscolorschemeregistry.cpp:175
QgsColorSchemeRegistry::initStyleScheme
void initStyleScheme()
Initializes the default random style color scheme for the user.
Definition
qgscolorschemeregistry.cpp:60
QgsColorSchemeRegistry::addUserSchemes
void addUserSchemes()
Creates schemes for all gpl palettes in the user's palettes folder.
Definition
qgscolorschemeregistry.cpp:71
QgsColorSchemeRegistry::QgsColorSchemeRegistry
QgsColorSchemeRegistry()=default
Constructor for an empty color scheme registry.
QgsColorSchemeRegistry::schemes
void schemes(QList< T * > &schemeList) const
Returns color schemes of a specific type.
Definition
qgscolorschemeregistry.h:110
QgsColorScheme
Abstract base class for color schemes.
Definition
qgscolorscheme.h:48
QgsColorScheme::SchemeFlag
SchemeFlag
Flags for controlling behavior of color scheme.
Definition
qgscolorscheme.h:72
QgsNamedColorList
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
Definition
qgscolorscheme.h:36
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgscolorscheme.h
Generated on
for QGIS API Documentation by
1.17.0