开发者

Access RoutePath from Bing Maps AJAX Control

开发者 https://www.devze.com 2023-04-13 07:40 出处:网络
How can I access the RoutePath Class when using the Bing Maps AJAX Control, Version 7.0? I\'ve loaded the directions module, calculated directions and开发者_如何学JAVA called the getRouteResult metho

How can I access the RoutePath Class when using the Bing Maps AJAX Control, Version 7.0?

I've loaded the directions module, calculated directions and开发者_如何学JAVA called the getRouteResult method of the DirectionsManager Class. Unfortunately, it doesn't return the coordinates of the actual route.

Ultimately, I need the coordinates of the shape which makes up the route line.


Thanks to some help from Microsoft, I've found how RoutePath is exposed. Access RoutePath by:

DirectionsManagerObj.getRouteResult().routeLegs[routeLegIndex]
    .subLegs[subLegIndex].routePath;

This works great assuming you have two waypoints. Otherwise, you'll need to loop through routeLegs and subLegs to get the entire route.

A routeLeg represents the path through two waypoints. A subLeg represents the path through a stop point and via point (or two via points). The DirectionsManager Class API has more detail on this information.

0

精彩评论

暂无评论...
验证码 换一张
取 消