| | |
| | | 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; |
| | |
| | | |
| | | 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("地图未载入!"); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |