|  |  |  | 
|---|
|  |  |  | import com.zy.acs.common.utils.RedisSupport; | 
|---|
|  |  |  | import com.zy.acs.framework.common.Cools; | 
|---|
|  |  |  | import com.zy.acs.framework.exception.CoolException; | 
|---|
|  |  |  | import com.zy.acs.manager.common.utils.MapDataUtils; | 
|---|
|  |  |  | import com.zy.acs.manager.core.service.astart.domain.DynamicNode; | 
|---|
|  |  |  | import com.zy.acs.manager.core.utils.RouteGenerator; | 
|---|
|  |  |  | import com.zy.acs.manager.manager.entity.Code; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private int[][] turnMatrix; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private String[][] cdaMatrix; | 
|---|
|  |  |  | private Double[][][] cdaMatrix; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public Map<String, Boolean> routeCdaMap = new HashMap<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | redis.setValue(RedisConstant.AGV_MAP_ASTAR_DYNAMIC_FLAG, String.valueOf(lev), JSON.toJSONString(dynamicMatrix)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public String[][] getCdaMatrix(Integer lev) { | 
|---|
|  |  |  | public Double[][][] getCdaMatrix(Integer lev) { | 
|---|
|  |  |  | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); | 
|---|
|  |  |  | // redis | 
|---|
|  |  |  | if (null == this.cdaMatrix) { | 
|---|
|  |  |  | String cdaMatrixStr = redis.getValue(RedisConstant.AGV_MAP_ASTAR_CDA_FLAG, String.valueOf(lev)); | 
|---|
|  |  |  | if (!Cools.isEmpty(cdaMatrixStr)) { | 
|---|
|  |  |  | this.cdaMatrix = JSON.parseObject(cdaMatrixStr, String[][].class); | 
|---|
|  |  |  | String[][] cdaStrMatrix = JSON.parseObject(cdaMatrixStr, String[][].class); | 
|---|
|  |  |  | this.cdaMatrix = MapDataUtils.preComputeCdaMatrix(cdaStrMatrix); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | // init | 
|---|
|  |  |  | 
|---|
|  |  |  | return this.cdaMatrix; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setCdaMatrix(Integer lev, String[][] cdaMatrix) { | 
|---|
|  |  |  | redis.setValue(RedisConstant.AGV_MAP_ASTAR_CDA_FLAG, String.valueOf(lev), JSON.toJSONString(cdaMatrix)); | 
|---|
|  |  |  | this.cdaMatrix = cdaMatrix; | 
|---|
|  |  |  | public void setCdaMatrix(Integer lev, String[][] cdaStrMatrix) { | 
|---|
|  |  |  | redis.setValue(RedisConstant.AGV_MAP_ASTAR_CDA_FLAG, String.valueOf(lev), JSON.toJSONString(cdaStrMatrix)); | 
|---|
|  |  |  | this.cdaMatrix = MapDataUtils.preComputeCdaMatrix(cdaStrMatrix); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public int[][] getTurnMatrix(Integer lev) { | 
|---|
|  |  |  | 
|---|
|  |  |  | lev = Optional.ofNullable(lev).orElse(MAP_DEFAULT_LEV); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String[][] codeMatrix = getCodeMatrix(lev); | 
|---|
|  |  |  | if (null == codeMatrix || codeMatrix.length == 0) { | 
|---|
|  |  |  | return new DynamicNode[0][0]; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | DynamicNode[][] dynamicMatrix = new DynamicNode[codeMatrix.length][codeMatrix[0].length]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (int i = 0; i < codeMatrix.length; i++) { | 
|---|