24using namespace Qt::StringLiterals;
37 const QString cleanedString = handlingString.trimmed();
38 if ( cleanedString.compare(
"prevent"_L1, Qt::CaseInsensitive ) == 0 )
40 else if ( cleanedString.compare(
"allowifneeded"_L1, Qt::CaseInsensitive ) == 0 )
42 else if ( cleanedString.compare(
"alwaysallow"_L1, Qt::CaseInsensitive ) == 0 )
50 bool handledAsString =
false;
51 if ( !stringValue.isEmpty() )
53 const QString cleanedString = stringValue.trimmed();
54 if ( cleanedString.compare(
"LargestPartOnly"_L1, Qt::CaseInsensitive ) == 0 )
56 handledAsString =
true;
59 else if ( cleanedString.compare(
"LabelEveryPart"_L1, Qt::CaseInsensitive ) == 0 )
61 handledAsString =
true;
64 else if ( cleanedString.compare(
"SplitLabelTextLinesOverParts"_L1, Qt::CaseInsensitive ) == 0 )
66 handledAsString =
true;
72 if ( !handledAsString )
92 if ( value.compare(
"TreatWhitespaceAsCollision"_L1, Qt::CaseInsensitive ) == 0 )
94 else if ( value.compare(
"IgnoreWhitespaceCollisions"_L1, Qt::CaseInsensitive ) == 0 )
@ LabelLargestPartOnly
Place a label only on the largest part from the geometry.
@ SplitLabelTextLinesOverParts
Splits the label text over the parts of the geometry, such that each consecutive part is labeled with...
@ LabelEveryPartWithEntireLabel
Place the (same) entire label over every part from the geometry.
@ TreatWhitespaceAsCollision
Treat overlapping whitespace text in labels and whitespace overlapping obstacles as collisions.
@ IgnoreWhitespaceCollisions
Ignore overlapping whitespace text in labels and whitespace overlapping obstacles.
@ AllowOverlapAtNoCost
Labels may freely overlap other labels, at no cost.
@ AllowOverlapIfRequired
Avoids overlapping labels when possible, but permit overlaps if labels for features cannot otherwise ...
@ PreventOverlap
Do not allow labels to overlap other labels.
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.
QString valueAsString(int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a string.
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 placement settings to respect any data defined properties set within the specified proper...
@ WhitespaceCollisionHandling
Whitespace collision handling.
@ AllowDegradedPlacement
Allow degraded label placements.
@ OverlapHandling
Overlap handling technique.
@ LabelAllParts
Multipart geometry behavior.
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.