RouteClass
This class creates a customisable routing component comprising two search boxes for start and end points of the route with search suggestion lists and a mode button for setting the routing mode - walk, drive or public transport Not all modes are available in all territories and walk mode is unavailable for routes of greater than 50km. Insert into your application as a component:
Example
route: {
control: nokia.mh5.components.Route({
listeners: {
beforeroute: function(results) {
log("Route: beforeroute received");
},
clear: function(results) {
log("Route: clear received");
},
success: function(results) {
log("Route: success received");
},
error: function() {
log("Route: error received");
}
}
cssClass: myRoutingStyles
})
}
If you want to use the routing component independently from the rest of the framework,
don't forget to include your appId and appCode
Example
var myRoute = nokia.mh5.components.Route({
listeners: {
success: function(results) {
...
}
}
parameters: {
appId: "zq55GGLOm2YioJe4pzVU",
appCode: "MH5Examples"
}
});
Inheritance hierarchy
nokia.mh5.Classnokia.mh5.ui.Control
nokia.mh5.ui.Container
nokia.mh5.components.Route
Constructor Detail
Creates a new instance of route component with given properties. Every property is optional and every property can be overwritten, see example in class definition.
new nokia.mh5.components.Route(props, parentContainer);
Constructor Parameters
| Type | Name | Description |
|---|---|---|
| Object | props | properties for the Route component |
| Object | routeAdapter | custom route adapter (for switching to a different routing service) |
| Object | from | start of the route |
| Number | latitude | start's latitude |
| Number | longitude | start's longitude |
| String | name | start's name |
| Object | to | route's destination |
| Number | latitude | destination's latitude |
| Number | longitude | destination's longitude |
| String | name | destination's name |
| Object | parameters | hash containg route's parameters which are passed to route adapter |
| Object | listeners | hash of listeners for events fired by route component |
| Function | beforeroute | function called before route is calculated. Event parameter passed to the function contains data property, which contains the start, destination and current parameters. |
| Function | clear | function called when route is cleared |
| Function | success | function called after successful route calculation. Event parameter passed to the function contains data property, which contains the shape, maneuvers and bounding box of calculated route. |
| Function | error | function called after error occurs during route calculation. Event parameter passed to the function contains data property, which contains the error message. |
| nokia.mh5.ui.Container | parentContainer | parent container of the route component |
Methods Hide Inherited
![]() ![]() |
remove | Removes a specified a control from the container, if it can be found. |
![]() ![]() |
add | Adds a control with the specified name to the container and adds the "parent" property set to the container to it. |
![]() ![]() |
getContentRoot | Returns the real DOM node of the control without scroll wrapper (if present). |
![]() ![]() |
getRootOwnerByClass | Retrieves the instance that owns the root node of the specified Class. Used to retrieve creator of the component inside bound events. |
![]() ![]() |
insertBefore | Inserts a control with a specified name to the container before the control with the specified name and adds the "parent" property set to the container to it. |
![]() ![]() |
prepareBindings | Calls prepareBindings on children controls (if available) and itself. |
![]() ![]() |
prepareDidChangeNotifications | Calls prepareDidChangeNotifications on children controls (if available) and itself. |
![]() |
route | Obtain a route based on from and to points in the route model Calls the success method of build function with the route points as parameters |
Properties Hide Inherited
![]() ![]() |
Boolean | dontBind | makes sure, that the bindings in the container are initialized after the build function of all children is called. |
![]() |
Object | from | current start point, can be used for setting and getting the start point. Setting requires presence of mandatory properties: latitude and longitude. |
![]() |
Object | inputs | contains the From and To fields. |
![]() |
Object | mode | contains the toggle to change map mode |
![]() |
Object | parameters | current parameters, can be used for setting and getting current parameters. Setting requires presence of mandatory property: mode. Possible values are: "walk", "drive" and "pt". |
![]() |
nokia.mh5.adapters.Route | routeAdapter | adapter tied to the Nokia routing service |
![]() |
Object | to | current destination, can be used for setting and getting the destination. Setting requires presence of mandatory properties: latitude and longitude. |
Events
nokia.mh5.components.Route has no events.
Callbacks
nokia.mh5.components.Route has no callbacks.
Classes
nokia.mh5.components.Route has no classes.
Constants
nokia.mh5.components.Route has no constants.
Interfaces
nokia.mh5.components.Route has no interfaces.

