MainPage.xaml.cs
/// <summary>
/// Add my home at tappped pos on map
/// </summary>
/// <param name="dLat_Pos"></param>
/// <param name="dLon_Pos"></param>
Add my home at tappped pos on map
Add my home at tappped pos on map
public void AddImageAtLatAndLon(double dLat_Pos, double dLon_Pos)
        {
            myMap.Children.Remove(img_AtLatAndLon);
            img_AtLatAndLon.Height = 5 * myMap.ZoomLevel;
            img_AtLatAndLon.Width = 5 * myMap.ZoomLevel;
            img_AtLatAndLon.Opacity = 0.7;
            img_AtLatAndLon.Source = new BitmapImage(new Uri("ms-appx:///Assets/MyHome.png"));
            img_AtLatAndLon.RenderTransform = new RotateTransform()
            {
            };
            img_AtLatAndLon.Stretch = Stretch.Uniform;
            img_AtLatAndLon.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center;
            img_AtLatAndLon.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Center;
            img_AtLatAndLon.Margin = new Windows.UI.Xaml.Thickness(-5 * myMap.ZoomLevel / 2, -5 * myMap.ZoomLevel / 2, 0, 0);
            Geopoint PointCenterMap = new Geopoint(new BasicGeoposition()
            {
                Latitude = dLat_Pos,
                Longitude = dLon_Pos,
            });
            Windows.UI.Xaml.Controls.Maps.MapControl.SetLocation(img_AtLatAndLon, PointCenterMap);
            myMap.Children.Add(img_AtLatAndLon);
        }
public void AddImageAtLatAndLon ( double dLat_Pos , double dLon_Pos ) { myMap . Children . Remove ( img_AtLatAndLon ) ; img_AtLatAndLon . Height = 5 * myMap . ZoomLevel ; img_AtLatAndLon . Width = 5 * myMap . ZoomLevel ; img_AtLatAndLon . Opacity = 0.7 ; img_AtLatAndLon . Source = new BitmapImage ( new Uri ( " " ) ) ; img_AtLatAndLon . RenderTransform = new RotateTransform ( ) { } ; img_AtLatAndLon . Stretch = Stretch . Uniform ; img_AtLatAndLon . HorizontalAlignment = Windows . UI . Xaml . HorizontalAlignment . Center ; img_AtLatAndLon . VerticalAlignment = Windows . UI . Xaml . VerticalAlignment . Center ; img_AtLatAndLon . Margin = new Windows . UI . Xaml . Thickness ( - 5 * myMap . ZoomLevel / 2 , - 5 * myMap . ZoomLevel / 2 , 0 , 0 ) ; Geopoint PointCenterMap = new Geopoint ( new BasicGeoposition ( ) { Latitude = dLat_Pos , Longitude = dLon_Pos , } ) ; Windows . UI . Xaml . Controls . Maps . MapControl . SetLocation ( img_AtLatAndLon , PointCenterMap ) ; myMap . Children . Add ( img_AtLatAndLon ) ; }
Add my home at tappped pos on map
Add my home at tappped pos on map
//Edit size of image //img_rotate.RenderTransform //img_rotate.Transitions. //mặc định ảnh có chiều dài và chiều rộng là vô cùng //bitmapImage.PixelHeight //img_rotate.sca //tbOutputText.Text = "Latitude: " + myMap.Center.Position.Latitude.ToString() + '\n'; //tbOutputText.Text += "Longitude: " + myMap.Center.Position.Longitude.ToString() + '\n'; ////tbOutputText.Text += "Timer Fly: " + Timer_fly.ToString(); //Altitude = 200.0 //myMap.Children.Add(bitmapImage); //myMap.TrySetViewBoundsAsync() //Độ dài tương đối của hình so với vị trí mong muốn new Point(0.5, 0.5) không dời //Windows.UI.Xaml.Controls.Maps.MapControl.SetNormalizedAnchorPoint(img_rotate, new Point(0.5, 0.5)); //Vẽ quỹ đạo //Draw_Trajectory(Convert.ToDouble(Data.Latitude), Convert.ToDouble(Data.Longtitude), Convert.ToDouble(Data.Altitude));
dLat_Pos
double
None
dLon_Pos
double
None