QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
labeling
qgslabelthinningsettings.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgslabelthinningsettings.cpp
3
----------------------------
4
Date : December 2019
5
Copyright : (C) 2019 by Nyall Dawson
6
Email : nyall dot dawson 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
#include "
qgslabelthinningsettings.h
"
17
18
#include "
qgsexpressioncontext.h
"
19
#include "
qgspallabeling.h
"
20
#include "
qgspropertycollection.h
"
21
22
void
QgsLabelThinningSettings::updateDataDefinedProperties
(
const
QgsPropertyCollection
&properties,
QgsExpressionContext
&context )
23
{
24
if
( properties.
isActive
(
QgsPalLayerSettings::Property::LabelMarginDistance
) )
25
{
26
context.
setOriginalValueVariable
( mLabelMarginDistance );
27
mLabelMarginDistance = properties.
valueAsDouble
(
QgsPalLayerSettings::Property::LabelMarginDistance
, context, mLabelMarginDistance );
28
}
29
if
( properties.
isActive
(
QgsPalLayerSettings::Property::RemoveDuplicateLabels
) )
30
{
31
context.
setOriginalValueVariable
( mAllowDuplicateRemoval );
32
mAllowDuplicateRemoval = properties.
valueAsBool
(
QgsPalLayerSettings::Property::RemoveDuplicateLabels
, context, mAllowDuplicateRemoval );
33
}
34
if
( properties.
isActive
(
QgsPalLayerSettings::Property::RemoveDuplicateLabelDistance
) )
35
{
36
context.
setOriginalValueVariable
( mMinDistanceToDuplicate );
37
mMinDistanceToDuplicate = properties.
valueAsDouble
(
QgsPalLayerSettings::Property::RemoveDuplicateLabelDistance
, context, mMinDistanceToDuplicate );
38
}
39
}
QgsAbstractPropertyCollection::valueAsBool
bool valueAsBool(int key, const QgsExpressionContext &context, bool defaultValue=false, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as an boolean.
Definition
qgspropertycollection.cpp:91
QgsAbstractPropertyCollection::valueAsDouble
double valueAsDouble(int key, const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a double.
Definition
qgspropertycollection.cpp:69
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition
qgsexpressioncontext.h:491
QgsExpressionContext::setOriginalValueVariable
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
Definition
qgsexpressioncontext.cpp:754
QgsLabelThinningSettings::updateDataDefinedProperties
void updateDataDefinedProperties(const QgsPropertyCollection &properties, QgsExpressionContext &context)
Updates the thinning settings to respect any data defined properties set within the specified propert...
Definition
qgslabelthinningsettings.cpp:22
QgsPalLayerSettings::Property::LabelMarginDistance
@ LabelMarginDistance
Minimum distance from labels for this feature to other labels.
Definition
qgspallabeling.h:245
QgsPalLayerSettings::Property::RemoveDuplicateLabelDistance
@ RemoveDuplicateLabelDistance
Minimum distance from labels for this feature to other labels with duplicate text.
Definition
qgspallabeling.h:247
QgsPalLayerSettings::Property::RemoveDuplicateLabels
@ RemoveDuplicateLabels
Whether this feature can cause removal of duplicate labels.
Definition
qgspallabeling.h:246
QgsPropertyCollection
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
Definition
qgspropertycollection.h:348
QgsPropertyCollection::isActive
bool isActive(int key) const final
Returns true if the collection contains an active property with the specified key.
Definition
qgspropertycollection.cpp:286
qgsexpressioncontext.h
qgslabelthinningsettings.h
qgspallabeling.h
qgspropertycollection.h
Generated on
for QGIS API Documentation by
1.17.0