-var TURN_INSTRUCTIONS = [];
-
-var ROUTING_POLYLINE = {
- color: '#03f',
- opacity: 0.3,
- weight: 10
-};
-
-var ROUTING_POLYLINE_HIGHLIGHT = {
- color: '#ff0',
- opacity: 0.5,
- weight: 12
-};
-
-OSM.DirectionsEngines = {
- list: [],
- add: function (supportsHTTPS, engine) {
- if (document.location.protocol == "http:" || supportsHTTPS) this.list.push(engine);
- }
-};
-
-OSM.Directions = function (map, name, jqSearch) {
- var r = {};
-
- TURN_INSTRUCTIONS = [
- "",
- I18n.t('javascripts.directions.instructions.continue_on'), // 1
- I18n.t('javascripts.directions.instructions.slight_right'), // 2
- I18n.t('javascripts.directions.instructions.turn_right'), // 3
- I18n.t('javascripts.directions.instructions.sharp_right'), // 4
- I18n.t('javascripts.directions.instructions.uturn'), // 5
- I18n.t('javascripts.directions.instructions.sharp_left'), // 6
- I18n.t('javascripts.directions.instructions.turn_left'), // 7
- I18n.t('javascripts.directions.instructions.slight_left'), // 8
- I18n.t('javascripts.directions.instructions.via_point'), // 9
- I18n.t('javascripts.directions.instructions.follow'), // 10
- I18n.t('javascripts.directions.instructions.roundabout'), // 11
- I18n.t('javascripts.directions.instructions.leave_roundabout'), // 12
- I18n.t('javascripts.directions.instructions.stay_roundabout'), // 13
- I18n.t('javascripts.directions.instructions.start'), // 14
- I18n.t('javascripts.directions.instructions.destination'), // 15
- I18n.t('javascripts.directions.instructions.against_oneway'), // 16
- I18n.t('javascripts.directions.instructions.end_oneway') // 17
- ];
-
- r.map = map; // Leaflet map
- r.name = name; // global variable name of this instance (needed for JSONP)
- r.jqSearch = jqSearch; // JQuery object for search panel
-
- r.route_from = null; // null=unset, false=awaiting response, [lat,lon]=geocoded
- r.route_to = null; // |
- r.awaitingGeocode = false;// true if the user has requested a route, but we're waiting on a geocode result
- r.awaitingRoute = false; // true if we've asked the engine for a route and are waiting to hear back
- r.dragging = false; // true if the user is dragging a start/end point
- r.viaPoints = []; // not yet used
-
- r.polyline = null; // Leaflet polyline object
- r.popup = null; // Leaflet popup object
- r.marker_from = null; // Leaflet from marker
- r.marker_to = null; // Leaflet to marker
-
- r.chosenEngine = null; // currently selected routing engine
-
- var icon_from = L.icon({
- iconUrl: <%= asset_path('marker-green.png').to_json %>,
- iconSize: [25, 41],
- iconAnchor: [12, 41],
- popupAnchor: [1, -34],
- shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
- shadowSize: [41, 41]