Route Offset

Topics: Help, WPF
May 1, 2012 at 3:34 PM

Hi All!

I have a problem with displaying marker`s route. It isn't coincide with the coordinates of the marker.

I tried to play with Offset property, but without results.

Program screenshot: http://s2.ipicture.ru/uploads/20120501/pa2QyE72.png

And code:

namespace GMap{
    public partial class MainWindow : Window
    {
        int x = 0;
        GMapMarker marker = new GMapMarker(new PointLatLng(0, 0));
        GMapMarker route = new GMapMarker();
        public MainWindow()
        {
            InitializeComponent();
            gMap.MapProvider = GMapProviders.OpenStreetMap;
            gMap.Manager.Mode = AccessMode.ServerAndCache;
            gMap.MinZoom = 1;
            gMap.MaxZoom = 15;
            gMap.Zoom = 4;

            Ellipse el = new Ellipse();
            el.Height = 10;
            el.Width = 10;
            el.Fill = Brushes.Red;
            marker.Shape = el;

            marker.Offset = new Point(-5, -5);

            gMap.Markers.Add(marker);
            gMap.Markers.Add(route);
            
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            marker.Position = new PointLatLng(x++, Math.Sin(Math.Sinh(x)));            
            route.Route.Add(marker.Position);            
            route.RegenerateRouteShape(gMap);
        }
    }
}


May 1, 2012 at 3:52 PM

maybe route.Offset = new Point(-5, -5);

May 1, 2012 at 5:59 PM
radioman wrote:

maybe route.Offset = new Point(-5, -5);

Unfortunately, it and other experiments with route.Offset didn`t help(

May 1, 2012 at 6:35 PM

OK, found one solution:

Use List<PointLatLng> to store points and route.Route.AddRange() instead of route.Route.Add(). So, it`s works!

Radioman, many thanks for such control!