2016-10-04 21 views
0

UWP mapcontrol mapicon随地图旋转,需要修复。不知道如何解决它或任何解决方法。 unrotated maprotated mapUWP 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); 
    } 
+0

在您的拍摄按钮上创建一个“RotateTransform”并将角度设置为实际地图旋转的负角度。这样你的图标将始终保持正确的角度。 – AVK

回答

0

代码添加图标没有旋转MapIcon,因为它从MapElement,不UIElement继承方法,它没有实现Transform功能。

所以一个简单的方法来解决这个情况下是具有Image控制取代这个MapIcon和旋转这个Image,要做到这一点,你可以参考这个案例:UWP MapControl: MapElement fixed heading