摩托车路径规划和导航功能,其中主要区别于驾车的部分,就是在摩托车的路径规划策略中,会将摩托车的车牌号、排量等信息加入到路径规划策略中进行计算。
摩托车的算路接口和驾车都是一样的,SDK是通过 bundle 参数中VEHICLE_TYPE来区别是否为摩托车的,IBNRoutePlanManager.Vehicle.MOTOR为摩托车。
示例代码:
// 摩托车信息BNMotorInfo motorInfo = new BNMotorInfo.Builder().plate("沪FTP939").plateType(VehicleConstant.PlateType.BLUE).motorType(VehicleConstant.MotorType.OIL).displacement("").build();// 该接口会做本地持久化,在应用中设置一次即可BaiduNaviManagerFactory.getCommonSettingManager().setMotorInfo(motorInfo);
Bundle bundle = new Bundle();bundle.putInt(BNaviCommonParams.RoutePlanKey.VEHICLE_TYPE, IBNRoutePlanManager.Vehicle.MOTOR);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);
算路回调和驾车一致,可参考驾车部分
上一篇
下一篇
本篇文章对您是否有帮助?