Responsible class for routing and visualizing routes on the map.
EMAPI. | Responsible class for routing and visualizing routes on the map. |
Functions | |
EMAPI. | The constructor of a new instance EMAPI.Router class. |
addWaypoint | Adds a new waypoint to the list of wayPoints. |
setWaypoint | Change the location of the waypoint. |
removeWaypoints | Removes all waypoints from the list of wayPoints. |
removeWaypoint | Deletes the selected way point from the list of wayPoints. |
swapWaypoint | Replaces in order two selected from the list of wayPoints. |
calculateRoute | Calculates a route between points placed in the list of wayPoints after the selected vehicle, driver and routing parameters. |
activateRoute | Activates the selected route from the calculated alternative routes. |
drivers | Returns the list of drivers during routing |
vehicles | Returns the list of vehicles used during routing |
wayPoints | Returns the list of waypoints. |
routeRepresentation | Returns result of calculated route. |
The constructor of a new instance EMAPI.Router class.
obj | {Object} An object of EMAPI.Map class or text client token. |
options | {Object} An object with additional parameters of class instance e.g. preserveViewport (turning off maps repositioning), forceCalc (automatic routing after changes), reportPointsHandlerPointsName (element’s ID on website which have to contain the list of waypoints), reportResultHandlerName (element’s ID on website which have to contain route report). |
addWaypoint: function( lonLat, pointType, callback )
Adds a new waypoint to the list of wayPoints. Data transmitted to the third parameter substituted the features included:
lonLat | {EMAPI.LonLat} EMAPI.LonLat object representing the type of waypoint coordinates. |
pointType | {Integer} Type a waypoint: 0 = starting point, 1 = waypoint, 2 = final via point. Via point is always added before the final one. |
callback | {Function} The geographic data function of designated point. |
setWaypoint: function( index, lonLat, callback )
Change the location of the waypoint. Data transmitted to the third parameter substituted the features included:
index | {Integer} The index of waypoint in the wayPoints list: 0 = starting point, etc. |
lonLat | {EMAPI.LonLat} EMAPI.LonLat object representing the type of the geographical waypoint coordinates. |
callback | {Function} The geographic data function of designated point. |
removeWaypoints: function()
Removes all waypoints from the list of wayPoints.
calculateRoute: function( vehicle, driver, roadType, routeOptions, callback, force )
Calculates a route between points placed in the list of wayPoints after the selected vehicle, driver and routing parameters. Data passed to the function in parameter substituted include:
vehicle | {EMAPI.Router.VehicleParams} EMAPI.Router.VehicleParams object representing the settings for the vehicle to be used for routing. |
driver | {EMAPI.Router.DriverParams} EMAPI.Router.DriverParams object representing the settings for the driver to be used to designate the route. |
roadType | {Integer} Type of route calculation: 0 = the shortest, 1 = the fastest, 2 = the cheapest. |
routeOptions | {Object} An object that contains routing options in the form of logical fields: useDifficulties = true, forces the use of traffic congestion useFerry = true turns on the use of ferries, useGroundRoad = true turn on the use of unpaved roads. useTrafficTI = true turns the use of the current traffic information, useArchivalTraffic = true turns the use of archived traffic information, useLogistic = true turns the use of road restriction, avoidToll = true turns avoiding of toll road. viaToll = true turns the viaTOLL cost calculating, avoidViaToll = true turns avoiding of viaTOLL road. useVignette = true turn the use of calculating roads with vignettes, useSoftRestrictions = true allows access to the blocked waypoint. avoidLowCategoryRoads = true turn the use of avoiding low categories roads, alternativeRoutes = true turns calculating of two additional alternative roads. |
force | {Boolean} Information - calculate a route immediately, or wait calculating of the earlier routes. |
drivers: function()
Returns the list of drivers during routing
{EMAPI.ArrayObjects} List of drivers during routing This is an array of objects EMAPI.Router.DriverParams class managed by an object of EMAPI.ArrayObjects class. By default, these parameters include the following drivers representing typical applications: Experienced i Unexperienced.
vehicles: function()
Returns the list of vehicles used during routing
{EMAPI.ArrayObjects} List of vehicles during routing. This is an array of objects EMAPI.Router.VehicleParams class managed by an object of EMAPI.ArrayObjects class. By default, these parameters include the following vehicles representing typical applications: Passenger car, Fast passenger car, Transport truck 10t, Transport truck 20t, Delivery truck, Motorcycle, Bicycle and Pedestrian.
wayPoints: function()
Returns the list of waypoints.
{EMAPI.ArrayObjects} List of waypoints. This is an array of objects EMAPI.Router.WayPoint class managed by an object of EMAPI.ArrayObjects or functions addWaypoint, setWaypoint, removeWaypoint, removeWaypoints and swapWaypoint. By default it is empty.
routeRepresentation: function()
Returns result of calculated route.
{EMAPI.Router.RouteRepresentation} Representation and parameters determined by the calculateRoute function.
Adds a new waypoint to the list of wayPoints.
addWaypoint: function( lonLat, pointType, callback )
Returns the list of waypoints.
wayPoints: function()
Change the location of the waypoint.
setWaypoint: function( index, lonLat, callback )
Removes all waypoints from the list of wayPoints.
removeWaypoints: function()
Deletes the selected way point from the list of wayPoints.
removeWaypoint: function( index )
Replaces in order two selected from the list of wayPoints.
swapWaypoint: function( firstPointIndex, secondPointIndex )
Calculates a route between points placed in the list of wayPoints after the selected vehicle, driver and routing parameters.
calculateRoute: function( vehicle, driver, roadType, routeOptions, callback, force )
Activates the selected route from the calculated alternative routes.
activateRoute: function( index )
Returns the list of drivers during routing
drivers: function()
Returns the list of vehicles used during routing
vehicles: function()
Returns result of calculated route.
routeRepresentation: function()