Skip to content
Permalink
Browse files

Fix placement of line centered markers during MapBox GL conversion

  • Loading branch information
nyalldawson committed Sep 9, 2020
1 parent 542b1c8 commit 0fc1a739e5ed40ca1b6040670f079de6d99ebda8
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/core/vectortile/qgsmapboxglstyleconverter.cpp
@@ -1045,7 +1045,7 @@ bool QgsMapBoxGlStyleConverter::parseSymbolLayerAsRenderer( const QVariantMap &j
{
QgsPropertyCollection ddProperties;

double spacing = 1.0;
double spacing = -1.0;
if ( jsonLayout.contains( QStringLiteral( "symbol-spacing" ) ) )
{
const QVariant jsonSpacing = jsonLayout.value( QStringLiteral( "symbol-spacing" ) );
@@ -1112,9 +1112,14 @@ bool QgsMapBoxGlStyleConverter::parseSymbolLayerAsRenderer( const QVariantMap &j
}
}

QgsMarkerLineSymbolLayer *lineSymbol = new QgsMarkerLineSymbolLayer( rotateMarkers, spacing );
QgsMarkerLineSymbolLayer *lineSymbol = new QgsMarkerLineSymbolLayer( rotateMarkers, spacing > 0 ? spacing : 1 );
lineSymbol->setOutputUnit( context.targetUnit() );
lineSymbol->setDataDefinedProperties( ddProperties );
if ( spacing <= 0 )
{
// if spacing isn't specified, it's a central point marker only
lineSymbol->setPlacement( QgsTemplatedLineSymbolLayerBase::CentralPoint );
}

QgsRasterMarkerSymbolLayer *markerLayer = new QgsRasterMarkerSymbolLayer( );
const QImage sprite = retrieveSprite( jsonLayout.value( QStringLiteral( "icon-image" ) ).toString(), context );

0 comments on commit 0fc1a73

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