@@ -571,8 +571,7 @@ std::unique_ptr<QgsSymbol> QgsArcGisRestUtils::parseEsriSymbolJson( const QVaria
571
571
}
572
572
else if ( type == QLatin1String ( " esriPFS" ) )
573
573
{
574
- // picture fill - not supported
575
- return nullptr ;
574
+ return parseEsriPictureFillSymbolJson ( symbolData );
576
575
}
577
576
else if ( type == QLatin1String ( " esriPMS" ) )
578
577
{
@@ -628,6 +627,51 @@ std::unique_ptr<QgsFillSymbol> QgsArcGisRestUtils::parseEsriFillSymbolJson( cons
628
627
return symbol;
629
628
}
630
629
630
+ std::unique_ptr<QgsFillSymbol> QgsArcGisRestUtils::parseEsriPictureFillSymbolJson ( const QVariantMap &symbolData )
631
+ {
632
+ bool ok = false ;
633
+
634
+ double widthInPixels = symbolData.value ( QStringLiteral ( " width" ) ).toInt ( &ok );
635
+ if ( !ok )
636
+ return nullptr ;
637
+
638
+ const double xScale = symbolData.value ( QStringLiteral ( " xscale" ) ).toDouble ( &ok );
639
+ if ( !qgsDoubleNear ( xScale, 0.0 ) )
640
+ widthInPixels *= xScale;
641
+
642
+ const double angleCCW = symbolData.value ( QStringLiteral ( " angle" ) ).toDouble ( &ok );
643
+ double angleCW = 0 ;
644
+ if ( ok )
645
+ angleCW = -angleCCW;
646
+
647
+ const double xOffset = symbolData.value ( QStringLiteral ( " xoffset" ) ).toDouble ();
648
+ const double yOffset = symbolData.value ( QStringLiteral ( " yoffset" ) ).toDouble ();
649
+
650
+ QString symbolPath ( symbolData.value ( QStringLiteral ( " imageData" ) ).toString () );
651
+ symbolPath.prepend ( QLatin1String ( " base64:" ) );
652
+
653
+ QgsSymbolLayerList layers;
654
+ std::unique_ptr< QgsRasterFillSymbolLayer > fillLayer = qgis::make_unique< QgsRasterFillSymbolLayer >( symbolPath );
655
+ fillLayer->setWidth ( widthInPixels );
656
+ fillLayer->setAngle ( angleCW );
657
+ fillLayer->setWidthUnit ( QgsUnitTypes::RenderPixels );
658
+ fillLayer->setOffset ( QPointF ( xOffset, yOffset ) );
659
+ fillLayer->setOffsetUnit ( QgsUnitTypes::RenderPoints );
660
+ layers.append ( fillLayer.release () );
661
+
662
+ const QVariantMap outlineData = symbolData.value ( QStringLiteral ( " outline" ) ).toMap ();
663
+ QColor lineColor = parseEsriColorJson ( outlineData.value ( QStringLiteral ( " color" ) ) );
664
+ Qt::PenStyle penStyle = parseEsriLineStyle ( outlineData.value ( QStringLiteral ( " style" ) ).toString () );
665
+ double penWidthInPoints = outlineData.value ( QStringLiteral ( " width" ) ).toDouble ( &ok );
666
+
667
+ std::unique_ptr< QgsSimpleLineSymbolLayer > lineLayer = qgis::make_unique< QgsSimpleLineSymbolLayer >( lineColor, penWidthInPoints, penStyle );
668
+ lineLayer->setWidthUnit ( QgsUnitTypes::RenderPoints );
669
+ layers.append ( lineLayer.release () );
670
+
671
+ std::unique_ptr< QgsFillSymbol > symbol = qgis::make_unique< QgsFillSymbol >( layers );
672
+ return symbol;
673
+ }
674
+
631
675
QgsSimpleMarkerSymbolLayerBase::Shape parseEsriMarkerShape ( const QString &style )
632
676
{
633
677
if ( style == QLatin1String ( " esriSMSCircle" ) )
0 commit comments