| | |
| | | return list; |
| | | } |
| | | |
| | | public static List<DirectionDto> initCodeDirections0() { |
| | | List<DirectionDto> list = new ArrayList<>(); |
| | | DirectionDto northDto = new DirectionDto(); |
| | | northDto.setAngle(CodeDirectionType.NORTH.angle); |
| | | northDto.setEnabled(true); |
| | | list.add(northDto); |
| | | |
| | | DirectionDto eastDto = new DirectionDto(); |
| | | eastDto.setAngle(CodeDirectionType.EAST.angle); |
| | | eastDto.setEnabled(false); |
| | | list.add(eastDto); |
| | | |
| | | DirectionDto southDto = new DirectionDto(); |
| | | southDto.setAngle(CodeDirectionType.SOUTH.angle); |
| | | southDto.setEnabled(true); |
| | | list.add(southDto); |
| | | |
| | | DirectionDto westDto = new DirectionDto(); |
| | | westDto.setAngle(CodeDirectionType.WEST.angle); |
| | | westDto.setEnabled(true); |
| | | list.add(westDto); |
| | | |
| | | return list; |
| | | } |
| | | |
| | | } |
| | |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | (double) MapService.calcSpinDirection(lastCode, lastDirection, nextLaneDir).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(nextLaneDir), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | (double) MapService.calcSpinDirection(lastCode, lastDirection, nextDirection).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(nextDirection), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | (double) MapService.calcSpinDirection(lastCode, lastDirection, nextDirection).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(nextDirection), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | (double) MapService.calcSpinDirection(lastCode, lastDirection, firstTurnDir).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(firstTurnDir), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | (double) MapService.calcSpinDirection(lastCode, lastDirection, oriStaWorkDirection).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(oriStaWorkDirection), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | (double) MapService.calcSpinDirection(lastCode, lastDirection, destStaWorkDirection).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(destStaWorkDirection), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | |
| | | null, // 动作号 |
| | | null, // 优先级 |
| | | ActionTypeType.TurnCorner.desc, // 名称 |
| | | (double) mapService.spinDirection(lastCode).val, // 属性值 |
| | | (double) MapService.calcSpinDirection(lastCode, lastDirection, chargeDirection).val, // 属性值 |
| | | lastCode.getData(), // 地面码 |
| | | String.valueOf(chargeDirection), // 动作参数 |
| | | ActionTypeType.TurnCorner.val(), // 动作类型 |
| | |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | CodeSpinType codeSpinType = calcSpinDirection(null, 260.0, 10.0); |
| | | List<DirectionDto> directionDtoList = DirectionDto.initCodeDirections(); |
| | | System.out.println(JSON.toJSONString(directionDtoList)); |
| | | System.out.println(codeSpinType.toString()); |
| | | } |
| | | |
| | | public CodeSpinType calcSpinDirection(Code code, Double currDir, Double nextDir) { |
| | | public static CodeSpinType calcSpinDirection(Code code, Double currDir, Double nextDir) { |
| | | if (Cools.isEmpty(code, currDir, nextDir)) { |
| | | return CodeSpinType.NA; |
| | | } |
| | | List<Double> disableAngleList = new ArrayList<>(); |
| | | List<DirectionDto> directionDtoList = DirectionDto.initCodeDirections(); |
| | | if (code.getData().contains("57")) { |
| | | directionDtoList = DirectionDto.initCodeDirections0(); |
| | | } |
| | | for (DirectionDto dto : directionDtoList) { |
| | | if (null != dto.getEnabled() && !dto.getEnabled()) { |
| | | disableAngleList.add(dto.getAngle()); |
| | |
| | | return CodeSpinType.NA; |
| | | } |
| | | |
| | | double cwDelta = cwDelta(curr, next); // (0, 360) |
| | | double ccwDelta = 360.0 - cwDelta; // (0, 360) |
| | | double cwDelta = cwDelta(curr, next); |
| | | double ccwDelta = 360.0 - cwDelta; |
| | | |
| | | boolean cwBlocked = false; |
| | | boolean ccwBlocked = false; |