diff --git a/WebContent/OSRM.Markers.js b/WebContent/OSRM.Markers.js index de782bd52..4754ab78d 100644 --- a/WebContent/OSRM.Markers.js +++ b/WebContent/OSRM.Markers.js @@ -109,21 +109,21 @@ onClick: function(e) { } } - getRoute(OSRM.CONSTANTS.FULL_DESCRIPTION); + getRoute(OSRM.C.FULL_DESCRIPTION); OSRM.G.markers.highlight.hide(); }, onDrag: function(e) { this.parent.dirty_move = true; this.parent.setPosition( e.target.getLatLng() ); - if(OSRM.GLOBALS.dragging == true) // TODO: hack that deals with drag events after dragend event - getRoute(OSRM.CONSTANTS.NO_DESCRIPTION); + if(OSRM.G.dragging == true) // TODO: hack that deals with drag events after dragend event + getRoute(OSRM.C.NO_DESCRIPTION); else - getRoute(OSRM.CONSTANTS.FULL_DESCRIPTION); + getRoute(OSRM.C.FULL_DESCRIPTION); updateLocation( this.parent.label ); }, onDragStart: function(e) { - OSRM.GLOBALS.dragging = true; + OSRM.G.dragging = true; // hack to store id of dragged marker for( var i=0; i this.route.length-2 ) return -1; - this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.CONSTANTS.VIA_LABEL, {draggable:true,icon:OSRM.icons['marker-via']}, position)); + this.route.splice(id+1,0, new OSRM.RouteMarker(OSRM.C.VIA_LABEL, {draggable:true,icon:OSRM.icons['marker-via']}, position)); return id+1; }, removeMarker: function(id) { @@ -208,9 +208,9 @@ removeMarker: function(id) { return; // also remove vias if source or target are removed - if( id==0 && this.route[0].label == OSRM.CONSTANTS.SOURCE_LABEL ) + if( id==0 && this.route[0].label == OSRM.C.SOURCE_LABEL ) this.removeVias(); - else if( id == this.route.length-1 && this.route[ this.route.length-1 ].label == OSRM.CONSTANTS.TARGET_LABEL ) { + else if( id == this.route.length-1 && this.route[ this.route.length-1 ].label == OSRM.C.TARGET_LABEL ) { this.removeVias(); id = this.route.length-1; } @@ -219,12 +219,12 @@ removeMarker: function(id) { this.route.splice(id, 1); }, hasSource: function() { - if( OSRM.G.markers.route[0] && OSRM.G.markers.route[0].label == OSRM.CONSTANTS.SOURCE_LABEL ) + if( OSRM.G.markers.route[0] && OSRM.G.markers.route[0].label == OSRM.C.SOURCE_LABEL ) return true; return false; }, hasTarget: function() { - if( OSRM.G.markers.route[OSRM.G.markers.route.length-1] && OSRM.G.markers.route[OSRM.G.markers.route.length-1].label == OSRM.CONSTANTS.TARGET_LABEL ) + if( OSRM.G.markers.route[OSRM.G.markers.route.length-1] && OSRM.G.markers.route[OSRM.G.markers.route.length-1].label == OSRM.C.TARGET_LABEL ) return true; return false; } diff --git a/WebContent/geocoder.js b/WebContent/geocoder.js index 9c02a5bc7..50bfe7c0b 100644 --- a/WebContent/geocoder.js +++ b/WebContent/geocoder.js @@ -27,9 +27,9 @@ OSRM.CONSTANTS.VIA_LABEL = "via"; // update geo coordinates in input boxes function updateLocation(marker_id) { - if (marker_id == OSRM.CONSTANTS.SOURCE_LABEL && OSRM.G.markers.route[0].dirty_move == true ) { + if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.route[0].dirty_move == true ) { document.getElementById("input-source-name").value = OSRM.G.markers.route[0].getPosition().lat.toFixed(6) + ", " + OSRM.G.markers.route[0].getPosition().lng.toFixed(6); - } else if (marker_id == OSRM.CONSTANTS.TARGET_LABEL && OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_move == true) { + } else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_move == true) { document.getElementById("input-target-name").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lat.toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lng.toFixed(6); } } @@ -37,9 +37,9 @@ function updateLocation(marker_id) { // process input request and call geocoder if needed function callGeocoder(marker_id, query) { - if (marker_id == OSRM.CONSTANTS.SOURCE_LABEL && OSRM.G.markers.hasSource() && OSRM.G.markers.route[0].dirty_move == false && OSRM.G.markers.route[0].dirty_type == false) + if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() && OSRM.G.markers.route[0].dirty_move == false && OSRM.G.markers.route[0].dirty_type == false) return; - if (marker_id == OSRM.CONSTANTS.TARGET_LABEL && OSRM.G.markers.hasTarget() && OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_move == false && OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type == false) + if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() && OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_move == false && OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type == false) return; if(query=="") return; @@ -52,10 +52,10 @@ function callGeocoder(marker_id, query) { } //build request - if (marker_id == OSRM.CONSTANTS.SOURCE_LABEL) { + if (marker_id == OSRM.C.SOURCE_LABEL) { var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&q=" + query; OSRM.JSONP.call( call, showGeocoderResults_Source, showGeocoderResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_source" ); - } else if (marker_id == OSRM.CONSTANTS.TARGET_LABEL) { + } else if (marker_id == OSRM.C.TARGET_LABEL) { var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&q=" + query; OSRM.JSONP.call( call, showGeocoderResults_Target, showGeocoderResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_target" ); } @@ -65,9 +65,9 @@ function callGeocoder(marker_id, query) { // helper function for clicks on geocoder search results function onclickGeocoderResult(marker_id, lat, lon, do_reverse_geocode, zoom ) { var index; - if( marker_id == OSRM.CONSTANTS.SOURCE_LABEL ) + if( marker_id == OSRM.C.SOURCE_LABEL ) index = OSRM.G.markers.setSource( new L.LatLng(lat, lon) ); - else if( marker_id == OSRM.CONSTANTS.TARGET_LABEL ) + else if( marker_id == OSRM.C.TARGET_LABEL ) index = OSRM.G.markers.setTarget( new L.LatLng(lat, lon) ); else index = -1; // via nodes not yet implemented @@ -80,7 +80,7 @@ function onclickGeocoderResult(marker_id, lat, lon, do_reverse_geocode, zoom ) { OSRM.G.markers.route[index].show(); if( !OSRM.G.markers.route[index].dirty_move || OSRM.G.markers.route[index].dirty_type ) OSRM.G.markers.route[index].centerView(zoom); - getRoute(OSRM.CONSTANTS.FULL_DESCRIPTION); + getRoute(OSRM.C.FULL_DESCRIPTION); OSRM.G.markers.route[index].dirty_move = false; OSRM.G.markers.route[index].dirty_type = false; @@ -88,8 +88,8 @@ function onclickGeocoderResult(marker_id, lat, lon, do_reverse_geocode, zoom ) { // process JSONP response of geocoder // (with wrapper functions for source/target jsonp) -function showGeocoderResults_Source(response) { showGeocoderResults(OSRM.CONSTANTS.SOURCE_LABEL, response); } -function showGeocoderResults_Target(response) { showGeocoderResults(OSRM.CONSTANTS.TARGET_LABEL, response); } +function showGeocoderResults_Source(response) { showGeocoderResults(OSRM.C.SOURCE_LABEL, response); } +function showGeocoderResults_Target(response) { showGeocoderResults(OSRM.C.TARGET_LABEL, response); } function showGeocoderResults(marker_id, response) { if(response){ if(response.length == 0) { @@ -125,9 +125,9 @@ function showGeocoderResults(marker_id, response) { } function showGeocoderResults_Empty(marker_id) { document.getElementById('information-box-headline').innerHTML = OSRM.loc("SEARCH_RESULTS")+":"; - if(marker_id == OSRM.CONSTANTS.SOURCE_LABEL) + if(marker_id == OSRM.C.SOURCE_LABEL) document.getElementById('information-box').innerHTML = "

"+OSRM.loc("NO_RESULTS_FOUND_SOURCE")+".

"; - else if(marker_id == OSRM.CONSTANTS.TARGET_LABEL) + else if(marker_id == OSRM.C.TARGET_LABEL) document.getElementById('information-box').innerHTML = "

"+OSRM.loc("NO_RESULTS_FOUND_TARGET")+".

"; else document.getElementById('information-box').innerHTML = "

"+OSRM.loc("NO_RESULTS_FOUND")+".

"; @@ -142,22 +142,22 @@ function showGeocoderResults_Timeout() { //update reverse geocoder informatiopn in input boxes function updateReverseGeocoder(marker_id) { - if (marker_id == OSRM.CONSTANTS.SOURCE_LABEL && OSRM.G.markers.hasSource()) { //&& OSRM.G.markers.route[0].dirty == true ) { + if (marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource()) { //&& OSRM.G.markers.route[0].dirty == true ) { //document.getElementById("input-source-name").value = OSRM.G.markers.route[0].getPosition().lat.toFixed(6) + ", " + OSRM.G.markers.route[0].getPosition().lng.toFixed(6); - callReverseGeocoder(OSRM.CONSTANTS.SOURCE_LABEL, OSRM.G.markers.route[0].getPosition().lat, OSRM.G.markers.route[0].getPosition().lng); - } else if (marker_id == OSRM.CONSTANTS.TARGET_LABEL && OSRM.G.markers.hasTarget()) { //&& OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty == true) { + callReverseGeocoder(OSRM.C.SOURCE_LABEL, OSRM.G.markers.route[0].getPosition().lat, OSRM.G.markers.route[0].getPosition().lng); + } else if (marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget()) { //&& OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty == true) { //document.getElementById("input-target-name").value = OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lat.toFixed(6) + ", " + OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lng.toFixed(6); - callReverseGeocoder(OSRM.CONSTANTS.TARGET_LABEL, OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lat, OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lng); + callReverseGeocoder(OSRM.C.TARGET_LABEL, OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lat, OSRM.G.markers.route[OSRM.G.markers.route.length-1].getPosition().lng); } } //prepare request and call reverse geocoder function callReverseGeocoder(marker_id, lat, lon) { //build request - if (marker_id == OSRM.CONSTANTS.SOURCE_LABEL) { + if (marker_id == OSRM.C.SOURCE_LABEL) { var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&lat=" + lat + "&lon=" + lon; OSRM.JSONP.call( call, showReverseGeocoderResults_Source, showReverseGeocoderResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_source" ); - } else if (marker_id == OSRM.CONSTANTS.TARGET_LABEL) { + } else if (marker_id == OSRM.C.TARGET_LABEL) { var call = OSRM.DEFAULTS.HOST_REVERSE_GEOCODER_URL + "?format=json" + "&lat=" + lat + "&lon=" + lon; OSRM.JSONP.call( call, showReverseGeocoderResults_Target, showReverseGeocoderResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "reverse_geocoder_target" ); } @@ -165,8 +165,8 @@ function callReverseGeocoder(marker_id, lat, lon) { //processing JSONP response of reverse geocoder //(with wrapper functions for source/target jsonp) function showReverseGeocoderResults_Timeout() {} -function showReverseGeocoderResults_Source(response) { showReverseGeocoderResults(OSRM.CONSTANTS.SOURCE_LABEL, response); } -function showReverseGeocoderResults_Target(response) { showReverseGeocoderResults(OSRM.CONSTANTS.TARGET_LABEL, response); } +function showReverseGeocoderResults_Source(response) { showReverseGeocoderResults(OSRM.C.SOURCE_LABEL, response); } +function showReverseGeocoderResults_Target(response) { showReverseGeocoderResults(OSRM.C.TARGET_LABEL, response); } function showReverseGeocoderResults(marker_id, response) { //OSRM.debug.log("[inner] reverse geocoder"); if(response){ @@ -190,11 +190,11 @@ function showReverseGeocoderResults(marker_id, response) { if( address == "" ) return; - if(marker_id == OSRM.CONSTANTS.SOURCE_LABEL) { + if(marker_id == OSRM.C.SOURCE_LABEL) { document.getElementById("input-source-name").value = address; OSRM.G.markers.route[0].dirty_move = false; OSRM.G.markers.route[0].dirty_type = false; - } else if(marker_id == OSRM.CONSTANTS.TARGET_LABEL) { + } else if(marker_id == OSRM.C.TARGET_LABEL) { document.getElementById("input-target-name").value = address; OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_move = false; OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type = false; diff --git a/WebContent/main.html b/WebContent/main.html index 9866f1135..4d7428776 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -88,13 +88,13 @@ or see http://www.gnu.org/licenses/agpl.txt. - + - +
Start: Zeigen
Ende: Zeigen
@@ -112,7 +112,7 @@ or see http://www.gnu.org/licenses/agpl.txt.

Options
- Unbenannte Straßen hervorheben + Unbenannte Straßen hervorheben
diff --git a/WebContent/main.js b/WebContent/main.js index 4a660a4f2..97a3527fd 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -152,15 +152,15 @@ function initMap() { // initial map position and zoom OSRM.G.map.setView( new L.LatLng( OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE), OSRM.DEFAULTS.ZOOM_LEVEL); - OSRM.G.map.on('zoomend', function(e) { getRoute(OSRM.CONSTANTS.FULL_DESCRIPTION); }); + OSRM.G.map.on('zoomend', function(e) { getRoute(OSRM.C.FULL_DESCRIPTION); }); OSRM.G.map.on('contextmenu', function(e) {}); // click on map to set source and target nodes OSRM.G.map.on('click', function(e) { if( !OSRM.G.markers.hasSource() ) - onclickGeocoderResult(OSRM.CONSTANTS.SOURCE_LABEL, e.latlng.lat, e.latlng.lng, true, false ); + onclickGeocoderResult(OSRM.C.SOURCE_LABEL, e.latlng.lat, e.latlng.lng, true, false ); else if( !OSRM.G.markers.hasTarget() ) - onclickGeocoderResult(OSRM.CONSTANTS.TARGET_LABEL, e.latlng.lat, e.latlng.lng, true, false ); + onclickGeocoderResult(OSRM.C.TARGET_LABEL, e.latlng.lat, e.latlng.lng, true, false ); } ); } @@ -217,7 +217,7 @@ function checkURL(){ // case 1: destination given if( destination != undefined ) { - onclickGeocoderResult(OSRM.CONSTANTS.TARGET_LABEL, destination.lat, destination.lng, (destination_name == undefined) ); + onclickGeocoderResult(OSRM.C.TARGET_LABEL, destination.lat, destination.lng, (destination_name == undefined) ); if( destination_name != undefined ) document.getElementById("input-target-name").value = destination_name; return; @@ -227,11 +227,11 @@ function checkURL(){ if( positions != []) { // draw via points if( positions.length > 0) { - onclickGeocoderResult(OSRM.CONSTANTS.SOURCE_LABEL, positions[0].lat, positions[0].lng, true, false ); + onclickGeocoderResult(OSRM.C.SOURCE_LABEL, positions[0].lat, positions[0].lng, true, false ); //OSRM.G.markers.setSource( positions[0] ); } if(positions.length > 1) { - onclickGeocoderResult(OSRM.CONSTANTS.TARGET_LABEL, positions[positions.length-1].lat, positions[positions.length-1].lng, true, false ); + onclickGeocoderResult(OSRM.C.TARGET_LABEL, positions[positions.length-1].lat, positions[positions.length-1].lng, true, false ); //OSRM.G.markers.setTarget( positions[positions.length-1] ); } for(var i=1; i 1){ - OSRM.G.markers.route[0].label = OSRM.CONSTANTS.SOURCE_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[OSRM.G.markers.route.length-1].label = OSRM.CONSTANTS.TARGET_LABEL; + 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') ); } // recompute route if( OSRM.G.route.isShown() ) { - getRoute(OSRM.CONSTANTS.FULL_DESCRIPTION); + getRoute(OSRM.C.FULL_DESCRIPTION); OSRM.G.markers.highlight.hide(); } else { document.getElementById('information-box').innerHTML = ""; @@ -475,9 +475,9 @@ function reverseRouting() { // click: button "show" function centerMarker(marker_id) { - if( marker_id == OSRM.CONSTANTS.SOURCE_LABEL && OSRM.G.markers.hasSource() && !OSRM.G.markers.route[0].dirty_type ) { + if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() && !OSRM.G.markers.route[0].dirty_type ) { OSRM.G.markers.route[0].centerView(); - } else if( marker_id == OSRM.CONSTANTS.TARGET_LABEL && OSRM.G.markers.hasTarget() && !OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type) { + } else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() && !OSRM.G.markers.route[OSRM.G.markers.route.length-1].dirty_type) { OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView(); } } diff --git a/WebContent/via.js b/WebContent/via.js index ec106d82a..3c81507ef 100644 --- a/WebContent/via.js +++ b/WebContent/via.js @@ -57,7 +57,7 @@ function findViaPosition( new_via_position ) { var index = OSRM.G.markers.setVia(new_via_index, new_via_position); OSRM.G.markers.route[index].show(); - getRoute(OSRM.CONSTANTS.FULL_DESCRIPTION); + getRoute(OSRM.C.FULL_DESCRIPTION); return new_via_index; } \ No newline at end of file