此处的api是否允许在calculateRoute函数中启用流量

时间:2019-06-13 04:37:12

标签: android here-api

在calculateRoute函数中指定路由选项时,可以启用路况信息吗?我在应用程序中使用的是sdk

这是我的caclulateRoute函数

final RouteOptions routeOptions = new RouteOptions();                   
routeOptions.setTruckLength(25);                                        
routeOptions.setTruckHeight(5);                                         
routeOptions.setTruckWidth(2.5f);                                       
routeOptions.setTruckLimitedWeight(40);                                 
routeOptions.setTruckWeightPerAxle(10);                                 
routeOptions.setTruckTrailersCount(1);                                  

RoutePlan routePlan = new RoutePlan();                                  
routePlan.setRouteOptions(routeOptions);                                

for (GeoCoordinate coordinate : locations) {                            
    RouteWaypoint routeWaypoint = new RouteWaypoint(coordinate);        
    routePlan.addWaypoint(routeWaypoint);                               
}                                                                       

CoreRouter coreRouter = new CoreRouter();                               
coreRouter.setConnectivity(CoreRouter.Connectivity.DEFAULT);            
coreRouter.calculateRoute(routePlan,.......

我在问,有什么方法可以指定在计算路线时也要考虑交通信息。

1 个答案:

答案 0 :(得分:1)

假设您正在谈论Premium SDK(因为无论如何您都已经提到了Core路由器):

CoreRouter有一个方法:

setDynamicPenalty(动态惩罚)

https://developer.here.com/documentation/android-premium/api_reference_java/com/here/android/mpa/routing/DynamicPenalty.html

TrafficPenalty是一种“惩罚”模式:

setTrafficPenaltyMode(Route.TrafficPenaltyMode模式)

https://developer.here.com/documentation/android-premium/api_reference_java/com/here/android/mpa/routing/DynamicPenalty.html#setTrafficPenaltyMode-com.here.android.mpa.routing.Route.TrafficPenaltyMode-

您可能正在寻找将交通惩罚模式设置为OPTIMAL。