I just saw beta192 has been released - tested, and fills work again. Labels are still broken in our application. None show up. Investigating further.
Labels still disappear in our application when switching to GPU, while classic rendering displays them correctly. Labels work in the standalone repro, so we have not isolated this remaining issue to the SDK.
Below is our application’s label path. The attached files contain the complete translation and style-copying helpers.
We construct the classic TextStyle from the selected field, font and color:
var style = new TextStyle(
LabelingField,
new GeoFont(splitStyle[0], fontSize, GetFontStyle()),
new GeoSolidBrush(ParseGeoColor(ColorText)));
if (GeoType == GeoType.Point)
style.TextPlacement = TextPlacement.AutoPlacement;
else
style.OffsetFromLine =
(float)Math.Max(LineStyle.OutlineWidth + 3 + fontSize / 3, 7);
if (HasNonTextCustomStyles(layer))
{
layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = null;
layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(style);
}
else
{
layer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = style;
}
Before this, we remove existing top-level TextStyle entries from CustomStyles. Geometry setup sets:
zoom.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Notice that our OffsetFromLine assignment applies to polygons as well as lines. The standalone repro does not set it.
For GPU rendering, we create an independent runtime layer/reader and copy the classic styles. This copying also happens before restyling:
featureLayer.ZoomLevelSet =
FeatureLayerRenderStyles.CopyZoomLevels(original.ZoomLevelSet);
featureLayer.Opacity = original.Opacity;
Here is the actual copying implementation. In particular, the copied zoom levels are stored in CustomZoomLevels:
internal static ZoomLevelSet CopyZoomLevels(ZoomLevelSet original)
{
ZoomLevelSet copy = new()
{
TileSize = original.TileSize,
MaxExtent = original.MaxExtent == null
? null
: (RectangleShape)original.MaxExtent.CloneDeep()
};
foreach (ZoomLevel level in original.GetZoomLevels())
{
ZoomLevel cloned = new(level.Scale)
{
IsActive = level.IsActive,
Name = level.Name,
UseLegacyLabeling = level.UseLegacyLabeling,
ApplyUntilZoomLevel = level.ApplyUntilZoomLevel,
DefaultAreaStyle =
(AreaStyle)level.DefaultAreaStyle?.CloneDeep(),
DefaultLineStyle =
(LineStyle)level.DefaultLineStyle?.CloneDeep(),
DefaultPointStyle =
(PointStyle)level.DefaultPointStyle?.CloneDeep(),
DefaultTextStyle =
(TextStyle)level.DefaultTextStyle?.CloneDeep()
};
foreach (Style style in level.CustomStyles)
cloned.CustomStyles.Add(style.CloneDeep());
copy.CustomZoomLevels.Add(cloned);
}
return copy;
}
The GPU source uses our native EPSG:25832 grid:
FeatureSourceVectorTileSource source = new(
new RectangleShape(0, 10_000_000, 1_000_000, 0),
GeographyUnit.Meter)
{
SourceId = "agk_" + layerId.ToString("N"),
MaxConcurrentEncodes = 1
};
source.MaxDataZoom = source.TileMatrixSet.TileMatrices.Count - 1;
source.FeatureSources.Add("features", featureLayer.FeatureSource);
For opaque layers, we translate once. For translucent layers containing labels, we translate geometry and labels separately so labels remain fully opaque. Both translations share the same source:
internal static GpuLayerTranslation Translate(
FeatureLayer layer,
FeatureSourceVectorTileSource source)
{
Collection<double> scales = source.TileMatrixSet.GetScales();
ZoomLevelSet originalStyles = layer.ZoomLevelSet;
double originalOpacity = layer.Opacity;
ZoomLevelSet labelStyles = originalOpacity < 1
? FeatureLayerRenderStyles.CopyForPass(
originalStyles, labelsOnly: true)
: null;
if (labelStyles == null
|| !FeatureLayerRenderStyles.HasLabels(labelStyles))
{
return new(TranslateShapes());
}
try
{
layer.ZoomLevelSet = FeatureLayerRenderStyles.CopyForPass(
originalStyles, labelsOnly: false);
FeatureLayerTranslation shapes = TranslateShapes();
shapes.Source.SourceId = shapes.SourceId;
layer.ZoomLevelSet = labelStyles;
layer.Opacity = 1;
FeatureLayerTranslation labels =
FeatureLayerTranslator.Translate(
layer, shapes.Source, scales);
return new(shapes, labels);
}
finally
{
layer.ZoomLevelSet = originalStyles;
layer.Opacity = originalOpacity;
}
FeatureLayerTranslation TranslateShapes() =>
FeatureLayerTranslator.Translate(layer, source, scales);
}
CopyForPass and HasLabels are included in the attached FeatureLayerRenderStyles.cs. The split is not used at 100% layer opacity.
We compose a fresh MapStyle for each change. The wrapper adds both translations when a separate label pass exists:
internal void AddTo(MapStyle style)
{
style.AddFeatureLayer(shapes);
if (labels != null)
style.AddFeatureLayer(labels);
}
After adding the translations, we set visibility on every translated layer, including labels:
translation.AddTo(composed);
foreach (var translatedLayer in translation.Layers)
{
composed.SetLayerVisibility(
translatedLayer.Id,
layer.MapLayerIsVisible);
}
Initial display uses new GpuBasemap(composed). Subsequent style changes use:
await basemap.SetStyleAsync(composed);
The runtime reader and vector source remain alive across restyles. Translation warnings cause classic fallback rather than silently accepting an incomplete translation.
Could you check whether anything in this path explains the difference from the working repro—particularly the copied CustomZoomLevels, polygon OffsetFromLine, or composition of the separate label translation?