驾车路径规划示例
###1:配置搭建AndroidSDK工程###
- overlay效果展示
- 列表效果展示
类 | 接口 | 说明 | 版本 |
---|---|---|---|
RouteSearch | calculateDriveRouteAsyn() | 根据指定的参数计算驾车路径、异步方法 | V2.1.0 |
RouteSearch | onDriveRouteSearched() | 驾车路径规划结果的回调方法 | V2.1.0 |
- 构造路径规划类
mRouteSearch = new RouteSearch(this);
mRouteSearch.setRouteSearchListener(this);
-发起路径规划异步请求
mRouteSearch.calculateDriveRouteAsyn(query)
- 将驾车路径规划结果用overlay在地图展现
DrivingRouteOverlay drivingRouteOverlay = new DrivingRouteOverlay(
mContext, aMap, drivePath,
mDriveRouteResult.getStartPos(),
mDriveRouteResult.getTargetPos(), null);
drivingRouteOverlay.setNodeIconVisibility(false);//设置节点marker是否显示
drivingRouteOverlay.setIsColorfulline(true);//是否用颜色展示交通拥堵情况,默认true
drivingRouteOverlay.removeFromMap();
drivingRouteOverlay.addToMap();
drivingRouteOverlay.zoomToSpan();