new IWRoutingManager()
Singleton constructor
Methods
-
abortRouteCalculation()
-
Aborts listening to the response from the current calculated route
-
addInterstation(address, doRequest, zoom)
-
Adds an interstation address and triggers the oninterstationset event.
Parameters:
Name Type Description address
IWAbstractAddress an address doRequest
boolean zoom
boolean set to true to zoom to the route when done or false to keep the current part of the map (optional, default is true) Returns:
true if the interstation was added to the route, false otherwise- Type
- boolean
-
calculateRoute(zoom)
-
Calculates a route. This has to be called after at least a valid start and destination have been set. When the route is available it is rendered and the onroute event is triggered.
Parameters:
Name Type Description zoom
Number the zoom level Returns:
- Type
- void
-
clearRoute()
-
Removes the drawn route from the map
-
displayRoute(routes, zoom, index)
-
Displays a computed route (with alternatives) on the map.
Parameters:
Name Type Description routes
Array.<IWRoute> an array of routes (i.e. a route with alternatives) zoom
boolean set to true to zoom to the route when done or false to keep the current part of the map (optional, default is true) index
number the index of the active (i.e. selected by the user) tour in the array Returns:
- Type
- void
-
geocodeAddresses()
-
Geocodes start, destination and all interstations. When done, the event oninputchecked is triggered. If start or destination are empty an exception is thrown.
Returns:
- Type
- void
-
getDestinationAddress()
-
Returns the current destination address, or null if no address has been set yet.
Returns:
- Type
- IWAbstractAddress
-
getDisplayedRouteElement()
-
Return the object element of the current displayed route (polyline)
Returns:
- Type
- null | IWPolyline
-
getDisplayedRouteOutlineElement()
-
Return the object element of the current displayed route's outline (polyline)
Returns:
- Type
- null | IWPolyline
-
getInterstationAddresses()
-
Returns the current interstation addresses, or an empty array if no addresses has been set yet.
- Deprecated:
-
- use getItinerary instead
Returns:
- Type
- Array.<IWAbstractAddress>
-
getRouteOptions()
-
Returns the current route options.
These options define the profile for one route, e.g. the speed profile and pedestrian routing. See IWRoutingManager.setRouteOptions() for a description of the supported options.- See:
-
- IWRoutingManager.setRouteOptions
Returns:
- Type
- Object
-
getStartAddress()
-
Returns the current start address, or null if no address has been set yet.
Returns:
- Type
- IWAbstractAddress
-
hideRoute()
-
Removes the route layer from the map and triggers the onroutehide event, but does not clear the addresses (to let the user edit the addresses).
Returns:
- Type
- void
-
initialize(map, canDragRouteToRecalculate)
-
Initializes the manager with the specified map.
Parameters:
Name Type Description map
IWMap canDragRouteToRecalculate
boolean Returns:
- Type
- void
-
isAddressComplete(address)
-
Checks if the specified object is a valid address (i.e. has a postal code or city name in case of a structured address).
Parameters:
Name Type Description address
object the address to test Returns:
- Type
- boolean
-
print(route, options)
-
Opens a print view in a new browser window. This shows the driving directions of the specified route, but no map.
Supported options:Property Type Description Default copyright String a copyright notice displayed on the bottom of the page logo String the URL of an image displayed on the top of the page
Parameters:
Name Type Description route
IWRoute the route options
object an object with the options as defined above (optional) Returns:
- Type
- void
-
removeRoute()
-
Removes the route layer from the map, clears all routing addresses and triggers the onrouteclear event.
Returns:
- Type
- void
-
requestRoute(zoom)
-
Requests the route from the server.
Parameters:
Name Type Description zoom
boolean set to true to zoom to the route when done or false to keep the current part of the map (optional, default is true) - Deprecated:
-
- use calculateRoute() if your addresses already have coordinates, geocodeAddresses() instead
Returns:
- Type
- void
-
setInterstations(addresses, doRequest, zoom)
-
Sets an array with interstation addresses and triggers the oninterstationset event.
Parameters:
Name Type Description addresses
Array.<IWAbstractAddress> an array with addresses doRequest
boolean send a request to the server to calculate or update the route (optional, default is true) zoom
boolean set to true to zoom to the route when done or false to keep the current part of the map (optional, default is true) - Deprecated:
-
- use setItinerary instead
Returns:
- Type
- void
-
setMarkerOffset(offset)
-
Sets the offset which is used when the map is zoomed (default: do not use an offset). The offset can be an object with properties top, right, bottom and left to specify individual offsets for all map borders, or an integer which is used for every border, or null (no borders).
Parameters:
Name Type Description offset
object an object as described above, or an integer value Returns:
- Type
- void
-
setRenderingAttributes(attributes)
-
Sets attributes to render the route in the map. The route is a polyline, so you can use all IWMapRenderer attributes supported for lines. In addition to that you can toggle the rendering of arrows indicating the driving direction.
Example:var renderAttributes: { stroke: 'blue', strokeDashStyle: 'solid', strokeWidth: 5, strokeOpacity: 0.8, outlineColor: 'white', outlineWidth: 2, directionArrows: true };
Parameters:
Name Type Description attributes
object the rendering attributes Returns:
- Type
- void
-
setRouteOptions(routeOptions)
-
Sets the options for the route to calculate.
These options define the profile for one route, e.g. the speed profile and pedestrian routing. They should be configurable by the user.
Supported options:Property Type Description Default mode String the routing mode, i.e. one of the constants defined in this class MODE_FASTEST speedHighway int the average speed on a highway 100 speedRoad int the average speed on a speedRoad 60 speedCity int the average speed on a speedCity 30 pedestrian boolean pedestrian mode (ignores highways, different speed profile) false trafficAlerts boolean routing with traffic alerts false
Parameters:
Name Type Description routeOptions
Object an object with the options as defined above Returns:
- Type
- void
-
updateDestination(address, doRequest, zoom)
-
Sets a new destination address and triggers the ondestinationset event.
Parameters:
Name Type Description address
IWAbstractAddress an address doRequest
boolean send a request to the server to calculate or update the route (optional, default is true) zoom
boolean set to true to zoom to the route when done or false to keep the current part of the map (optional, default is true) Returns:
- Type
- void
-
updateStart(address, doRequest, zoom)
-
Sets a new start address and triggers the onstartset event.
Parameters:
Name Type Description address
IWAbstractAddress an address doRequest
boolean send a request to the server to calculate or update the route (optional, default is true) zoom
boolean set to true to zoom to the route when done or false to keep the current part of the map (optional, default is true) Returns:
- Type
- void