|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int[][] getData() { | 
|---|
|  |  |  | return getData(NavigationMapType.NONE.id, null);//默认读取无过滤的全部地图数据 | 
|---|
|  |  |  | return getData(NavigationMapType.NONE.id, null, null);//默认读取无过滤的全部地图数据 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int[][] getData(Integer mapType, List<int[]> whitePoints) { | 
|---|
|  |  |  | public int[][] getData(Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String mapFilename = "map_" + lev + ".json"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //解析json地图数据 | 
|---|
|  |  |  | ArrayList arrayList = JSON.parseObject(stringBuffer.toString(), ArrayList.class); | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints);//过滤地图数据 | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 | 
|---|
|  |  |  | int[][] map = new int[lists.size()][]; | 
|---|
|  |  |  | int j = 0; | 
|---|
|  |  |  | for (List<MapNode> list : lists) { | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 尝试从redis获取数据 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public int[][] getDataFromRedis(Integer mapType, List<int[]> whitePoints) { | 
|---|
|  |  |  | public int[][] getDataFromRedis(Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { | 
|---|
|  |  |  | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); | 
|---|
|  |  |  | Object o = redisUtil.get("realtimeBasMap_" + lev); | 
|---|
|  |  |  | if (o == null) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BasMap basMap = JSON.parseObject(o.toString(), BasMap.class); | 
|---|
|  |  |  | return this.getDataFormString(basMap.getData(), mapType, whitePoints); | 
|---|
|  |  |  | return this.getDataFormString(basMap.getData(), mapType, whitePoints, shuttlePoints); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 从List数据中获取地图 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public int[][] getDataFormString(String data, Integer mapType, List<int[]> whitePoints) { | 
|---|
|  |  |  | public int[][] getDataFormString(String data, Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { | 
|---|
|  |  |  | ArrayList arrayList = JSON.parseObject(data, ArrayList.class); | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints);//过滤地图数据 | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 | 
|---|
|  |  |  | int[][] map = new int[lists.size()][]; | 
|---|
|  |  |  | int j = 0; | 
|---|
|  |  |  | for (List<MapNode> list : lists) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //获取JSON格式数据 | 
|---|
|  |  |  | public List<List<MapNode>> getJsonData(Integer mapType, List<int[]> whitePoints) { | 
|---|
|  |  |  | public List<List<MapNode>> getJsonData(Integer mapType, List<int[]> whitePoints, List<int[]> shuttlePoints) { | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | String mapFilename = "map_" + lev + ".json"; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //解析json地图数据 | 
|---|
|  |  |  | ArrayList arrayList = JSON.parseObject(stringBuffer.toString(), ArrayList.class); | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints);//过滤地图数据 | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(mapType, arrayList, lev, whitePoints, shuttlePoints);//过滤地图数据 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return lists; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 过滤地图数据 | 
|---|
|  |  |  | * mapType -1=>无过滤,1=》过滤库位状态DFX,2=》过滤库位状态X | 
|---|
|  |  |  | * | 
|---|
|  |  |  | * @param whitePoints 白名单节点,不需要被过滤 | 
|---|
|  |  |  | * @param shuttlePoints 穿梭车节点,需要加载进地图 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<List<MapNode>> filterMap(Integer mapType, List arrayList, Integer lev, List<int[]> whitePoints) { | 
|---|
|  |  |  | public List<List<MapNode>> filterMap(Integer mapType, List arrayList, Integer lev, List<int[]> whitePoints, List<int[]> shuttlePoints) { | 
|---|
|  |  |  | List<List<MapNode>> lists = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //重建数据格式 | 
|---|
|  |  |  | 
|---|
|  |  |  | lists.set(row, list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //加载车辆坐标到地图中 | 
|---|
|  |  |  | if (shuttlePoints != null) { | 
|---|
|  |  |  | for (int[] points : shuttlePoints) { | 
|---|
|  |  |  | int x = points[0]; | 
|---|
|  |  |  | int y = points[1]; | 
|---|
|  |  |  | List<MapNode> list = lists.get(x); | 
|---|
|  |  |  | MapNode mapNode = list.get(y); | 
|---|
|  |  |  | mapNode.setValue(66);//设置为车辆代码66 | 
|---|
|  |  |  | //更新list | 
|---|
|  |  |  | list.set(y, mapNode); | 
|---|
|  |  |  | lists.set(x, list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return lists; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | BasMap basMap = JSON.parseObject(o.toString(), BasMap.class); | 
|---|
|  |  |  | ArrayList arrayList = JSON.parseObject(basMap.getData(), ArrayList.class); | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(NavigationMapType.NONE.id, arrayList, lev, null);//获取全部地图数据 | 
|---|
|  |  |  | List<List<MapNode>> lists = filterMap(NavigationMapType.NONE.id, arrayList, lev, null, null);//获取全部地图数据 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NavigateMapData mapData = new NavigateMapData(nodes.get(0).getZ()); | 
|---|
|  |  |  | List<List<MapNode>> realMap = mapData.getJsonData(-1, null, null);//获取完整地图(包括入库出库) | 
|---|
|  |  |  | for (NavigateNode node : nodes) { | 
|---|
|  |  |  | if (node.getZ() != lev) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | 
|---|
|  |  |  | if (lock) { | 
|---|
|  |  |  | mapNode.setValue(-999);//禁用库位 | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | if (node.getX() == 11 || node.getX() == 19) { | 
|---|
|  |  |  | mapNode.setValue(3);//恢复库位,母轨道 | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | mapNode.setValue(0);//恢复库位,普通库位 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //获取原始节点数据 | 
|---|
|  |  |  | List<MapNode> rows = realMap.get(node.getX()); | 
|---|
|  |  |  | MapNode col = rows.get(node.getY()); | 
|---|
|  |  |  | mapNode.setValue(col.getValue());//恢复库位 | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | listX.set(node.getY(), mapNode); | 
|---|