Hello,
I have GraphicsOverlay like this:
new GraphicsOverlay { Id = TextOverlayId, ScaleSymbols = true }
And putting TextSymbols on it like this:
new TextSymbol()
{
Text = text ?? string.Empty,
FontWeight = FontWeight.Normal,
Color = Color.Black,
HaloColor = Color.White,
HaloWidth = 1,
Size = 15,
HorizontalAlignment = HorizontalAlignment.Left,
OffsetX = 10,
AngleAlignment = SymbolAngleAlignment.Screen
}
To make the scaling of the text work I set the MapView's ReferenceScale like this:
_mapView.Map.ReferenceScale = 1000;
Scaling of the text works fine, but when I rotate the map, all TextSymbols rotate with the map instead of staying horizontal with the screen...why?
I've tried to set GraphicsOverlay.RenderingMode=Dynamic (as mentioned in the AngleAlignment descrption) but it doesn't help.
If I do not set a ReferenceScale the AngleAlignment=Screen works as expected...but scaling doesn't of course.
Any ideas?
thx
Soko
Hi Soko,
Unfortunately, the current GraphicsOverlay does not support ScaleSymbols when using the Dynamic RenderingMode. In cases where specific properties cannot be accommodated in Dynamic RenderingMode, the GraphicsOverlay defaults to using the Static RenderingMode. This only takes effect when a ReferenceScale has been set, as there would be no scaling to be done without it. Once in Static RenderingMode though, the ScreenAlignment is ignored since it cannot be applied in this mode.
Could you provide more details about your use case so that we can assess placing a feature request to support scaling symbols with a GraphicsOverlay in Dynamic RenderingMode?
Hi Dylan,
The use case is quite simple actually. We have a lot of Points on a map with a label each. The label should scale with the zoom of the map and always stay horizontal so it is readable when the user rotates the map.
private static readonly TextSymbol LabelStyle = new()
{
FontWeight = FontWeight.Normal,
Color = Color.Black,
HaloColor = Color.White,
HaloWidth = 1,
Size = 15,
AngleAlignment = SymbolAngleAlignment.Screen
};
private static readonly LabelDefinition LabelDefinition = new(
new ArcadeLabelExpression($"$feature.{LabelKey}"), LabelStyle)
{
Placement = LabelingPlacement.Automatic
};
new GraphicsOverlay {
Id = ExtraLabelsOverlayId,
Renderer = new SimpleRenderer(new SimpleMarkerSymbol{Size = 0}),
ScaleSymbols = true,
LabelDefinitions = { LabelDefinition },
LabelsEnabled = true });