|
@@ -904,7 +904,7 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer, |
|
|
QgsPropertyCollection ddLabelProperties; |
|
|
|
|
|
double textSize = 16.0 * context.pixelSizeConversionFactor(); |
|
|
QString textSizeProperty; |
|
|
QgsProperty textSizeProperty; |
|
|
if ( jsonLayout.contains( QStringLiteral( "text-size" ) ) ) |
|
|
{ |
|
|
const QVariant jsonTextSize = jsonLayout.value( QStringLiteral( "text-size" ) ); |
|
@@ -932,7 +932,7 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer, |
|
|
break; |
|
|
} |
|
|
|
|
|
if ( !textSizeProperty.isEmpty() ) |
|
|
if ( textSizeProperty ) |
|
|
{ |
|
|
ddLabelProperties.setProperty( QgsPalLayerSettings::Size, textSizeProperty ); |
|
|
} |
|
@@ -1453,14 +1453,14 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer, |
|
|
switch ( jsonTextOffset.type() ) |
|
|
{ |
|
|
case QVariant::Map: |
|
|
textOffsetProperty = parseInterpolatePointByZoom( jsonTextOffset.toMap(), context, textSizeProperty.isEmpty() ? textSize : 1.0, &textOffset ); |
|
|
if ( textSizeProperty.isEmpty() ) |
|
|
textOffsetProperty = parseInterpolatePointByZoom( jsonTextOffset.toMap(), context, !textSizeProperty ? textSize : 1.0, &textOffset ); |
|
|
if ( !textSizeProperty ) |
|
|
{ |
|
|
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "abs(array_get(%1,1))-%2" ).arg( textOffsetProperty ).arg( textSize ) ); |
|
|
} |
|
|
else |
|
|
{ |
|
|
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,abs(array_get(%1,1))*@text_size-@text_size)" ).arg( textOffsetProperty ).arg( textSizeProperty ) ); |
|
|
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,abs(array_get(%1,1))*@text_size-@text_size)" ).arg( textOffsetProperty, textSizeProperty.asExpression() ) ); |
|
|
} |
|
|
ddLabelProperties.setProperty( QgsPalLayerSettings::LinePlacementOptions, QStringLiteral( "if(array_get(%1,1)>0,'BL','AL')" ).arg( textOffsetProperty ) ); |
|
|
break; |
|
@@ -1481,9 +1481,9 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer, |
|
|
labelSettings.distUnits = context.targetUnit(); |
|
|
labelSettings.dist = std::abs( textOffset.y() ) - textSize; |
|
|
labelSettings.lineSettings().setPlacementFlags( textOffset.y() > 0.0 ? QgsLabeling::BelowLine : QgsLabeling::AboveLine ); |
|
|
if ( !textSizeProperty.isEmpty() && textOffsetProperty.isEmpty() ) |
|
|
if ( textSizeProperty && textOffsetProperty.isEmpty() ) |
|
|
{ |
|
|
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,%1*@text_size-@text_size)" ).arg( std::abs( textOffset.y() / textSize ) ).arg( ( textSizeProperty ) ) ); |
|
|
ddLabelProperties.setProperty( QgsPalLayerSettings::LabelDistance, QStringLiteral( "with_variable('text_size',%2,%1*@text_size-@text_size)" ).arg( std::abs( textOffset.y() / textSize ) ).arg( textSizeProperty.asExpression() ) ); |
|
|
} |
|
|
} |
|
|
} |
|
|