Convert tabs to spaces
(because I'll be lynched otherwise, mutter grumble)
This commit is contained in:
parent
926c7b56a8
commit
5c0e96e0e0
3 changed files with 354 additions and 370 deletions
|
@ -1,15 +1,5 @@
|
||||||
/*
|
/*
|
||||||
osm.org routing interface
|
osm.org routing interface
|
||||||
|
|
||||||
See also:
|
|
||||||
https://github.com/apmon/openstreetmap-website/tree/routing2
|
|
||||||
https://github.com/apmon/openstreetmap-website/compare/routing2
|
|
||||||
https://github.com/apmon/openstreetmap-website/blob/9755c3ae0a8d0684d43760f91dc864ff42d8477a/app/views/routing/start.js.erb
|
|
||||||
|
|
||||||
*** translation (including all alerts and presentation)
|
|
||||||
*** export GPX
|
|
||||||
*** URL history (or do we consciously not want to support that?)
|
|
||||||
*** add YOURS engine
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var TURN_INSTRUCTIONS=[]
|
var TURN_INSTRUCTIONS=[]
|
||||||
|
@ -23,7 +13,6 @@ var ROUTING_POLYLINE={
|
||||||
|
|
||||||
OSM.RoutingEngines={
|
OSM.RoutingEngines={
|
||||||
list: []
|
list: []
|
||||||
// common functions and constants, e.g. OSRM parser, can go here
|
|
||||||
};
|
};
|
||||||
|
|
||||||
OSM.Routing=function(map,name,jqSearch) {
|
OSM.Routing=function(map,name,jqSearch) {
|
||||||
|
@ -88,10 +77,8 @@ OSM.Routing=function(map,name,jqSearch) {
|
||||||
r.geocode=function(id,event) { var _this=this;
|
r.geocode=function(id,event) { var _this=this;
|
||||||
var field=event.target;
|
var field=event.target;
|
||||||
var v=event.target.value;
|
var v=event.target.value;
|
||||||
// *** do something if v==''
|
|
||||||
var querystring = '<%= NOMINATIM_URL %>search?q=' + encodeURIComponent(v) + '&format=json';
|
var querystring = '<%= NOMINATIM_URL %>search?q=' + encodeURIComponent(v) + '&format=json';
|
||||||
// *** &accept-language=<%#= request.user_preferred_languages.join(',') %>
|
// *** &accept-language=<%#= request.user_preferred_languages.join(',') %>
|
||||||
// *** prefer current viewport
|
|
||||||
r[field.id]=false;
|
r[field.id]=false;
|
||||||
$.getJSON(querystring, function(json) { _this._gotGeocode(json,field); });
|
$.getJSON(querystring, function(json) { _this._gotGeocode(json,field); });
|
||||||
};
|
};
|
||||||
|
@ -181,8 +168,6 @@ OSM.Routing=function(map,name,jqSearch) {
|
||||||
r.setPolyline=function(line) {
|
r.setPolyline=function(line) {
|
||||||
if (r.polyline) map.removeLayer(r.polyline);
|
if (r.polyline) map.removeLayer(r.polyline);
|
||||||
r.polyline=L.polyline(line, ROUTING_POLYLINE).addTo(r.map);
|
r.polyline=L.polyline(line, ROUTING_POLYLINE).addTo(r.map);
|
||||||
// r.map.fitBounds(r.polyline.getBounds());
|
|
||||||
// *** ^^^ we only want to do this for geocode-originated routes
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Take directions and write them out
|
// Take directions and write them out
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// see:
|
// For docs, see:
|
||||||
// http://developer.mapquest.com/web/products/open/directions-service
|
// http://developer.mapquest.com/web/products/open/directions-service
|
||||||
// http://open.mapquestapi.com/directions/
|
// http://open.mapquestapi.com/directions/
|
||||||
// https://github.com/apmon/openstreetmap-website/blob/21edc353a4558006f0ce23f5ec3930be6a7d4c8b/app/controllers/routing_controller.rb#L153
|
// https://github.com/apmon/openstreetmap-website/blob/21edc353a4558006f0ce23f5ec3930be6a7d4c8b/app/controllers/routing_controller.rb#L153
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// OSRM car engine
|
// OSRM car engine
|
||||||
// *** need to clear hints at some point
|
// Doesn't yet support hints
|
||||||
|
|
||||||
OSRMEngine = function(vehicleName, baseURL, locale) {
|
OSRMEngine = function(vehicleName, baseURL, locale) {
|
||||||
this.vehicleName = vehicleName;
|
this.vehicleName = vehicleName;
|
||||||
|
@ -34,7 +34,6 @@ OSRMEngine.prototype.createConfig = function() {
|
||||||
var line=L.PolylineUtil.decode(data.route_geometry);
|
var line=L.PolylineUtil.decode(data.route_geometry);
|
||||||
for (i=0; i<line.length; i++) { line[i].lat/=10; line[i].lng/=10; }
|
for (i=0; i<line.length; i++) { line[i].lat/=10; line[i].lng/=10; }
|
||||||
router.setPolyline(line);
|
router.setPolyline(line);
|
||||||
// *** store hints
|
|
||||||
// Assemble instructions
|
// Assemble instructions
|
||||||
var steps=[];
|
var steps=[];
|
||||||
for (i=0; i<data.route_instructions.length; i++) {
|
for (i=0; i<data.route_instructions.length; i++) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue