【发布时间】:2014-09-11 04:40:07
【问题描述】:
我正在开发一个应用程序,它显示从用户当前位置到某个点的行驶距离。有几千个坐标点,应用程序需要快速计算距离。下面是我正在使用的方法。
public async Task<int> findRouteLength(System.Device.Location.GeoCoordinate currentPosition, System.Device.Location.GeoCoordinate businessPosition)
{
List<System.Device.Location.GeoCoordinate> routePositions = new List<System.Device.Location.GeoCoordinate>();
routePositions.Add(currentPosition);
routePositions.Add(businessPosition);
RouteQuery query = new RouteQuery();
query.TravelMode = TravelMode.Driving;
query.Waypoints = routePositions;
Route route = await query.GetRouteAsync();
return route.LengthInMeters;
}
但是,这个任务在一秒钟内只能计算不超过 5-6 个距离。在 windows phone 8 c# 中是否有更快的计算行驶距离的方法?
【问题讨论】:
-
en.wikipedia.org/wiki/Dijkstra%27s_algorithm 你最好用你自己编写的智能代码减少 数千 以获得更好的性能。
标签: c# xaml windows-phone-8