using viewbox, removing zoom-on-route

This commit is contained in:
DennisSchiefer 2012-06-12 15:55:39 +01:00
parent 1c76c992c1
commit 05410d5587
2 changed files with 5 additions and 9 deletions

View File

@ -34,7 +34,7 @@ call: function(marker_id, query) {
if(query=="")
return;
//geo coordinates given -> directly draw results
// geo coordinates given -> directly draw results
if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){
var coord = query.split(/[,;]/);
OSRM.Geocoder._onclickResult(marker_id, coord[0], coord[1]);
@ -42,11 +42,11 @@ call: function(marker_id, query) {
return;
}
//build request for geocoder
// build basic request for geocoder
var call = OSRM.DEFAULTS.HOST_GEOCODER_URL + "?format=json&json_callback=%jsonp" + OSRM.DEFAULTS.GEOCODER_BOUNDS + "&accept-language="+OSRM.Localization.current_language+"&q=" + query;
// // prioritize results in given viewbox=<left>,<top>,<right>,<bottom>
// var bounds = OSRM.G.map.getBounds();
// call += "&viewbox=" + bounds._southWest.lat + "," + bounds._northEast.lng + "," + bounds._northEast.lat + "," + bounds._southWest.lng;
// prioritize results in currently shown mapview
var bounds = OSRM.G.map.getBounds();
call += "&viewbox=" + bounds._southWest.lat + "," + bounds._northEast.lng + "," + bounds._northEast.lat + "," + bounds._southWest.lng;
OSRM.JSONP.call( call, OSRM.Geocoder._showResults, OSRM.Geocoder._showResults_Timeout, OSRM.DEFAULTS.JSONP_TIMEOUT, "geocoder_"+marker_id, {marker_id:marker_id,query:query} );
},

View File

@ -181,10 +181,6 @@ _snapRoute: function() {
OSRM.Geocoder.updateAddress(OSRM.C.TARGET_LABEL);
OSRM.G.markers.relabelViaMarkers();
// focus on route after computation
// var bounds = new L.LatLngBounds( OSRM.G.route._current_route.getPositions() );
// OSRM.G.map.fitBoundsUI(bounds);
}
};