Apparently 'final' is a reserved word in JS...

This commit is contained in:
Richard Fairhurst 2014-01-23 22:29:09 +00:00
parent 7c13b43f31
commit 149182f620
5 changed files with 8 additions and 8 deletions

View file

@ -159,10 +159,10 @@ OSM.Routing=function(map,name,jqSearch) {
// Route-fetching UI // Route-fetching UI
r.requestRoute=function(final) { r.requestRoute=function(isFinal) {
if (r.route_from && r.route_to) { if (r.route_from && r.route_to) {
r.awaitingRoute=true; r.awaitingRoute=true;
r.chosenEngine.getRoute(final,[r.route_from,r.route_to]); r.chosenEngine.getRoute(isFinal,[r.route_from,r.route_to]);
// then, when the route has been fetched, it'll call the engine's gotRoute function // then, when the route has been fetched, it'll call the engine's gotRoute function
} else if (r.route_from==false || r.route_to==false) { } else if (r.route_from==false || r.route_to==false) {
// we're waiting for a Nominatim response before we can request a route // we're waiting for a Nominatim response before we can request a route

View file

@ -16,7 +16,7 @@ OSM.RoutingEngines.list.push({
"TSHR": 4, "TSHR": 4,
"TU": 5 "TU": 5
}, // was half expecting to see TLDR in there }, // was half expecting to see TLDR in there
getRoute: function(final,points) { getRoute: function(isFinal,points) {
var url="http://routes.cloudmade.com/8ee2a50541944fb9bcedded5165f09d9/api/0.3/"; var url="http://routes.cloudmade.com/8ee2a50541944fb9bcedded5165f09d9/api/0.3/";
var p=[]; var p=[];
for (var i=0; i<points.length; i++) { for (var i=0; i<points.length; i++) {

View file

@ -4,13 +4,13 @@ OSM.RoutingEngines.list.push({
name: 'Bicycle (GraphHopper)', name: 'Bicycle (GraphHopper)',
draggable: true, draggable: true,
_hints: {}, _hints: {},
getRoute: function(final, points) { getRoute: function(isFinal, points) {
var url = "http://graphhopper.com/routing/api/route?vehicle=bike&locale=en"; var url = "http://graphhopper.com/routing/api/route?vehicle=bike&locale=en";
for (var i = 0; i < points.length; i++) { for (var i = 0; i < points.length; i++) {
var pair = points[i].join(','); var pair = points[i].join(',');
url += "&point=" + pair; url += "&point=" + pair;
} }
if (final) if (isFinal)
url += "&instructions=true"; url += "&instructions=true";
this.requestJSONP(url + "&type=jsonp&callback="); this.requestJSONP(url + "&type=jsonp&callback=");
}, },

View file

@ -30,7 +30,7 @@ OSM.RoutingEngines.list.push({
17: 8, // left fork 17: 8, // left fork
18: 1 // straight fork 18: 1 // straight fork
}, },
getRoute: function(final,points) { getRoute: function(isFinal,points) {
var url="http://open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluur290anu%2Crl%3Do5-908a0y"; var url="http://open.mapquestapi.com/directions/v2/route?key=Fmjtd%7Cluur290anu%2Crl%3Do5-908a0y";
var from=points[0]; var to=points[points.length-1]; var from=points[0]; var to=points[points.length-1];
url+="&from="+from.join(','); url+="&from="+from.join(',');

View file

@ -6,14 +6,14 @@ OSM.RoutingEngines.list.push({
name: 'Car (OSRM)', name: 'Car (OSRM)',
draggable: true, draggable: true,
_hints: {}, _hints: {},
getRoute: function(final,points) { getRoute: function(isFinal,points) {
var url="http://router.project-osrm.org/viaroute?z=14&output=json"; var url="http://router.project-osrm.org/viaroute?z=14&output=json";
for (var i=0; i<points.length; i++) { for (var i=0; i<points.length; i++) {
var pair=points[i].join(','); var pair=points[i].join(',');
url+="&loc="+pair; url+="&loc="+pair;
if (this._hints[pair]) url+= "&hint="+this._hints[pair]; if (this._hints[pair]) url+= "&hint="+this._hints[pair];
} }
if (final) url+="&instructions=true"; if (isFinal) url+="&instructions=true";
this.requestJSONP(url+"&jsonp="); this.requestJSONP(url+"&jsonp=");
}, },
gotRoute: function(router,data) { gotRoute: function(router,data) {