corrected error in route description,

made dropdown button more beautiful
This commit is contained in:
DennisSchiefer
2012-04-12 22:44:30 +02:00
parent 01e4afe2f0
commit 393334cabd
4 changed files with 74 additions and 7 deletions
+38 -5
View File
@@ -74,11 +74,11 @@ show: function(response) {
// build route description
if( i == 0 )
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/%s/, OSRM.loc(response.route_instructions[i][6]) );
else if( response.route_instructions[i][1] != "" )
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]);
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"$1").replace(/%s/, response.route_instructions[i][1]);
else
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.mapDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
route_desc += OSRM.loc("DIRECTION_"+OSRM.RoutingDescription.getDirectionId(response.route_instructions[i][0])).replace(/\[(.*)\]/,"");
route_desc += '</div>';
route_desc += "</td>";
@@ -147,8 +147,41 @@ showNA: function( display_text ) {
document.getElementById('information-box').innerHTML = "<div class='no-results big-font'>"+display_text+"</div>";
},
//map driving instruction ids to internal ids
mapDirectionId: function(name) {
// map driving instructions to icons
// [TODO: language-safe implementation]
getDirectionIcon: function(name) {
var directions = {
"Turn left":"turn-left",
"Turn right":"turn-right",
"U-Turn":"u-turn",
"Head":"continue",
"Continue":"continue",
"Turn slight left":"slight-left",
"Turn slight right":"slight-right",
"Turn sharp left":"sharp-left",
"Turn sharp right":"sharp-right",
"Enter roundabout and leave at first exit":"round-about",
"Enter roundabout and leave at second exit":"round-about",
"Enter roundabout and leave at third exit":"round-about",
"Enter roundabout and leave at fourth exit":"round-about",
"Enter roundabout and leave at fifth exit":"round-about",
"Enter roundabout and leave at sixth exit":"round-about",
"Enter roundabout and leave at seventh exit":"round-about",
"Enter roundabout and leave at eighth exit":"round-about",
"Enter roundabout and leave at nineth exit":"round-about",
"Enter roundabout and leave at tenth exit":"round-about",
"Enter roundabout and leave at one of the too many exit":"round-about",
"You have reached your destination":"target"
};
if( directions[name] )
return directions[name];
else
return "default";
},
//map driving instructions to ids
getDirectionId: function(name) {
var directions = {
"Turn left":1,
"Turn right":2,