all images are now loaded in main.js

This commit is contained in:
DennisSchiefer
2012-04-10 23:50:04 +02:00
parent ea207cef6e
commit ffd5e2de99
5 changed files with 76 additions and 59 deletions
+23 -23
View File
@@ -66,7 +66,7 @@ show: function(response) {
route_desc += '<tr class="'+rowstyle+'">';
route_desc += '<td class="result-directions">';
route_desc += '<img width="18px" src="images/'+OSRM.RoutingDescription.getDirectionIcon(response.route_instructions[i][0])+'" alt="" />';
route_desc += '<img width="18px" src="'+OSRM.G.images[OSRM.RoutingDescription.getDirectionIcon(response.route_instructions[i][0])].src+'" alt="" />';
route_desc += "</td>";
route_desc += '<td class="result-items">';
@@ -158,33 +158,33 @@ showNA: function( display_text ) {
// [TODO: language-safe implementation]
getDirectionIcon: function(name) {
var directions = {
"Turn left":"turn-left.png",
"Turn right":"turn-right.png",
"U-Turn":"u-turn.png",
"Head":"continue.png",
"Continue":"continue.png",
"Turn slight left":"slight-left.png",
"Turn slight right":"slight-right.png",
"Turn sharp left":"sharp-left.png",
"Turn sharp right":"sharp-right.png",
"Enter roundabout and leave at first exit":"round-about.png",
"Enter roundabout and leave at second exit":"round-about.png",
"Enter roundabout and leave at third exit":"round-about.png",
"Enter roundabout and leave at fourth exit":"round-about.png",
"Enter roundabout and leave at fifth exit":"round-about.png",
"Enter roundabout and leave at sixth exit":"round-about.png",
"Enter roundabout and leave at seventh exit":"round-about.png",
"Enter roundabout and leave at eighth exit":"round-about.png",
"Enter roundabout and leave at nineth exit":"round-about.png",
"Enter roundabout and leave at tenth exit":"round-about.png",
"Enter roundabout and leave at one of the too many exit":"round-about.png",
"You have reached your destination":"target.png"
"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.png";
return "default";
}
};
+4 -4
View File
@@ -48,17 +48,17 @@ reverseRouting: function() {
if(OSRM.G.markers.route.length == 1) {
if(OSRM.G.markers.route[0].label == OSRM.C.TARGET_LABEL) {
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') );
OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-source'] );
} else if(OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL) {
OSRM.G.markers.route[0].label = OSRM.C.TARGET_LABEL;
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-target.png') );
OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-target'] );
}
} else if(OSRM.G.markers.route.length > 1){
OSRM.G.markers.route[0].label = OSRM.C.SOURCE_LABEL;
OSRM.G.markers.route[0].marker.setIcon( new L.Icon('images/marker-source.png') );
OSRM.G.markers.route[0].marker.setIcon( OSRM.G.icons['marker-source'] );
OSRM.G.markers.route[OSRM.G.markers.route.length-1].label = OSRM.C.TARGET_LABEL;
OSRM.G.markers.route[OSRM.G.markers.route.length-1].marker.setIcon( new L.Icon('images/marker-target.png') );
OSRM.G.markers.route[OSRM.G.markers.route.length-1].marker.setIcon( OSRM.G.icons['marker-target'] );
}
// recompute route