Skip to content
Permalink
Browse files

Convert interpolated fill pattern sprites

  • Loading branch information
nirvn authored and nyalldawson committed Sep 13, 2020
1 parent 73e73c0 commit b898ec2e1c7113f35f899e7edfe251ecffc70b57
Showing with 15 additions and 33 deletions.
  1. +15 −33 src/core/vectortile/qgsmapboxglstyleconverter.cpp
@@ -325,46 +325,28 @@ bool QgsMapBoxGlStyleConverter::parseFillLayer( const QVariantMap &jsonLayer, Qg
// String: {"fill-pattern": "dash-t"}
// Object: {"fill-pattern":{"stops":[[11,"wetland8"],[12,"wetland16"]]}}

switch ( fillPatternJson.type() )
QSize spriteSize;
QString spriteProperty, spriteSizeProperty;
const QString sprite = retrieveSpriteAsBase64( fillPatternJson, context, spriteSize, spriteProperty, spriteSizeProperty );
if ( !sprite.isEmpty() )
{
case QVariant::String:
{
QSize spriteSize;
QString spriteProperty, spriteSizeProperty;
const QString sprite = retrieveSpriteAsBase64( fillPatternJson, context, spriteSize, spriteProperty, spriteSizeProperty );
if ( !sprite.isEmpty() )
{
// when fill-pattern exists, set and insert QgsRasterFillSymbolLayer
QgsRasterFillSymbolLayer *rasterFill = new QgsRasterFillSymbolLayer();
rasterFill->setImageFilePath( sprite );
rasterFill->setCoordinateMode( QgsRasterFillSymbolLayer::Viewport );

if ( rasterOpacity >= 0 )
rasterFill->setOpacity( rasterOpacity );
rasterFill->setDataDefinedProperties( ddRasterProperties );
// when fill-pattern exists, set and insert QgsRasterFillSymbolLayer
QgsRasterFillSymbolLayer *rasterFill = new QgsRasterFillSymbolLayer();
rasterFill->setImageFilePath( sprite );
rasterFill->setCoordinateMode( QgsRasterFillSymbolLayer::Viewport );

symbol->appendSymbolLayer( rasterFill );
}
break;
if ( rasterOpacity >= 0 )
{
rasterFill->setOpacity( rasterOpacity );
}

case QVariant::Map:
if ( !spriteProperty.isEmpty() )
{
#if 0
// if Object, simpify into one sprite.
// TODO:
if isinstance( fill_pattern, dict )
{
pattern_stops = fill_pattern.get( "stops", [None] )
fill_pattern = pattern_stops[-1][-1]
}
#endif
FALLTHROUGH
ddRasterProperties.setProperty( QgsSymbolLayer::PropertyFile, QgsProperty::fromExpression( spriteProperty ) );
}

default:

break;
rasterFill->setDataDefinedProperties( ddRasterProperties );
symbol->appendSymbolLayer( rasterFill );
}
}

0 comments on commit b898ec2

Please sign in to comment.
You can’t perform that action at this time.