Api Windows Phone 8中路由的中点
有人知道如何在Windows Phone 8或Windows Phone 7中获取地图路线的中点吗 我已经搜索过了,但没有找到提供路线中点的MAPAPI。MAPAPI只提供了如何找到两点之间的路线Api Windows Phone 8中路由的中点,api,map,windows-phone,routes,Api,Map,Windows Phone,Routes,有人知道如何在Windows Phone 8或Windows Phone 7中获取地图路线的中点吗 我已经搜索过了,但没有找到提供路线中点的MAPAPI。MAPAPI只提供了如何找到两点之间的路线 例如,有一条从a到B的路线。我想知道那条路线的中间点在哪里。这是可能的。Windows Phone 8 API确实有办法实现您的请求。基本上,您可以获得路线中的每个机动,即每个转弯、U形转弯、合并等。您还可以获得每个机动的文本指令 下面是一个用于RouteQuery完成的事件处理程序 事件处理程序在每
例如,有一条从a到B的路线。我想知道那条路线的中间点在哪里。这是可能的。Windows Phone 8 API确实有办法实现您的请求。基本上,您可以获得路线中的每个机动,即每个转弯、U形转弯、合并等。您还可以获得每个机动的文本指令 下面是一个用于
RouteQuery
完成的事件处理程序
事件处理程序在每个RouteManuever
中循环。你可以找到这个集合的中间元素,并考虑你的中点。
完整文档:
下面的事件处理程序示例:
void MyQuery_QueryCompleted(object sender, QueryCompletedEventArgs<Route> e)
{
if (e.Error == null)
{
// Add the route to the map... Sounds like you already got this part working.
Route MyRoute = e.Result;
MapRoute MyMapRoute = new MapRoute(MyRoute);
MyMap.AddRoute(MyMapRoute);
// Now loop through the route maneuvers.
List<string> RouteList = new List<string>();
foreach (RouteLeg leg in MyRoute.Legs)
{
foreach (RouteManeuver maneuver in leg.Maneuvers)
{
RouteList.Add(maneuver.InstructionText);
}
}
RouteLLS.ItemsSource = RouteList;
MyQuery.Dispose();
}
}
void MyQuery\u QueryCompleted(对象发送方,QueryCompletedEventArgs e)
{
如果(e.Error==null)
{
//将路线添加到地图中…听起来您已经完成了此部分的工作。
路径MyRoute=e.结果;
MapRoute MyMapRoute=新的MapRoute(MyRoute);
MyMap.AddRoute(MyMapRoute);
//现在在路线上绕一圈。
List RouteList=新列表();
foreach(MyRoute.Legs中的RouteLeg支腿)
{
foreach(腿部的RouteManeuver机动动作)
{
路线列表添加(机动指令文本);
}
}
RouteLLS.ItemsSource=路由列表;
Dispose();
}
}