Loading...
Searching...
No Matches
NCRouteManager Class Reference

Class is used for evaluating RoutePath from point to point. More...

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

Inherits NSObject.

Instance Methods

(nullable NCRoutePath *) - makeRoute:to:
 Method is used to build a route between points about evaluated RoutePath from your position to target point.
 
(nonnull NSArray< NCRoutePath * > *) - makeRoutes:to:
 Method is used to build a route between the starting point and several destination points.
 
(void) - setTarget:
 Method is used to set target point in your location. Through RouteListener you will be notified about new paths to target point.
 
(void) - addTarget:
 Method is used to add target point in your location. Through RouteListener you will be notified about new paths to target point.
 
(void) - cancelTarget
 Method is used for removing current target points to where the routes were built.
 
(void) - clearTargets
 Method is used for removing all target points to where the routes were built.
 
(void) - setGraphTag:
 Method is used to select graph tag (Default: "default").
 
(nonnull NSString *) - getGraphTag
 Method is used to get current graph tag (Default: "default").
 
(nonnull NSArray< NSString * > *) - getGraphTags
 Method is used to get all graph tags,.
 
(void) - addRouteListener:
 Method is used to add RouteListener class element which will notify about evaluated route path from your position to target point.
 
(void) - removeRouteListener:
 Method is used for removing previously added RouteListener class element.
 

Detailed Description

Class is used for evaluating RoutePath from point to point.

Referenced from NavigineSdk.

Definition at line 20 of file NCRouteManager.h.

Method Documentation

◆ addRouteListener:

- (void) addRouteListener: (nullable id< NCRouteListener >) listener

Method is used to add RouteListener class element which will notify about evaluated route path from your position to target point.

Note
Do not forget to remove listener if it is no longer needed!
Parameters
listenerСorresponding RouteListener class.

Swift code snippet:

// Add route listener
manager.addRouteListener(self)

Objective C code snippet:

// Add route listener
[self.routeManager addRouteListener:self];

◆ addTarget:

- (void) addTarget: (nonnull NCLocationPoint *) target

Method is used to add target point in your location. Through RouteListener you will be notified about new paths to target point.

Parameters
targetfinish LocationPoint.

Swift code snippet:

// Add additional target point
let additionalTarget = NCLocationPoint(point: NCPoint(x: 90.0, y: 100.0), locationId: 12345, sublocationId: 1)
manager.addTarget(additionalTarget)

Objective C code snippet:

// Add additional target point
NCLocationPoint *additionalTarget = [[NCLocationPoint alloc] initWithPoint:[[NCPoint alloc] initWithX:90.0 y:100.0] locationId:12345 sublocationId:1];
[self.routeManager addTarget:additionalTarget];

◆ cancelTarget

- (void) cancelTarget

Method is used for removing current target points to where the routes were built.

Swift code snippet:

// Cancel current target
manager.cancelTarget()

Objective C code snippet:

// Cancel current target
[self.routeManager cancelTarget];

◆ clearTargets

- (void) clearTargets

Method is used for removing all target points to where the routes were built.

Swift code snippet:

// Clear all targets
manager.clearTargets()

Objective C code snippet:

// Clear all targets
[self.routeManager clearTargets];

◆ getGraphTag

- (nonnull NSString *) getGraphTag

Method is used to get current graph tag (Default: "default").

Swift code snippet:

// Get current graph tag
let currentGraphTag = manager.getGraphTag()
print("Current graph tag: \‍(currentGraphTag)")

Objective C code snippet:

// Get current graph tag
NSString *currentGraphTag = [self.routeManager getGraphTag];
NSLog(@"Current graph tag: %@", currentGraphTag);

◆ getGraphTags

- (nonnull NSArray< NSString * > *) getGraphTags

Method is used to get all graph tags,.

Swift code snippet:

// Get all graph tags
let graphTags = manager.getGraphTags()
print("Available graph tags: \‍(graphTags)")

Objective C code snippet:

// Get all graph tags
NSArray<NSString *> *graphTags = [self.routeManager getGraphTags];
NSLog(@"Available graph tags: %@", graphTags);

◆ makeRoute:to:

- (nullable NCRoutePath *) makeRoute: (nonnull NCLocationPoint *) from
to: (nonnull NCLocationPoint *) to 

Method is used to build a route between points about evaluated RoutePath from your position to target point.

Parameters
fromstarting LocationPoint.
todestination LocationPoint.
Returns
RoutePath from starting to destination point.

Swift code snippet:

// Make route from point to point
let routePath = manager.makeRoute(startLocationPoint, to: endLocationPoint)
print("Route created with length: \‍(routePath.getLength()) meters")

Objective C code snippet:

// Make route from point to point
NCRoutePath *routePath = [self.routeManager makeRoute:startLocationPoint to:endLocationPoint];
NSLog(@"Route created with length: %f meters", [routePath getLength]);

◆ makeRoutes:to:

- (nonnull NSArray< NCRoutePath * > *) makeRoutes: (nonnull NCLocationPoint *) from
to: (nonnull NSArray< NCLocationPoint * > *) to 

Method is used to build a route between the starting point and several destination points.

Parameters
fromstarting LocationPoint.
todestination list of LocationPoints.
Returns
vector of RoutePaths from starting to destination point.

Swift code snippet:

// Make routes to multiple destinations
let destinations = [
NCLocationPoint(point: NCPoint(x: 30.0, y: 40.0), locationId: 12345, sublocationId: 1),
NCLocationPoint(point: NCPoint(x: 70.0, y: 80.0), locationId: 12345, sublocationId: 1)
]
let routePaths = manager.makeRoutes(startLocationPoint, to: destinations)
print("Created \‍(routePaths.count) routes")

Objective C code snippet:

// Make routes to multiple destinations
NSArray<NCLocationPoint *> *destinations = @[
[[NCLocationPoint alloc] initWithPoint:[[NCPoint alloc] initWithX:30.0 y:40.0] locationId:12345 sublocationId:1],
[[NCLocationPoint alloc] initWithPoint:[[NCPoint alloc] initWithX:70.0 y:80.0] locationId:12345 sublocationId:1]
];
NSArray<NCRoutePath *> *routePaths = [self.routeManager makeRoutes:startLocationPoint to:destinations];
NSLog(@"Created %lu routes", (unsigned long)routePaths.count);

◆ removeRouteListener:

- (void) removeRouteListener: (nullable id< NCRouteListener >) listener

Method is used for removing previously added RouteListener class element.

Parameters
listenerСorresponding RouteListener class to remove.

Swift code snippet:

// Remove route listener
manager.removeRouteListener(self)

Objective C code snippet:

// Remove route listener
[self.routeManager removeRouteListener:self];

◆ setGraphTag:

- (void) setGraphTag: (nonnull NSString *) tag

Method is used to select graph tag (Default: "default").

Swift code snippet:

// Set graph tag
manager.setGraphTag("main")

Objective C code snippet:

// Set graph tag
[self.routeManager setGraphTag:@"main"];

◆ setTarget:

- (void) setTarget: (nonnull NCLocationPoint *) target

Method is used to set target point in your location. Through RouteListener you will be notified about new paths to target point.

Parameters
targetfinish LocationPoint.

Swift code snippet:

// Set target point
manager.setTarget(endLocationPoint)

Objective C code snippet:

// Set target point
[self.routeManager setTarget:endLocationPoint];

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