Smoothly Panning Between Two Points

Topics: Feature Requests, WPF
Aug 15, 2011 at 8:02 PM

I'm wondering if there is already a way to do this or if someone has figured out a way to do this:

How can I make the map smoothly pan from one point to another?  

Coordinator
Aug 15, 2011 at 8:30 PM

nop, idea queued ;}

Aug 16, 2011 at 1:32 PM

Good to know! Thanks.

This project is very impressive :)

Sep 16, 2011 at 8:51 PM

I've enabled animations for panning but sometimes it is not smooth at all, and I'm puzzled.



Implement these into the MainWindow:

 

        public System.Windows.Point MapPoint
        {
            get { return (System.Windows.Point)GetValue(MapPointProperty); }
            set { SetValue(MapPointProperty, value); }
        }


        // Using a DependencyProperty as the backing store for point.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MapPointProperty =
               DependencyProperty.Register("MapPoint", typeof(System.Windows.Point), typeof(GMapControl), new PropertyMetadata(new Point(), OnMapPointPropertyChanged));


        private static void OnMapPointPropertyChanged(DependencyObject source,
        DependencyPropertyChangedEventArgs e)
        {
            Point temp = (Point)e.NewValue;
            PointLatLng gmapPoint = new PointLatLng(temp.X, temp.Y);
            (source as GMapControl).Position = gmapPoint;
        }


Instantiate the animation with something like this:

 

        PointAnimation panMap = new PointAnimation();
        panMap.Duration = TimeSpan.FromSeconds(1); 
        panMap.From = new Point(MainMap.Position.Lat, MainMap.Position.Lng);
        panMap.To = new Point(pointTo.Lat, pointTo.Lng);
        Storyboard.SetTarget(panMap, MainMap);
        Storyboard.SetTargetProperty(panMap, new PropertyPath(MapPointProperty));
        panMapStoryBoard.Children.Add(panMap);
        panMapStoryBoard.Begin(this);


Coordinator
Sep 16, 2011 at 9:30 PM

indeed, you change geo position, but to have really smooth panning one must animate map translate matrix, to support such actions positioning subsystem must be redone... to bad i have not much 'free' time, waste it at work...