| | |
| | | package com.zy.common.utils; |
| | | |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.core.enums.ShuttleTaskModeType; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | */ |
| | | public class NavigateUtils { |
| | | |
| | | public static List<NavigateNode> calc(String startPoint, String endPoint, String mapType) { |
| | | public static List<NavigateNode> calc(String startPoint, String endPoint, Integer mapType) { |
| | | //通过开始编号和结束编号获取对应的xy轴坐标 |
| | | int[] startArr = NavigatePositionConvert.positionToXY(startPoint);//开始节点 |
| | | int[] endArr = NavigatePositionConvert.positionToXY(endPoint);//结束节点 |
| | |
| | | public static ArrayList<ArrayList<NavigateNode>> getSectionPath(List<NavigateNode> mapList) { |
| | | ArrayList<ArrayList<NavigateNode>> list = new ArrayList<>(); |
| | | ArrayList<NavigateNode> data = new ArrayList<>(); |
| | | String direction = mapList.get(0).getDirection();//行走方向 |
| | | for (NavigateNode mapNode : mapList) { |
| | | boolean isInflectionPoint = mapNode.getIsInflectionPoint(); |
| | | data.add(mapNode); |
| | |
| | | //拐点 |
| | | //分割数据 |
| | | list.add(data);//添加某一段数据 |
| | | direction = mapNode.getDirection();//更新行走方向 |
| | | data = new ArrayList<>(); |
| | | }else { |
| | | //直行线路 |
| | | mapNode.setDirection(direction);//设置行走方向 |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | public static void main(String[] args) { |
| | | //计算路径 |
| | | List<NavigateNode> calc = calc("1000901", "0201801", "out"); |
| | | List<NavigateNode> calc = calc("1000901", "0201801", ShuttleTaskModeType.PAK_OUT.id); |
| | | System.out.println(calc); |
| | | System.out.println("------------------------"); |
| | | // List<NavigateNode> calc = calc("0501401", "0201801", "out"); |