| | |
| | | |
| | | private final Map<String, List<String>> adjacencyCodeMap = new HashMap<>(); |
| | | |
| | | private final Map<String, List<int[]>> laneCodeIdxMap = new HashMap<>(); |
| | | |
| | | private boolean initialized = Boolean.FALSE; |
| | | |
| | | @Autowired |
| | |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private MapDataDispatcher mapDataDispatcher; |
| | | |
| | | // service ------------------------------------------------------- |
| | | |
| | | public Boolean isInitialized() { |
| | | return this.initialized; |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public List<int[]> getLaneCodeIdxList(String codeData) { |
| | | if (Cools.isEmpty(codeData)) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<int[]> list = this.laneCodeIdxMap.get(codeData); |
| | | if (null == list) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | // launcher ------------------------------------------------------- |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | |
| | | redis.setValue(RedisConstant.MAP_LANE_DATA, String.valueOf(lev), GsonUtils.toJson(this.lanes)); |
| | | } |
| | | |
| | | System.out.println(GsonUtils.toJson(this.lanes)); |
| | | this.generateLaneCodeIdx(null); |
| | | this.initialized = Boolean.TRUE; |
| | | // System.out.println(GsonUtils.toJson(this.lanes)); |
| | | } |
| | | |
| | | private void initLaneData() { |
| | |
| | | |
| | | this.generateLaneHash(); |
| | | |
| | | this.initialized = Boolean.TRUE; |
| | | log.info("the lane data initialization has been completed in rcs system."); |
| | | } |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | Code parentCode = codeService.selectByData(parent); |
| | | Code currentCode = codeService.selectByData(current); |
| | | Code neighborCode = codeService.selectByData(neighbor); |
| | | Code parentCode = codeService.getCacheByData(parent); |
| | | Code currentCode = codeService.getCacheByData(current); |
| | | Code neighborCode = codeService.getCacheByData(neighbor); |
| | | |
| | | double direction1 = this.calculateDirection(parentCode, currentCode); |
| | | double direction2 = this.calculateDirection(currentCode, neighborCode); |
| | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | public void generateLaneCodeIdx(Integer lev) { |
| | | log.info("There is initializing Lane CodeIdxMap......"); |
| | | long l = System.currentTimeMillis(); |
| | | if (Cools.isEmpty(this.lanes)) { |
| | | return; |
| | | } |
| | | for (Lane lane : this.lanes) { |
| | | List<int[]> codeIdxList = new ArrayList<>(); |
| | | for (String code : lane.getCodes()) { |
| | | int[] codeMatrixIdx = mapDataDispatcher.getCodeMatrixIdx(lev, code); |
| | | codeIdxList.add(codeMatrixIdx); |
| | | this.laneCodeIdxMap.put(code, codeIdxList); |
| | | } |
| | | } |
| | | } |
| | | } |