From 9567a7e38c1bc36ca5a4fdb25991059aa41b3652 Mon Sep 17 00:00:00 2001 From: DennisSchiefer Date: Sat, 17 Mar 2012 14:17:08 +0100 Subject: [PATCH] added support for saving route zoom level and position in route links --- WebContent/main.js | 27 ++++++++++++++++++++++----- WebContent/routing.js | 1 + 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/WebContent/main.js b/WebContent/main.js index b5bd0fbdb..d34aec005 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -176,8 +176,10 @@ function checkURL(){ // storage for parameter values var positions = []; - var destination = undefined; - var destination_name = undefined; + var zoom = null; + var center = null; + var destination = null; + var destination_name = null; // parse input var splitted_url = called_url.split('&'); @@ -201,6 +203,17 @@ function checkURL(){ else if(name_val[0] == 'destname') { destination_name = decodeURI(name_val[1]).replace(/<\/?[^>]+(>|$)/g ,""); // discard tags } + else if(name_val[0] == 'zoom') { + zoom = name_val[1]; + if( zoom<0 || zoom > 18) + return; + } + else if(name_val[0] == 'center') { + var coordinates = unescape(name_val[1]).split(','); + if(coordinates.length!=2 || !isLatitude(coordinates[0]) || !isLongitude(coordinates[1]) ) + return; + center = new L.LatLng( coordinates[0], coordinates[1]); + } } // case 1: destination given @@ -227,9 +240,13 @@ function checkURL(){ for(var i=0; i