Show exit numbers for off ramps in OSRM directions

Fixes #1768
This commit is contained in:
Tom Hughes 2018-02-25 20:51:11 +00:00
parent 94ffa36306
commit d8eda6ba03
2 changed files with 21 additions and 18 deletions

View file

@ -117,19 +117,14 @@ function OSRMEngine() {
instText += I18n.t(template + '_without_exit', { name: name } );
}
} else if (step.maneuver.type.match(/on ramp|off ramp/)) {
if (step.destinations) {
if (namedRoad) {
instText += I18n.t(template + '_with_name_and_directions', { name: name, directions: destinations } );
} else {
instText += I18n.t(template + '_with_directions', { directions: destinations } );
}
} else {
if (namedRoad) {
instText += I18n.t(template + '_without_exit', { name: name });
} else {
instText += I18n.t(template + '_without_directions');
}
var params = {};
if (step.exits && step.maneuver.type.match(/off ramp/)) params.exit = step.exits;
if (step.destinations) params.directions = step.destinations;
if (namedRoad) params.directions = name;
if (Object.keys(params).length > 0) {
template = template + "_with_" + Object.keys(params).join("_");
}
instText += I18n.t(template, params);
} else {
instText += I18n.t(template + '_without_exit', { name: name });
}