如何在Gmap.net WPF中创建路由? [英] How to create a route in Gmap.net wpf?
本文介绍了如何在Gmap.net WPF中创建路由?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
希望您能帮助我.对于GMap.net的WPF版本,我在网络上找不到任何有用的信息.
I hope you can help me. I can not find anything helpful in the web for the WPF version of GMap.net.
问题:我看不到我的路线.
Problem: I don't see my route.
List<Location> points = PolylinePoint.Decode(responseData.routes.First().overview_polyline.points);
GMap.NET.WindowsPresentation.GMapRoute route = new GMap.NET.WindowsPresentation.GMapRoute(points.Select(x => new PointLatLng(x.Latitude.Value, x.Longitude.Value)));
route.ZIndex = ROUTESLIST;
route.Shape = new Line() { StrokeThickness = 4, Stroke = System.Windows.Media.Brushes.BlueViolet };
this.routenList.Clear();
this.routenList.Add(route);
主要问题是,我无法使用GMap.NET教程中的叠加层.
The main problem is, that I can not use an overlay like in the GMap.NET tutorials.
有什么建议吗?
推荐答案
RoutingProvider routingProvider =
_map.MapProvider as RoutingProvider ?? GMapProviders.OpenStreetMap;
MapRoute route = routingProvider.GetRoute(
new PointLatLng(35.834914, -76.009508), //start
new PointLatLng(35.854914, -76.009508), //end
false, //avoid highways
false, //walking mode
(int)_map.Zoom);
GMapRoute gmRoute = new GMapRoute(route.Points);
_map.Markers.Add(gmRoute);
这篇关于如何在Gmap.net WPF中创建路由?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文