Skip to content

Instantly share code, notes, and snippets.

@here-devblog-gists
Created November 7, 2016 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save here-devblog-gists/39973adbf87e8b5ca007eca02cb47cc0 to your computer and use it in GitHub Desktop.
Save here-devblog-gists/39973adbf87e8b5ca007eca02cb47cc0 to your computer and use it in GitHub Desktop.
HERERouter.prototype.getRoutes = function(options, onSuccessCallback) {
var onSuccess,
onError;
onSuccess = function (result) {
if (result.response.route) {
var routeLineGroup = new H.map.Group();
var routes = result.response.route.map(function(route) {
var routeLine = this.getRouteLine(route);
routeLineGroup.addObject(routeLine);
return {
route: route,
routeLine: routeLine
};
}.bind(this));
onSuccessCallback(routes, routeLineGroup);
} else {
onError(result.response.details);
}
};
onError = function (error) {
console.error('Oh no! There was some communication error!', error);
};
this.router.calculateRoute(options, onSuccess.bind(this), onError);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment