none
[WP8.1]How to animate an image in Map control? RRS feed

  • Question

  • Hi

       I Using Windows Map control.

    I am having 2 latitude and 2 longitude's.

    I need to animate an image to move (not jump) from one latitude longitude to other latitude longitude.

    Code Please.

    Thursday, March 3, 2016 10:40 AM

Answers

  • Hello,

    >>I am having 2 latitude and 2 longitude's.I need to animate an image to move (not jump) from one latitude longitude to other latitude longitude

    Based on my research, we cannot truly move continuously with a picture(the icon in your case), we have to jump. While we jump very fast so that people would think it is “moving”.

    You could use a timer to “move” the icon very fast so that people would do not see it is “jumping”. For example:

    private void moveIconButton_Click(object sender, RoutedEventArgs e)
            {
                timer.Interval = new TimeSpan(0, 0, 0, 0, 1);
                timer.Tick += Timer_Tick;
                timer.Start();
            }
            Geopoint targetPoint = new Geopoint(new BasicGeoposition()
            {
                //Geopoint for Seattle 
                Latitude = 47.610,
                Longitude = -122.329
            });
            DispatcherTimer timer = new DispatcherTimer();
            MapIcon mapIcon1 = new MapIcon();
            private void Timer_Tick(object sender, object e)
            {
                timer.Stop();
                myMap.MapElements.Remove(mapIcon1);
                mapIcon1.Location = new Geopoint(new BasicGeoposition()
                {
                    //Geopoint for Seattle 
                    Latitude = mapIcon1.Location.Position.Latitude - (myMap.Center.Position.Latitude - targetPoint.Position.Latitude) / 1000,
                    Longitude = mapIcon1.Location.Position.Longitude - (myMap.Center.Position.Longitude - targetPoint.Position.Longitude) / 1000
                });
                myMap.MapElements.Add(mapIcon1);
                timer.Start();
            }

    If you want a complete sample, I suggest you could post a code sample to:

    https://code.msdn.microsoft.com/site/requests

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Proposed as answer by Fred Bao Tuesday, March 15, 2016 7:20 AM
    • Marked as answer by Fred Bao Wednesday, March 16, 2016 3:00 AM
    Friday, March 4, 2016 8:40 AM

All replies

  • Hello,

    >>I am having 2 latitude and 2 longitude's.I need to animate an image to move (not jump) from one latitude longitude to other latitude longitude

    Based on my research, we cannot truly move continuously with a picture(the icon in your case), we have to jump. While we jump very fast so that people would think it is “moving”.

    You could use a timer to “move” the icon very fast so that people would do not see it is “jumping”. For example:

    private void moveIconButton_Click(object sender, RoutedEventArgs e)
            {
                timer.Interval = new TimeSpan(0, 0, 0, 0, 1);
                timer.Tick += Timer_Tick;
                timer.Start();
            }
            Geopoint targetPoint = new Geopoint(new BasicGeoposition()
            {
                //Geopoint for Seattle 
                Latitude = 47.610,
                Longitude = -122.329
            });
            DispatcherTimer timer = new DispatcherTimer();
            MapIcon mapIcon1 = new MapIcon();
            private void Timer_Tick(object sender, object e)
            {
                timer.Stop();
                myMap.MapElements.Remove(mapIcon1);
                mapIcon1.Location = new Geopoint(new BasicGeoposition()
                {
                    //Geopoint for Seattle 
                    Latitude = mapIcon1.Location.Position.Latitude - (myMap.Center.Position.Latitude - targetPoint.Position.Latitude) / 1000,
                    Longitude = mapIcon1.Location.Position.Longitude - (myMap.Center.Position.Longitude - targetPoint.Position.Longitude) / 1000
                });
                myMap.MapElements.Add(mapIcon1);
                timer.Start();
            }

    If you want a complete sample, I suggest you could post a code sample to:

    https://code.msdn.microsoft.com/site/requests

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    • Proposed as answer by Fred Bao Tuesday, March 15, 2016 7:20 AM
    • Marked as answer by Fred Bao Wednesday, March 16, 2016 3:00 AM
    Friday, March 4, 2016 8:40 AM
  • Hi

      I will receive around 15 latitude and longitudes from my web service.

    In that latlng's i have placed small car images in map control. (I am using normal map control which is available in visual studio)

    i need to animate all the car images to move for a small distance.

    How to achieve this?


    Friday, July 15, 2016 12:39 PM
  • Hi rmurali.mcp,

    You have posted a same question. Please don't repeat the question. I would merge it with your original thread.

    Thanks for your understanding.

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Saturday, July 16, 2016 5:04 AM
    Moderator