QGIS API Documentation
4.3.0-Master (0cef2469b72)
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
#include <QPointer>
26
27
class
QgsProject
;
28
37
class
CORE_EXPORT
QgsColorSchemeRegistry
38
{
39
public
:
48
QgsColorSchemeRegistry
() =
default
;
49
50
virtual
~QgsColorSchemeRegistry
();
51
57
void
populateFromInstance
();
58
65
void
addDefaultSchemes
();
66
71
void
initStyleScheme
();
72
79
void
addUserSchemes
();
80
88
void
addColorScheme
(
QgsColorScheme
*scheme
SIP_TRANSFER
);
89
96
bool
removeColorScheme
(
QgsColorScheme
*scheme );
97
102
QList<QgsColorScheme *>
schemes
()
const
;
103
109
QList<QgsColorScheme *>
schemes
(
QgsColorScheme::SchemeFlag
flag )
const
;
110
111
117
#ifndef SIP_RUN
118
template
<
class
T>
void
schemes
( QList<T *> &schemeList )
const
119
{
120
schemeList.clear();
121
QList<QgsColorScheme *> schemeInstanceList =
schemes
();
122
QList<QgsColorScheme *>::iterator schemeIt = schemeInstanceList.begin();
123
for
( ; schemeIt != schemeInstanceList.end(); ++schemeIt )
124
{
125
T *scheme =
dynamic_cast<
T *
>
( *schemeIt );
126
if
( scheme )
127
{
128
schemeList.push_back( scheme );
129
}
130
}
131
}
132
#endif
133
150
void
setRandomStyleColorScheme(
QgsColorScheme
*scheme );
151
162
QgsColorScheme
*randomStyleColorScheme();
163
185
QColor fetchRandomStyleColor()
const
;
186
194
void
setProject(
QgsProject
*project );
195
196
197
private
:
198
QList< QgsColorScheme * > mColorSchemeList;
199
200
QgsColorScheme
*mRandomStyleColorScheme =
nullptr
;
201
QgsNamedColorList
mRandomStyleColors;
202
203
QPointer< QgsProject > mProject;
204
205
mutable
int
mNextRandomStyleColorIndex = 0;
206
207
int
mNextRandomStyleColorDirection = 1;
208
};
209
210
211
#endif
QgsColorSchemeRegistry::addDefaultSchemes
void addDefaultSchemes()
Adds all default color schemes to this color scheme.
Definition
qgscolorschemeregistry.cpp:52
QgsColorSchemeRegistry::addColorScheme
void addColorScheme(QgsColorScheme *scheme)
Adds a color scheme to the registry.
Definition
qgscolorschemeregistry.cpp:91
QgsColorSchemeRegistry::schemes
QList< QgsColorScheme * > schemes() const
Returns all color schemes in the registry.
Definition
qgscolorschemeregistry.cpp:96
QgsColorSchemeRegistry::populateFromInstance
void populateFromInstance()
Adds all color schemes from the global instance to this color scheme.
Definition
qgscolorschemeregistry.cpp:39
QgsColorSchemeRegistry::removeColorScheme
bool removeColorScheme(QgsColorScheme *scheme)
Removes all matching color schemes from the registry.
Definition
qgscolorschemeregistry.cpp:197
QgsColorSchemeRegistry::initStyleScheme
void initStyleScheme()
Initializes the default random style color scheme for the user.
Definition
qgscolorschemeregistry.cpp:62
QgsColorSchemeRegistry::addUserSchemes
void addUserSchemes()
Creates schemes for all gpl palettes in the user's palettes folder.
Definition
qgscolorschemeregistry.cpp:73
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:118
QgsColorScheme
Abstract base class for color schemes.
Definition
qgscolorscheme.h:49
QgsColorScheme::SchemeFlag
SchemeFlag
Flags for controlling behavior of color scheme.
Definition
qgscolorscheme.h:73
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition
qgsproject.h:114
QgsNamedColorList
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
Definition
qgscolorscheme.h:37
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgscolorscheme.h
Generated on
for QGIS API Documentation by
1.17.0