Loading...
Searching...
No Matches
<NCAsyncRouteListener> Protocol Reference

Class provides a callback to be invoked when RouteSession handle changed/advanced events. More...

#include <com/navigine/idl/objc/NCAsyncRouteListener.h>

+ Inheritance diagram for <NCAsyncRouteListener>:

Instance Methods

(void) - onRouteChanged:currentPath:
 Called when new route was built or old route was rebuilt after missing previouse one.
 
(void) - onRouteAdvanced:point:
 Called when user has progressed along the route that was built in the method onRouteChanged
 

Detailed Description

Class provides a callback to be invoked when RouteSession handle changed/advanced events.

Referenced from AsyncRouteManager RouteSession.

Note
The callback is invoked in the UI thread.

Definition at line 22 of file NCAsyncRouteListener.h.

Method Documentation

◆ onRouteAdvanced:point:

- (void) onRouteAdvanced: (float) distance
point: (nonnull NCLocationPoint *) point 

Called when user has progressed along the route that was built in the method onRouteChanged

Parameters
distancedistance from the beginning or the route (unit meters)
pointcurrent location point on the route

Swift code snippet:

func onRouteAdvanced(_ distance: Float, point: NCLocationPoint) {
print("Route advanced: \‍(distance) meters")
demonstrateLocationPointUsage(point)
}

Objective C code snippet:

- (void)onRouteAdvanced:(float)distance point:(NCLocationPoint *)point {
NSLog(@"Route advanced: %f meters", distance);
[self demonstrateLocationPointUsage:point];
}

◆ onRouteChanged:currentPath:

- (void) onRouteChanged: (NCRouteStatus) status
currentPath: (nullable NCRoutePath *) currentPath 

Called when new route was built or old route was rebuilt after missing previouse one.

Parameters
statusRouteStatus indicating the current router state
currentPathRoutePath from current postion to destination point (null if status is not new_route)

Swift code snippet:

func onRouteChanged(_ status: NCRouteStatus, currentPath: NCRoutePath) {
print("Route changed with status: \‍(status)")
if status == .newRoute && currentPath != nil {
demonstrateRoutePathUsage(currentPath)
} else {
print("Route not ready, status: \‍(status)")
}
}

Objective C code snippet:

- (void)onRouteChanged:(NCRouteStatus)status currentPath:(NCRoutePath *)currentPath {
NSLog(@"Route changed with status: %@", @(status));
if (status == NCRouteStatusNewRoute && currentPath != nil) {
[self demonstrateRoutePathUsage:currentPath];
} else {
NSLog(@"Route not ready, status: %@", @(status));
}
}

The documentation for this protocol was generated from the following file: