2016-10-04 30 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