From 73ce8bebcc5d14f3fb62a19ee677abfcdfc776b4 Mon Sep 17 00:00:00 2001 From: Junjie <540245094@qq.com> Date: 星期六, 19 七月 2025 16:17:51 +0800 Subject: [PATCH] # --- src/main/java/com/zy/common/utils/NavigateSolution.java | 19 ++++++++++++++----- 1 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/zy/common/utils/NavigateSolution.java b/src/main/java/com/zy/common/utils/NavigateSolution.java index 0c632b9..3fc56ed 100644 --- a/src/main/java/com/zy/common/utils/NavigateSolution.java +++ b/src/main/java/com/zy/common/utils/NavigateSolution.java @@ -5,6 +5,7 @@ import com.core.common.SpringUtils; import com.core.exception.CoolException; import com.zy.common.model.NavigateNode; +import com.zy.common.model.enums.NavigationMapType; import com.zy.core.enums.MapNodeType; import com.zy.core.model.PythonResult; import com.zy.system.entity.Config; @@ -25,10 +26,10 @@ int[][] map = {{}}; - public NavigateSolution(Integer mapType, Integer lev, List<int[]> whitePoints, List<int[]> shuttlePoints) { + public NavigateSolution(List<NavigationMapType> mapTypes, Integer lev, List<int[]> whitePoints, List<int[]> shuttlePoints) { //杞藉叆鍦板浘鎸囧畾灞傞珮鍦板浘 NavigateMapData mapData = SpringUtils.getBean(NavigateMapData.class); - int[][] data = mapData.getDataFromRedis(lev, mapType, whitePoints, shuttlePoints); + int[][] data = mapData.getDataFromRedis(lev, mapTypes, whitePoints, shuttlePoints); if (data == null) { throw new CoolException("鍦板浘鏈浇鍏ワ紒"); } @@ -149,7 +150,7 @@ ConfigService configService = SpringUtils.getBean(ConfigService.class); if (configService != null) { Config config = configService.selectOne(new EntityWrapper<Config>() - .eq("config", "direction_map") + .eq("code", "direction_map") .eq("status", 1)); if (config != null) { mapDirection = config.getValue(); @@ -195,11 +196,13 @@ if (is_valid(x + 1, y)) { NavigateNode node = new NavigateNode(x + 1, y); + node.setNodeValue(map[x + 1][y]); neighbour_node.add(node); } if (is_valid(x - 1, y)) { - NavigateNode node = new NavigateNode(x -1, y); + NavigateNode node = new NavigateNode(x - 1, y); + node.setNodeValue(map[x - 1][y]); neighbour_node.add(node); } } @@ -209,11 +212,13 @@ if (is_valid(x, y + 1)) { NavigateNode node = new NavigateNode(x, y + 1); + node.setNodeValue(map[x][y + 1]); neighbour_node.add(node); } if (is_valid(x, y - 1)) { NavigateNode node = new NavigateNode(x, y - 1); + node.setNodeValue(map[x][y - 1]); neighbour_node.add(node); } } @@ -223,11 +228,13 @@ if (is_valid(x, y + 1)) { NavigateNode node = new NavigateNode(x, y + 1); + node.setNodeValue(map[x][y + 1]); neighbour_node.add(node); } if (is_valid(x, y - 1)) { NavigateNode node = new NavigateNode(x, y - 1); + node.setNodeValue(map[x][y - 1]); neighbour_node.add(node); } } @@ -237,11 +244,13 @@ if (is_valid(x + 1, y)) { NavigateNode node = new NavigateNode(x + 1, y); + node.setNodeValue(map[x + 1][y]); neighbour_node.add(node); } if (is_valid(x - 1, y)) { - NavigateNode node = new NavigateNode(x -1, y); + NavigateNode node = new NavigateNode(x - 1, y); + node.setNodeValue(map[x - 1][y]); neighbour_node.add(node); } } -- Gitblit v1.9.1