| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public RouteVo getDistanceAndTime(LonLatDto start, LonLatDto end,List<String> avoidRoads,String fenceId,Integer routePlanRule, List<HistoryPointDto> history) { |
| | | public RouteVo getDistanceAndTime(LonLatDto start, LonLatDto end,ArrayList<JSONObject> avoidRoads,String fenceId,Integer routePlanRule, List<HistoryPointDto> history) { |
| | | RouteVo routeVo = new RouteVo(); |
| | | |
| | | String url = "https://tsapi.amap.com/v1/route/price?key=" + key + "&extensions=all&start=" + start.getLongitude() + "," + start.getLatitude(); |
| | |
| | | params.put("end", end.getLongitude() + "," + end.getLatitude()); |
| | | params.put("routeUserType", 2); |
| | | if (avoidRoads != null && !avoidRoads.isEmpty()) { |
| | | JSONArray avoidPolygons = new JSONArray(); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("coordinates", avoidRoads); |
| | | avoidPolygons.add(jsonObject); |
| | | params.put("avoidPolygons", avoidPolygons); |
| | | params.put("avoidPolygons", avoidRoads); |
| | | } |
| | | if (routePlanRule != null) { |
| | | params.put("strategy", routePlanRule); |