| | |
| | | start.setFather(null); |
| | | |
| | | NavigateNode end = new NavigateNode(endArr[0], endArr[1]); |
| | | NavigateSolution solution = new NavigateSolution(mapType); |
| | | NavigateSolution solution = new NavigateSolution(mapType, lev); |
| | | NavigateNode res_node = solution.astarSearch(start, end); |
| | | if (res_node == null) { |
| | | System.out.println("未找到路径"); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据原始节点结果,计算总行走距离 |
| | | */ |
| | | public static Integer getOriginPathAllDistance(List<NavigateNode> path) { |
| | | ArrayList<ArrayList<NavigateNode>> sectionPath = NavigateUtils.getSectionPath(path); |
| | | Integer allDistance = 0; |
| | | for (ArrayList<NavigateNode> navigateNodes : sectionPath) { |
| | | Integer distance = NavigateUtils.getCurrentPathAllDistance(navigateNodes); |
| | | allDistance += distance; |
| | | } |
| | | return allDistance; |
| | | } |
| | | |
| | | /** |
| | | * 获取当前路径总行走距离 |
| | | */ |
| | | public static Integer getCurrentPathAllDistance(List<NavigateNode> path) { |
| | |
| | | return allDistance; |
| | | } |
| | | |
| | | /** |
| | | * 获取中间点到目标点行走距离 |
| | | */ |
| | | public static Integer getMiddleToDistDistance(List<NavigateNode> path) { |
| | | //中间路径 |
| | | NavigateNode middlePath = path.get(path.size() - 2); |
| | | return middlePath.getMoveDistance(); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | //计算路径 |
| | | List<NavigateNode> calc = calc("1000901", "1800201", ShuttleTaskModeType.PAK_OUT.id); |