1- import { mapPosVectorFromArgs } from '..' ;
1+ import { mapPosVectorFromArgs , nativeProperty } from '..' ;
22import { NativeVector } from '../core' ;
33import {
44 CartoOnlineRoutingServiceOptions ,
@@ -36,6 +36,7 @@ export enum RoutingAction {
3636 WAIT = NTRoutingAction . T_ROUTING_ACTION_WAIT ,
3737}
3838abstract class RoutingService < T extends NTRoutingService , U extends RoutingServiceOptions > extends BaseRoutingService < T , U > {
39+ @nativeProperty profile : string ;
3940 public calculateRoute ( options : RoutingRequest , callback : ( err : Error , res : RoutingResult ) => void ) {
4041 return new Promise ( ( resolve , reject ) => {
4142 const nRequest = NTRoutingRequest . alloc ( ) . initWithProjectionPoints ( options . projection . getNative ( ) , mapPosVectorFromArgs ( options . points ) ) ;
@@ -44,6 +45,9 @@ abstract class RoutingService<T extends NTRoutingService, U extends RoutingServi
4445 nRequest . setCustomParameterValue ( k , JSVariantToNative ( options . customOptions [ k ] ) ) ;
4546 } ) ;
4647 }
48+
49+ // ensure the profile is set
50+ this . getNative ( ) . setProfile ( this . profile ) ;
4751 const nRes = this . getNative ( ) . calculateRoute ( nRequest ) ;
4852 const result = nRes ? new RoutingResult ( nRes ) : null ;
4953 resolve ( result ) ;
@@ -110,7 +114,8 @@ class PackageManagerValhallaRoutingService extends RoutingService<NTPackageManag
110114 public matchRoute ( options : RouteMatchingRequest , callback : ( err : Error , res : RouteMatchingResult ) => void ) {
111115 return new Promise ( ( resolve , reject ) => {
112116 const nRequest = NTRouteMatchingRequest . alloc ( ) . initWithProjectionPointsAccuracy ( options . projection . getNative ( ) , mapPosVectorFromArgs ( options . points ) , options . accuracy ) ;
113-
117+ // ensure the profile is set
118+ this . getNative ( ) . setProfile ( this . profile ) ;
114119 const nRes = this . getNative ( ) . matchRoute ( nRequest ) ;
115120 const result = nRes ? new RouteMatchingResult ( nRes ) : null ;
116121 resolve ( result ) ;
0 commit comments