-
Notifications
You must be signed in to change notification settings - Fork 8
DRAFT Navigation Events
Daisuke Sato edited this page Mar 2, 2016
·
6 revisions
Navigation event mechanism provides basic navigation concepts (ex. remaining distance to the next edge) and is useful to provide navigation instruction to users and to build customized user interface easily.
- Events are generated based on a route and current location
- Event type does not ask developer to build any specific user interaction.
| Event Type | Event Object | Description |
|---|---|---|
| navigationWillBegin | NavigationEvent | occurred before showing view |
| navigationDidBegin | NavigationEvent | occurred when navigation is ready |
| navigationWillEnd | NavigationEvent | occurred when navigation is reached to the destination |
| navigationDidEnd | NavigationEvent | occurred after view is set down |
| edgeBegin edgeEnter? |
EdgeEvent | occurred when user is going to start following the edge |
| edgeLocation* | EdgeEvent | occurred when user is reached to the registered location on the edge |
| edgeEnd edgeExit? |
EdgeEvent | occurred when user reached the end of the edge |
| nodeEnter? | EdgeEvent | occurred when user is getting closer to the node |
| nodeExit? | EdgeEvent | occurred when user is going to leave the node |
| turnBegin | EdgeEvent | occurred when user is going to start turning |
| turnEnd | EdgeEvent | occurred when the turn condition is satisfied |
| locationChanged | LocationEvent | low level event to handle location, heading. Called whenever location or heading is changed. |
- *edgeLocation events are issued for registered locations.
- navigationWillBegin
- navigationDidBegin
- edgeBegin, nodeExit
- edgeLocation, edgeLocation, edgeLocation, ....
- edgeEnd, nodeEnter, turnBegin
- turnEnd, nodeExit, edgeBegin
- edgeLocation, edgeLocation, edgeLocation, ...
- edgeEnd, nodeEnter, navigationWillEnd
- navigationDidEnd
- route: array of edges representing the route
- length: total length of the route
- from: start node
- to: destination node
- source: node / edge
- edge: the edge where user is going to be navigated
- if multiple edges are combined, edge has an array combinedEdges containing all combined edges
- next: next edge (to know next action)
- turnAngle: turn angle
- length: length of the edge in the system unit (feet / meter)
- ratio: projected normalized position on the edge (0.0 - 1.0)
- heading: user's heading
- data: raw location data if available
- location: raw location from localizer
- locationType: type of localization (1d/2d)
- location
- locationType
- heading
addEventListener:(NSString*)type options:(NSDictionary*) options callback:(void(^)(EdgeEvent*))handler;
addEventListenerOnce:(NSString*)type options:(NSDictionary*) options callback:(void(^)(EdgeEvent*))handler;
- params is only for edgeLocation event
- remaining, edge
- or time_interval (and/or) distance_interval
[navi addEventListener:@"edgeBegin" options:nil callback:^(EdgeEvent* e) {
NSString *turnStr = util.angleToString(e.turnAngle);
[tts speak:[NSString stringWithFormat:@"%.0f meters and turn %@", e.length, turnStr]]
[navi addEventListenerOnce:@"edgeLocation" options:{remaining: 5, edge:e.edge} callback:^(EdgeEvent *e){
[tts speak:[NSString stringWithFormat:@"approaching to turn %@", turnStr]]
}];
}]