Skip to content
Permalink
Browse files
[vectortile] Fix mapbox gl converter fill-outline-color / background …
…logic
  • Loading branch information
nirvn authored and nyalldawson committed Nov 19, 2021
1 parent 01e391e commit bec58364f995b141b71ff90d4285825e2de20cca
Showing with 29 additions and 26 deletions.
  1. +29 −26 src/core/vectortile/qgsmapboxglstyleconverter.cpp
@@ -228,39 +228,42 @@ bool QgsMapBoxGlStyleConverter::parseFillLayer( const QVariantMap &jsonLayer, Qg
}

QColor fillOutlineColor;
if ( !isBackgroundStyle && !jsonPaint.contains( QStringLiteral( "fill-outline-color" ) ) )
if ( !isBackgroundStyle )
{
// fill-outline-color
if ( fillColor.isValid() )
fillOutlineColor = fillColor;
else
if ( !jsonPaint.contains( QStringLiteral( "fill-outline-color" ) ) )
{
// use fill color data defined property
if ( ddProperties.isActive( QgsSymbolLayer::PropertyFillColor ) )
ddProperties.setProperty( QgsSymbolLayer::PropertyStrokeColor, ddProperties.property( QgsSymbolLayer::PropertyFillColor ) );
// fill-outline-color
if ( fillColor.isValid() )
fillOutlineColor = fillColor;
else
{
// use fill color data defined property
if ( ddProperties.isActive( QgsSymbolLayer::PropertyFillColor ) )
ddProperties.setProperty( QgsSymbolLayer::PropertyStrokeColor, ddProperties.property( QgsSymbolLayer::PropertyFillColor ) );
}
}
}
else
{
const QVariant jsonFillOutlineColor = jsonPaint.value( QStringLiteral( "fill-outline-color" ) );
switch ( jsonFillOutlineColor.type() )
else
{
case QVariant::Map:
ddProperties.setProperty( QgsSymbolLayer::PropertyStrokeColor, parseInterpolateColorByZoom( jsonFillOutlineColor.toMap(), context, &fillOutlineColor ) );
break;
const QVariant jsonFillOutlineColor = jsonPaint.value( QStringLiteral( "fill-outline-color" ) );
switch ( jsonFillOutlineColor.type() )
{
case QVariant::Map:
ddProperties.setProperty( QgsSymbolLayer::PropertyStrokeColor, parseInterpolateColorByZoom( jsonFillOutlineColor.toMap(), context, &fillOutlineColor ) );
break;

case QVariant::List:
case QVariant::StringList:
ddProperties.setProperty( QgsSymbolLayer::PropertyStrokeColor, parseValueList( jsonFillOutlineColor.toList(), PropertyType::Color, context, 1, 255, &fillOutlineColor ) );
break;
case QVariant::List:
case QVariant::StringList:
ddProperties.setProperty( QgsSymbolLayer::PropertyStrokeColor, parseValueList( jsonFillOutlineColor.toList(), PropertyType::Color, context, 1, 255, &fillOutlineColor ) );
break;

case QVariant::String:
fillOutlineColor = parseColor( jsonFillOutlineColor.toString(), context );
break;
case QVariant::String:
fillOutlineColor = parseColor( jsonFillOutlineColor.toString(), context );
break;

default:
context.pushWarning( QObject::tr( "%1: Skipping unsupported fill-outline-color type (%2)" ).arg( context.layerId(), QMetaType::typeName( jsonFillOutlineColor.type() ) ) );
break;
default:
context.pushWarning( QObject::tr( "%1: Skipping unsupported fill-outline-color type (%2)" ).arg( context.layerId(), QMetaType::typeName( jsonFillOutlineColor.type() ) ) );
break;
}
}
}

0 comments on commit bec5836

Please sign in to comment.