KNTrip
INFO
This English reference is based on Directions SDK 1.12.12. For the latest version, see the Korean reference.
- Inherits from: NSObject
- Protocol recruitment: KNTrip_GuidanceExtension
- Declared in: KNTrip.h
A class that manages routes. It takes the location information of the origin, destination, and waypoints as input and provides routes by option. You can also check information such as distance, fee, and time for the selected route.
TIP
The
KNTripclass must be generated throughKNSDK.It interacts with
KNGuidanceto run the route guide and manage the traffic information.
Example code — KNSafetyZone
objc
- (KNTrip *)makeTripWithStart:(KNPOI *)aStart goal:(KNPOI *)aGoal vias:(NSArray<KNPOI *> * _Nullable)aViasProperties
| Name | Description | Type |
|---|---|---|
start | Origin location information | @property (nonatomic, readonly) KNPOI *start |
goal | Destination location information | @property (nonatomic, readonly) KNPOI *goal |
vias | List of waypoint location information | @property (nonatomic, readonly) NSArray<KNPOI*> *vias |
routeConfig | Route configuration information | @property (nonatomic, strong) KNRouteConfiguration *routeConfig |
useMultiRoute | Whether multiple routes are enabledYES: Uses multiple routesNO: Does not use multiple routes(default: YES) | @property (nonatomic, assign) BOOL useMultiRoute |
Methods
addVia:atLocation
Adds a waypoint.
objc
- (void) addVia: (KNPOI *) aVia
atLocation: (KNLocation *) aLocationParameters
| Name | Description |
|---|---|
aVia | Waypoint location information (POI) |
aLocation | Location at which to add the waypoint |
addVia:atIndex
Adds a waypoint.
objc
- (void) addVia: (KNPOI *) aVia
atIndex: (NSInteger) aIdxParameters
| Name | Description |
|---|---|
aVia | List of waypoint location information |
aIdx | Waypoint order (index). The order is assigned according to the visiting order of the waypoints; a lower index is the waypoint visited first. If the index is larger than the number of registered waypoints, it is treated as the last waypoint. |
removeAllVias
Removes all waypoints.
objc
- (void) removeAllViasremoveViaAtIdx
Removes a specific waypoint.
objc
- (void) removeViaAtIdx: (NSInteger) aIdxParameters
| Name | Description |
|---|---|
aIdx | Waypoint order (index). The order is assigned according to the visiting order of the waypoints; a lower index is the waypoint visited first. If the index is larger than the number of registered waypoints, it is treated as the last waypoint. |
routeWithPriority:avoidOptions:completion
Requests a route. The requested route is delivered asynchronously.
objc
- (void) routeWithPriority: (KNRoutePriority) aPriority
avoidOptions: (SInt32) aAvoidOptions
completion: (void ( ^ ) ( KNError *_Nullable aError NSArray <KNRoute*> *_Nullable aRoutes )) aCompletionParameters
| Name | Description |
|---|---|
aPriority | Item to prioritize during route guidance |
aAvoidOptions | Sections to exclude from the route. Up to two routes can be entered. The main route and the alternative route are entered in order, and the alternative route can be omitted. |
aCompletion | Delivers the requested route |
setVias
Sets waypoints in bulk.
objc
- (void) setVias: (NSArray<KNPOI*> *) aViasParameters
| Name | Description |
|---|---|
aVias | List of waypoint location information |