| | |
| | | package com.zy.common.utils; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.model.MapNode; |
| | | import com.zy.common.model.NavigateNode; |
| | | import com.zy.core.enums.ShuttleTaskModeType; |
| | | |
| | |
| | | //通过开始编号和结束编号获取对应的xy轴坐标 |
| | | int[] startArr = NavigatePositionConvert.positionToXY(startPoint);//开始节点 |
| | | int[] endArr = NavigatePositionConvert.positionToXY(endPoint);//结束节点 |
| | | |
| | | //获取当前节点计算的层高,并赋值到每一个节点中 |
| | | int lev = Utils.getLev(startPoint); |
| | | |
| | | //初始化开始节点 |
| | | NavigateNode start = new NavigateNode(startArr[0], startArr[1]); |
| | |
| | | while (res_node != null) { |
| | | res_node.setDirection(null); |
| | | res_node.setIsInflectionPoint(false); |
| | | res_node.setZ(lev);//设置层高 |
| | | |
| | | //寻找拐点 |
| | | HashMap<String, Object> result = searchInflectionPoint(res_node, fatherNode, res_node.getFather());//分别传入当前节点、父节点、下一节点 |
| | |
| | | //获取从x点到下一点的行走距离 |
| | | public static Integer getXToNextDistance(NavigateNode xNode) { |
| | | NavigateMapData mapData = new NavigateMapData(); |
| | | ArrayList<ArrayList<JSONObject>> lists = mapData.getJsonData(1); |
| | | List<List<MapNode>> lists = mapData.getJsonData(1); |
| | | if (lists != null) { |
| | | JSONObject jsonObject = lists.get(xNode.getX()).get(xNode.getY()); |
| | | if (jsonObject != null) { |
| | | return Integer.parseInt(jsonObject.getOrDefault(xNode.getDirection(), 0).toString()); |
| | | MapNode mapNode = lists.get(xNode.getX()).get(xNode.getY()); |
| | | if (mapNode != null) { |
| | | switch (xNode.getDirection()) { |
| | | case "top": |
| | | return mapNode.getTop(); |
| | | case "bottom": |
| | | return mapNode.getBottom(); |
| | | case "left": |
| | | return mapNode.getLeft(); |
| | | case "right": |
| | | return mapNode.getRight(); |
| | | } |
| | | } |
| | | return 0; |
| | | } |