货车的算路接口和驾车都是一样的,SDK是通车辆类型来区别是否为货车的。在货车的路径规划策略中,会将货车特有的限高、限重、车型等信息加入到路径规划策略中进行计算。
// 货车信息BNTruckInfo truckInfo = new BNTruckInfo.Builder().plate("京A88888") // 车牌号.axlesNumber(2) // 轴数.axlesWeight(1000) // 轴重 0~100吨 单位kg.emissionLimit(VehicleConstant.EmissionStandard.S3) // 排放标准.length(5000) // 车长 0~25米 单位mm.weight(2000) // 车重 0~100吨 单位kg.loadWeight(1000) // 核定载重 0~100吨 单位kg.oilCost("40000") // 油耗(计算省钱路线) 0~150L.plateType(VehicleConstant.PlateType.BLUE) // 车牌颜色.powerType(VehicleConstant.PowerType.OIL) // 动力类型.truckType(VehicleConstant.TruckType.HEAVY) // 货车类型.height(2000) // 车高 0~10米 单位mm.width(2500) // 车宽 0~5米 单位mm.build();// 该接口会做本地持久化,在应用中设置一次即可BaiduNaviManagerFactory.getCommonSettingManager().setTruckInfo(truckInfo);
Bundle bundle = new Bundle();// 算路车辆类型bundle.putInt(BNaviCommonParams.RoutePlanKey.VEHICLE_TYPE,IBNRoutePlanManager.Vehicle.TRUCK);List<BNRoutePlanNode> list = new ArrayList<>();BNRoutePlanNode startNode = new BNRoutePlanNode.Builder().longitude(116.397609).latitude(39.908560).build()BNRoutePlanNode endNode = new BNRoutePlanNode.Builder().longitude(116.306333).latitude(40.041690).build()list.add(startNode);list.add(endNode);BaiduNaviManagerFactory.getRoutePlanManager().routePlan(list,IBNRoutePlanManager.RoutePlanPreference.ROUTE_PLAN_PREFERENCE_DEFAULT,bundle, handler);
通过bundle中传入经验路线标识进行算路
Bundle bundle = new Bundle();// 算路车辆类型bundle.putInt(BNaviCommonParams.RoutePlanKey.VEHICLE_TYPE,IBNRoutePlanManager.Vehicle.TRUCK);// 经验路线标示bundle.putString(BNaviCommonParams.RoutePlanKey.ASSIGN_ROUTE, "");......BaiduNaviManagerFactory.getRoutePlanManager().routePlan(list,IBNRoutePlanManager.RoutePlanPreference.ROUTE_PLAN_PREFERENCE_DEFAULT,bundle, handler);
通过bundle中传入轨迹的类型和ID进行算路
Bundle bundle = new Bundle();// 算路车辆类型bundle.putInt(BNaviCommonParams.RoutePlanKey.VEHICLE_TYPE,IBNRoutePlanManager.Vehicle.TRUCK);// 轨迹还原路线标示bundle.putInt(BNaviCommonParams.RoutePlanKey.EXTRA_KEY_TRAJECTORY_RESTORE_TYPE, 0);bundle.putString(BNaviCommonParams.RoutePlanKey.EXTRA_KEY_TRAJECTORY_RESTORE_ID, "");......BaiduNaviManagerFactory.getRoutePlanManager().routePlan(list,IBNRoutePlanManager.RoutePlanPreference.ROUTE_PLAN_PREFERENCE_DEFAULT,bundle, handler);
/*** 偏航时路线模式* 0 默认策略 1 偏航路线api提供 2 偏航回进入导航时选的路线*/void setYawingUseUserData(int yawMode);
BaiduNaviManagerFactory.getRouteGuideManager().setNaviListener(new IBNaviListener() {@Overridepublic void onStartYawing(String flag) {// 请求自己服务的路线ID时需要将flag字段一起带上,该flag最终会通过自己的服务传到导航服务,作用是校验路线。}})
上一篇
下一篇
本篇文章对您是否有帮助?