@@ -1150,6 +1150,82 @@ void QgsMapBoxGlStyleConverter::parseSymbolLayer( const QVariantMap &jsonLayer,
1150
1150
labelingStyle.setLabelSettings ( labelSettings );
1151
1151
1152
1152
hasLabeling = true ;
1153
+
1154
+ if ( jsonLayout.contains ( QStringLiteral ( " icon-image" ) ) )
1155
+ {
1156
+ QSize spriteSize;
1157
+ const QString sprite = retrieveSpriteAsBase64 ( jsonLayout.value ( QStringLiteral ( " icon-image" ) ).toString (), context, spriteSize );
1158
+ if ( !sprite.isEmpty () )
1159
+ {
1160
+ hasRenderer = true ;
1161
+ QgsRasterMarkerSymbolLayer *rasterMarker = new QgsRasterMarkerSymbolLayer ( );
1162
+ rasterMarker->setPath ( sprite );
1163
+ rasterMarker->setSize ( context.pixelSizeConversionFactor () * spriteSize.width () );
1164
+ rasterMarker->setSizeUnit ( context.targetUnit () );
1165
+
1166
+ QgsPropertyCollection markerDdProperties;
1167
+ double rotation = 0.0 ;
1168
+ if ( jsonLayout.contains ( QStringLiteral ( " icon-rotate" ) ) )
1169
+ {
1170
+ const QVariant jsonIconRotate = jsonLayout.value ( QStringLiteral ( " icon-rotate" ) );
1171
+ switch ( jsonIconRotate.type () )
1172
+ {
1173
+ case QVariant::Int:
1174
+ case QVariant::Double:
1175
+ rotation = jsonIconRotate.toDouble ();
1176
+ break ;
1177
+
1178
+ case QVariant::Map:
1179
+ markerDdProperties.setProperty ( QgsSymbolLayer::PropertyAngle, parseInterpolateByZoom ( jsonIconRotate.toMap (), context, context.pixelSizeConversionFactor (), &rotation ) );
1180
+ break ;
1181
+
1182
+ case QVariant::List:
1183
+ case QVariant::StringList:
1184
+ markerDdProperties.setProperty ( QgsSymbolLayer::PropertyAngle, parseInterpolateListByZoom ( jsonIconRotate.toList (), PropertyType::Numeric, context, context.pixelSizeConversionFactor (), 255 , nullptr , &rotation ) );
1185
+ break ;
1186
+
1187
+ default :
1188
+ context.pushWarning ( QObject::tr ( " Skipping non-implemented icon-rotate expression" ) );
1189
+ break ;
1190
+ }
1191
+ }
1192
+
1193
+ double iconOpacity = -1.0 ;
1194
+ if ( jsonPaint.contains ( QStringLiteral ( " icon-opacity" ) ) )
1195
+ {
1196
+ const QVariant jsonIconOpacity = jsonPaint.value ( QStringLiteral ( " icon-opacity" ) );
1197
+ switch ( jsonIconOpacity.type () )
1198
+ {
1199
+ case QVariant::Int:
1200
+ case QVariant::Double:
1201
+ iconOpacity = jsonIconOpacity.toDouble ();
1202
+ break ;
1203
+
1204
+ case QVariant::Map:
1205
+ markerDdProperties.setProperty ( QgsSymbolLayer::PropertyOpacity, parseInterpolateByZoom ( jsonIconOpacity.toMap (), context, 100 , &iconOpacity ) );
1206
+ break ;
1207
+
1208
+ case QVariant::List:
1209
+ case QVariant::StringList:
1210
+ markerDdProperties.setProperty ( QgsSymbolLayer::PropertyOpacity, parseInterpolateListByZoom ( jsonIconOpacity.toList (), PropertyType::Numeric, context, 100 , 255 , nullptr , &iconOpacity ) );
1211
+ break ;
1212
+
1213
+ default :
1214
+ context.pushWarning ( QObject::tr ( " Skipping non-implemented icon-opacity expression" ) );
1215
+ break ;
1216
+ }
1217
+ }
1218
+
1219
+ rasterMarker->setDataDefinedProperties ( markerDdProperties );
1220
+ rasterMarker->setAngle ( rotation );
1221
+ if ( iconOpacity >= 0 )
1222
+ rasterMarker->setOpacity ( iconOpacity );
1223
+
1224
+ QgsMarkerSymbol *markerSymbol = new QgsMarkerSymbol ( QgsSymbolLayerList () << rasterMarker );
1225
+ renderer.setSymbol ( markerSymbol );
1226
+ renderer.setGeometryType ( QgsWkbTypes::PointGeometry );
1227
+ }
1228
+ }
1153
1229
}
1154
1230
1155
1231
bool QgsMapBoxGlStyleConverter::parseSymbolLayerAsRenderer ( const QVariantMap &jsonLayer, QgsVectorTileBasicRendererStyle &rendererStyle, QgsMapBoxGlStyleConversionContext &context )
0 commit comments