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 | UDeletes 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), routeLineColor (color of route line), alternativeRouteLineColor (color of line for alternative route), tollRouteLineColor (color of toll route line), routeLineWidth (width of route line). |
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, params )
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 callback 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 allows the use of calculating roads with vignettes, useSoftRestrictions = true allows access to the blocked waypoint, avoidLowCategoryRoads = true turns the use of avoiding low categories roads, alternativeRoutes = true turns calculating of two additional alternative roads (option is not active when useToll is active), useToll = true turns use and returns summary of toll roads across Europe, noTaxCosts = changes in the resulting amount of road tolls to the netto (by default gross amounts are returned), includeViaTollCosts = true turns on including viaTOLL costs for total and detailed costs returned in the route report includeTollCosts = true turns on including road tolls in Europe for the total and detailed costs returned in the route report. |
callback | {Function} The function of handling the results of the designated route. |
force | {Boolean} Information whether to calculate the route immediately, or to wait for the completion of earlier routes. |
params | {Object} Additional parameters of route calculation: currency (currency of parameters and results in the form of a 3-letter international currency code, PLN by default), vinettespanday (duration of the vignette as a range of days, default 7-14), returnMapaMapRoute (true turns on returning an additional route file in the MapaMap’s format). |
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 i 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 i 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()
UDeletes 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, params )
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()