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.
精彩评论