From a5fd6b72f8342f0228321849b04c822feba2d2a0 Mon Sep 17 00:00:00 2001 From: taisheng <taisheng@qq.com> Date: 星期三, 02 七月 2025 09:42:42 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/shuttle_rcs' into shuttle_rcs --- src/main/java/com/zy/common/utils/NavigateUtils.java | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 49 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/zy/common/utils/NavigateUtils.java b/src/main/java/com/zy/common/utils/NavigateUtils.java index bf19aa9..4074614 100644 --- a/src/main/java/com/zy/common/utils/NavigateUtils.java +++ b/src/main/java/com/zy/common/utils/NavigateUtils.java @@ -3,6 +3,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.core.common.SpringUtils; +import com.core.exception.CoolException; import com.zy.asrs.utils.Utils; import com.zy.common.model.MapNode; import com.zy.common.model.NavigateNode; @@ -187,6 +188,54 @@ return list; } + //璁$畻甯︽湯绔钀借矾寰� + public ArrayList<ArrayList<NavigateNode>> calcEndPath(String startPoint, String endPoint, Integer mapType, List<int[]> shuttlePoints, List<int[]> whites, int lastPathPart) { + //璁$畻璺緞 + List<NavigateNode> navigateNodes = calc(startPoint, endPoint, mapType, shuttlePoints, whites); + if (navigateNodes == null) { + News.error("{} dash {} can't find navigate path!", startPoint, endPoint); + return null; + } + + //鑾峰彇鍒嗘璺緞 + ArrayList<ArrayList<NavigateNode>> partList = this.getSectionPath(navigateNodes); + //鏍规嵁浼犲叆鐨勬湯绔钀借矾寰勶紝鎵惧埌鏈鐐逛綅 + int partResult = partList.size() - lastPathPart; + if (partResult == 0) {//璺緞鏁伴噺鐩稿悓鏃犻渶鍒嗗壊 + return partList; + } else if (partResult < 0) { + throw new CoolException("鍒嗘璺緞涓庢湯绔矾寰勬暟閲忚绠楀紓甯�"); + } + int pathIdx = partResult - 1; + ArrayList<ArrayList<NavigateNode>> filterList = new ArrayList<>(); + for (int i = 0; i <= pathIdx; i++) { + filterList.add(partList.get(i)); + } + return filterList; + } + + //璁$畻鏈娈佃惤鍦板潃 + public String calcEndLocation(String startPoint, String endPoint, Integer mapType, List<int[]> shuttlePoints, List<int[]> whites, int lastPathPart) { + ArrayList<ArrayList<NavigateNode>> endPath = calcEndPath(startPoint, endPoint, mapType, shuttlePoints, whites, lastPathPart); + if (endPath == null) { + return null; + } + + return findTargetLocation(endPath); + } + + public String findTargetLocation(List<NavigateNode> nodeList) { + ArrayList<ArrayList<NavigateNode>> sectionPath = this.getSectionPath(nodeList); + return findTargetLocation(sectionPath); + } + + public String findTargetLocation(ArrayList<ArrayList<NavigateNode>> partList) { + ArrayList<NavigateNode> nodes = partList.get(partList.size() - 1); + NavigateNode targetNode = nodes.get(nodes.size() - 1); + String locNo = NavigatePositionConvert.nodeToLocNo(targetNode); + return locNo; + } + //鍒ゆ柇褰撳墠鑺傜偣鍒颁笅涓�涓妭鐐规槸鍚︿负鎷愮偣 public HashMap<String,Object> searchInflectionPoint(NavigateNode currentNode, NavigateNode fatherNode, NavigateNode nextNode) { HashMap<String, Object> map = new HashMap<>(); -- Gitblit v1.9.1