|
| 1 | +var L = require('leaflet'), |
| 2 | + Control = require('./control'), |
| 3 | + Itinerary = require('./itinerary'), |
| 4 | + Line = require('./line'), |
| 5 | + OSRMv1 = require('./osrm-v1'), |
| 6 | + Plan = require('./plan'), |
| 7 | + Waypoint = require('./waypoint'), |
| 8 | + Autocomplete = require('./autocomplete'), |
| 9 | + Formatter = require('./formatter'), |
| 10 | + GeocoderElement = require('./geocoder-element'), |
| 11 | + Localization = require('./localization'), |
| 12 | + ItineraryBuilder = require('./itinerary-builder'), |
| 13 | + Mapbox = require('./mapbox'), |
| 14 | + ErrorControl = require('./error-control'); |
| 15 | + |
| 16 | +L.routing = { |
| 17 | + control: function(options) { return new Control(options); }, |
| 18 | + itinerary: function(options) { |
| 19 | + return Itinerary(options); |
| 20 | + }, |
| 21 | + line: function(route, options) { |
| 22 | + return new Line(route, options); |
| 23 | + }, |
| 24 | + plan: function(waypoints, options) { |
| 25 | + return new Plan(waypoints, options); |
| 26 | + }, |
| 27 | + waypoint: function(latLng, name, options) { |
| 28 | + return new Waypoint(latLng, name, options); |
| 29 | + }, |
| 30 | + osrmv1: function(options) { |
| 31 | + return new OSRMv1(options); |
| 32 | + }, |
| 33 | + localization: function(options) { |
| 34 | + return new Localization(options); |
| 35 | + }, |
| 36 | + formatter: function(options) { |
| 37 | + return new Formatter(options); |
| 38 | + }, |
| 39 | + geocoderElement: function(wp, i, nWps, plan) { |
| 40 | + return new L.Routing.GeocoderElement(wp, i, nWps, plan); |
| 41 | + }, |
| 42 | + itineraryBuilder: function(options) { |
| 43 | + return new ItineraryBuilder(options); |
| 44 | + }, |
| 45 | + mapbox: function(accessToken, options) { |
| 46 | + return new Mapbox(accessToken, options); |
| 47 | + }, |
| 48 | + errorControl: function(routingControl, options) { |
| 49 | + return new ErrorControl(routingControl, options); |
| 50 | + }, |
| 51 | + autocomplete: function(elem, callback, context, options) { |
| 52 | + return new Autocomplete(elem, callback, context, options); |
| 53 | + } |
| 54 | +}; |
| 55 | + |
| 56 | +module.exports = L.Routing = { |
| 57 | + Control: Control, |
| 58 | + Itinerary: Itinerary, |
| 59 | + Line: Line, |
| 60 | + OSRMv1: OSRMv1, |
| 61 | + Plan: Plan, |
| 62 | + Waypoint: Waypoint, |
| 63 | + Autocomplete: Autocomplete, |
| 64 | + Formatter: Formatter, |
| 65 | + GeocoderElement: GeocoderElement, |
| 66 | + Localization: Localization, |
| 67 | + Formatter: Formatter, |
| 68 | + ItineraryBuilder: ItineraryBuilder, |
| 69 | + |
| 70 | + // Legacy; remove these in next major release |
| 71 | + control: L.routing.control, |
| 72 | + itinerary: L.routing.itinerary, |
| 73 | + line: L.routing.line, |
| 74 | + plan: L.routing.plan, |
| 75 | + waypoint: L.routing.waypoint, |
| 76 | + osrmv1: L.routing.osrmv1, |
| 77 | + geocoderElement: L.routing.geocoderElement, |
| 78 | + mapbox: L.routing.mapbox, |
| 79 | + errorControl: L.routing.errorControl, |
| 80 | +}; |
0 commit comments