QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
qgsmaskidprovider.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsmaskidprovider.cpp
3
---------------------
4
begin : August 2019
5
copyright : (C) 2019 by Hugo Mercier / Oslandia
6
email : infos at oslandia 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
#include "
qgsmaskidprovider.h
"
17
18
#include "
qgssymbollayerreference.h
"
19
20
int
QgsMaskIdProvider::insertLabelLayer
(
const
QString &layerId,
const
QString &ruleId,
const
QSet<QgsSymbolLayerReference> &maskedSymbolLayers )
21
{
22
const
QString strId = layerId + ruleId;
23
// look for an existing symbol layer set
24
const
int
maskId
= mLabelLayers.indexOf( maskedSymbolLayers );
25
if
(
maskId
!= -1 )
26
{
27
// add the layer id / rule id to the existing mask id
28
mMaskIds[
maskId
].insert( strId );
29
return
maskId
;
30
}
31
// else
32
mLabelLayers.push_back( maskedSymbolLayers );
33
mMaskIds.push_back( QSet<QString>() << strId );
34
return
mMaskIds.size() - 1;
35
}
36
37
int
QgsMaskIdProvider::maskId
(
const
QString &labelLayerId,
const
QString &labelRuleId )
const
38
{
39
if
( labelLayerId.isEmpty() )
40
return
-1;
41
42
const
QString
id
= labelLayerId + labelRuleId;
43
for
(
int
i = 0; i < mMaskIds.size(); i++ )
44
{
45
if
( mMaskIds[i].contains(
id
) )
46
return
i;
47
}
48
return
-1;
49
}
50
51
int
QgsMaskIdProvider::size
()
const
52
{
53
return
mMaskIds.size();
54
}
QgsMaskIdProvider::size
int size() const
Returns the number of identifiers allocated.
Definition
qgsmaskidprovider.cpp:51
QgsMaskIdProvider::maskId
int maskId(const QString &labelLayerId=QString(), const QString &labelRuleId=QString()) const
Returns the mask id associated with a label layer and its optional label rule.
Definition
qgsmaskidprovider.cpp:37
QgsMaskIdProvider::insertLabelLayer
int insertLabelLayer(const QString &layerId, const QString &ruleId, const QSet< QgsSymbolLayerReference > &maskedSymbolLayers)
Inserts a label layer to the provider and returns its associated mask id.
Definition
qgsmaskidprovider.cpp:20
qgsmaskidprovider.h
qgssymbollayerreference.h
Generated on
for QGIS API Documentation by
1.17.0