QGIS API Documentation 3.43.0-Master (58029bba303)
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
19#include "qgspallabeling.h"
20
21
23{
25 {
26 context.setOriginalValueVariable( mLabelMarginDistance );
27 mLabelMarginDistance = properties.valueAsDouble( QgsPalLayerSettings::Property::LabelMarginDistance, context, mLabelMarginDistance );
28 }
30 {
31 context.setOriginalValueVariable( mAllowDuplicateRemoval );
32 mAllowDuplicateRemoval = properties.valueAsBool( QgsPalLayerSettings::Property::RemoveDuplicateLabels, context, mAllowDuplicateRemoval );
33 }
35 {
36 context.setOriginalValueVariable( mMinDistanceToDuplicate );
37 mMinDistanceToDuplicate = properties.valueAsDouble( QgsPalLayerSettings::Property::RemoveDuplicateLabelDistance, context, mMinDistanceToDuplicate );
38 }
39}
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.
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.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
void updateDataDefinedProperties(const QgsPropertyCollection &properties, QgsExpressionContext &context)
Updates the thinning settings to respect any data defined properties set within the specified propert...
@ LabelMarginDistance
Minimum distance from labels for this feature to other labels.
@ RemoveDuplicateLabelDistance
Minimum distance from labels for this feature to other labels with duplicate text.
@ RemoveDuplicateLabels
Whether this feature can cause removal of duplicate labels.
A grouped map of multiple QgsProperty objects, each referenced by an integer key value.
bool isActive(int key) const final
Returns true if the collection contains an active property with the specified key.