UWP地图控制地图图标旋转与地图,需要固定
本文关键字:地图 控制 图标 旋转 UWP | 更新日期: 2023-09-27 18:11:25
UWP mapcontrol mapicon随地图旋转,需要固定。不知道如何修复它或任何解决方案。未旋转地图旋转地图
在
下面添加带有代码的图标 private async void Add_cam(Geocoordinate Coordinate,GPoint point,string text,WriteableBitmap wb)
{
MapIcon icon = new MapIcon();
InMemoryRandomAccessStream ras = new InMemoryRandomAccessStream();
await wb.RotateFree(point.angle).ToStream(ras, BitmapEncoder.PngEncoderId);
var str = RandomAccessStreamReference.CreateFromStream(ras);
icon.Image = str;
icon.NormalizedAnchorPoint = new Point(0.5, 0.5);
icon.Location = new Geopoint(new BasicGeoposition()
{
Altitude = Coordinate.Point.Position.Altitude,
Longitude = point.x,
Latitude = point.y
});
icon.Title = text;
Map.MapElements.Add(icon);
}
没有方法来旋转MapIcon,因为它继承自MapElement
,而不是UIElement
,它不实现Transform
的功能。
所以解决这种情况的一个简单方法是用Image
控件替换MapIcon
并旋转Image
,要做到这一点,您可以参考这种情况:UWP MapControl: MapElement fixed heading.