Too close of a name collision to OSM.Router.
//= require index/history
//= require index/note
//= require index/new_note
+//= require index/directions
//= require router
-//= require routing
-//= require_tree ./routing_engines
(function() {
var loaderTimeout;
$(".search_form").on("submit", function(e) {
e.preventDefault();
if ($(".query_wrapper.routing").is(":visible")) {
- // Routing
- OSM.routing.requestRoute(true, true);
+ // Directions
+ OSM.directions.requestRoute(true, true);
} else {
// Search
$("header").addClass("closed");
map.getCenter().lng.toFixed(precision)));
});
- OSM.routing = OSM.Routing(map,'OSM.routing',$('.query_wrapper.routing'));
- OSM.routing.chooseEngine('javascripts.directions.engines.osrm_car');
+ OSM.directions = OSM.Directions(map, 'OSM.directions', $('.query_wrapper.routing'));
+ OSM.directions.chooseEngine('javascripts.directions.engines.osrm_car');
$(".get_directions").on("click",function(e) {
e.preventDefault();
$(".search_form input[type='submit']").addClass("routing_submit");
$(".query_wrapper.routing [name=route_from]").focus();
$("#map").on('dragend dragover',function(e) { e.preventDefault(); });
- $("#map").on('drop',function(e) { OSM.routing.handleDrop(e); e.preventDefault(); });
+ $("#map").on('drop',function(e) { OSM.directions.handleDrop(e); e.preventDefault(); });
$(".routing_marker").on('dragstart',function(e) {
e.originalEvent.dataTransfer.effectAllowed = 'move';
e.originalEvent.dataTransfer.setData('id', this.id);
$(".search").show();
$(".routing").hide();
$(".search_form input[type='submit']").removeClass("routing_submit");
- OSM.routing.close();
+ OSM.directions.close();
$("#map").off('dragend drop dragover');
$(".routing_marker").off('dragstart');
$(".query_wrapper.search [name=query]").focus();
-/*
- osm.org routing interface
-*/
+//= require_self
+//= require_tree ./directions_engines
var TURN_INSTRUCTIONS = [];
weight: 12
};
-OSM.RoutingEngines = {
+OSM.DirectionsEngines = {
list: [],
add: function (supportsHTTPS, engine) {
if (document.location.protocol == "http:" || supportsHTTPS) this.list.push(engine);
}
};
-OSM.Routing = function (map, name, jqSearch) {
+OSM.Directions = function (map, name, jqSearch) {
var r = {};
TURN_INSTRUCTIONS = [
// Routing engine handling
// Add all engines
- var list = OSM.RoutingEngines.list;
+ var list = OSM.DirectionsEngines.list;
list.sort(function (a, b) {
return I18n.t(a.name) > I18n.t(b.name);
});
};
};
-OSM.RoutingEngines.add(false, new GraphHopperEngine("Bicycle", "vehicle=bike").createConfig());
-OSM.RoutingEngines.add(false, new GraphHopperEngine("Foot", "vehicle=foot").createConfig());
+OSM.DirectionsEngines.add(false, new GraphHopperEngine("Bicycle", "vehicle=bike").createConfig());
+OSM.DirectionsEngines.add(false, new GraphHopperEngine("Foot", "vehicle=foot").createConfig());
};
};
-OSM.RoutingEngines.add(true, new MapQuestEngine("Bicycle", "routeType=bicycle").createConfig());
-OSM.RoutingEngines.add(true, new MapQuestEngine("Foot", "routeType=pedestrian").createConfig());
-OSM.RoutingEngines.add(true, new MapQuestEngine("Car", "routeType=fastest").createConfig());
+OSM.DirectionsEngines.add(true, new MapQuestEngine("Bicycle", "routeType=bicycle").createConfig());
+OSM.DirectionsEngines.add(true, new MapQuestEngine("Foot", "routeType=pedestrian").createConfig());
+OSM.DirectionsEngines.add(true, new MapQuestEngine("Car", "routeType=fastest").createConfig());
// can be: routeType=fastest|shortest|pedestrian|multimodal|bicycle
};
};
-OSM.RoutingEngines.add(false, new OSRMEngine("Car", "http://router.project-osrm.org/viaroute").createConfig());
+OSM.DirectionsEngines.add(false, new OSRMEngine("Car", "http://router.project-osrm.org/viaroute").createConfig());
<div class='query_wrapper routing'>
<%= image_tag "marker-green.png", :class => 'routing_marker', :id => 'marker_from', :draggable => 'true' %>
- <%= text_field_tag "route_from", params[:from], :placeholder => t('site.search.from'), :onchange=>"OSM.routing.geocode('route_from',event)" %>
+ <%= text_field_tag "route_from", params[:from], :placeholder => t('site.search.from'), :onchange=>"OSM.directions.geocode('route_from',event)" %>
<%= image_tag "marker-red.png" , :class => 'routing_marker', :id => 'marker_to' , :draggable => 'true' %>
- <%= text_field_tag "route_to" , params[:to] , :placeholder => t('site.search.to') , :onchange=>"OSM.routing.geocode('route_to' ,event)" %>
- <select class='routing_engines' name='routing_engines' onchange="OSM.routing.selectEngine(event)"></select>
+ <%= text_field_tag "route_to" , params[:to] , :placeholder => t('site.search.to') , :onchange=>"OSM.directions.geocode('route_to' ,event)" %>
+ <select class='routing_engines' name='routing_engines' onchange="OSM.directions.selectEngine(event)"></select>
<%= image_tag "searching-small.gif", :class => 'spinner', :style => "vertical-align: middle; display: none;" %>
</div>