济菏高速数据中心代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

60 lines
1.5 KiB

package com.zc.business.enums;
/**
* 摄像头方向
*/
public enum CameraDirectionEnum {
/**
* 摄像头上行
*/
UPWARD(0, "上行"),
/**
* 摄像头下行
*/
DOWN(1, "下行"),
/**
* 摄像头上下行(双向)
*/
BIDIRECTIONAL(2, "上下行(双向)");
private final int code;
private final String description;
CameraDirectionEnum(int code, String description) {
this.code = code;
this.description = description;
}
public int getCode() {
return code;
}
public String getDescription() {
return description;
}
// 可选:根据code获取枚举值
public static CameraDirectionEnum fromCode(int code) {
for (CameraDirectionEnum direction : values()) {
if (direction.getCode() == code) {
return direction;
}
}
throw new IllegalArgumentException("无效的摄像机方向码: " + code);
}
public LaneDirectionEnum toLaneDirection() {
switch (this) {
case UPWARD:
return LaneDirectionEnum.UPWARD;
case DOWN:
return LaneDirectionEnum.DOWNWARD;
case BIDIRECTIONAL:
// 假设摄像机双向就映射为车道双向
return LaneDirectionEnum.BIDIRECTIONAL;
default:
throw new IllegalStateException("未知的CameraDirection: " + this);
}
}
}