fix to route link generator and parser

This commit is contained in:
DennisSchiefer 2012-03-19 10:28:32 +01:00
parent eed22b343a
commit f4c6ec90ce
2 changed files with 4 additions and 4 deletions

View File

@ -211,7 +211,7 @@ function checkURL(){
else if(name_val[0] == 'destname') { else if(name_val[0] == 'destname') {
destination_name = decodeURI(name_val[1]).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags destination_name = decodeURI(name_val[1]).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags
} }
else if(name_val[0] == 'zoom') { else if(name_val[0] == 'z') {
zoom = name_val[1]; zoom = name_val[1];
if( zoom<0 || zoom > 18) if( zoom<0 || zoom > 18)
return; return;

View File

@ -125,7 +125,8 @@ function onClickRouteDescription(geometry_index) {
OSRM.G.markers.highlight.centerView(OSRM.DEFAULTS.HIGHLIGHT_ZOOM_LEVEL); OSRM.G.markers.highlight.centerView(OSRM.DEFAULTS.HIGHLIGHT_ZOOM_LEVEL);
} }
function onClickCreateShortcut(src){ function onClickCreateShortcut(src){
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_SHORTENER_URL+src+'&jsonp=showRouteLink', showRouteLink, showRouteLink_TimeOut, 2000, 'shortener'); src += '&z='+ OSRM.G.map.getZoom() + '&center=' + OSRM.G.map.getCenter().lat + ',' + OSRM.G.map.getCenter().lng;
OSRM.JSONP.call(OSRM.DEFAULTS.HOST_SHORTENER_URL+src, showRouteLink, showRouteLink_TimeOut, 2000, 'shortener');
document.getElementById('route-prelink').innerHTML = '['+OSRM.loc("GENERATE_LINK_TO_ROUTE")+']'; document.getElementById('route-prelink').innerHTML = '['+OSRM.loc("GENERATE_LINK_TO_ROUTE")+']';
} }
function showRouteLink(response){ function showRouteLink(response){
@ -136,8 +137,7 @@ function showRouteLink_TimeOut(){
} }
function showRouteDescription(response) { function showRouteDescription(response) {
// compute query string // compute query string
var query_string = '?z='+ OSRM.G.map.getZoom(); var query_string = '?rebuild=1';
query_string += '&center=' + OSRM.G.map.getCenter().lat + ',' + OSRM.G.map.getCenter().lng;
for(var i=0; i<OSRM.G.markers.route.length; i++) for(var i=0; i<OSRM.G.markers.route.length; i++)
query_string += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng(); query_string += '&loc=' + OSRM.G.markers.route[i].getLat() + ',' + OSRM.G.markers.route[i].getLng();