修复预警气泡消失后前车模型消失;

修复前车碰撞预警颜色变换延迟
This commit is contained in:
董宏宇
2021-09-09 20:11:44 +08:00
parent ef1b7f3b93
commit 050c08a54b
2 changed files with 38 additions and 16 deletions

View File

@@ -169,7 +169,10 @@ class MogoPrivateObuManager private constructor() {
when (appId) {
// 道路危险情况预警
WarningTypeEnum.TYPE_USECASE_ID_HLW.useCaseId -> {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type}")
Logger.d(
MogoObuConst.TAG_MOGO_OBU,
"onCvxRtiThreatIndInfo appId = $appId --status = $status --level = $level -- handleDirection = $direction --rtiType = ${info.ext_info.rti_type}"
)
when (info.ext_info.rti_type) {
//急转弯
0x2 -> {
@@ -262,11 +265,19 @@ class MogoPrivateObuManager private constructor() {
ObuConstants.STATUS.DELETE -> {
// 移除顶部弹窗
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.rti_id)
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
// 事件结束,还原车辆颜色
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficInfo(it)
}
}
// 更新
else -> {
// 更新数据
TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let {
TrafficMarkerDrawer.updateITrafficInfo(it)
}
}
}
}
@@ -303,7 +314,10 @@ class MogoPrivateObuManager private constructor() {
override fun onCvxPtcThreatIndInfo(info: CvxPtcThreatIndInfo?) {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ------> $info")
info?.let {
Logger.d(MogoObuConst.TAG_MOGO_OBU, "onCvxPtcInfoIndInfo ---status---> ${info.status}")
Logger.d(
MogoObuConst.TAG_MOGO_OBU,
"onCvxPtcInfoIndInfo ---status---> ${info.status}"
)
when (info.status) {
// 添加
ObuConstants.STATUS.ADD -> {
@@ -335,7 +349,12 @@ class MogoPrivateObuManager private constructor() {
}
// 删除
ObuConstants.STATUS.DELETE -> {
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.ptc_id)
// 更新数据
TrafficDataConvertUtils.cvxPtcThreatIndInfo2TrafficData(info)?.let {
// 事件结束,还原交通参与者颜色
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficInfo(it)
}
mIMoGoWaringProvider?.disableWarningV2X(ObuConstants.USE_CASE_ID.VRUCW.toString())
}
// 更新
@@ -443,8 +462,10 @@ class MogoPrivateObuManager private constructor() {
* 处理红绿灯
*/
private fun handlerTrafficLight(appId: Int, status: Int, lights: List<Light>, indicator: Int) {
Logger.d(MogoObuConst.TAG_MOGO_OBU,
"handlerTrafficLight appId = $appId --- status = $status ---indicator = $indicator ")
Logger.d(
MogoObuConst.TAG_MOGO_OBU,
"handlerTrafficLight appId = $appId --- status = $status ---indicator = $indicator "
)
when (status) {
// 添加
ObuConstants.STATUS.ADD -> {
@@ -673,8 +694,11 @@ class MogoPrivateObuManager private constructor() {
isStrikeTts = false
// 移除顶部弹窗
mIMoGoWaringProvider?.disableWarningV2X(appId.toString())
// 移除地图元素
TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.vehicle_id)
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
TrafficDataConvertUtils.cvxV2vThreatIndInfo2TrafficData(info)?.let {
it.threatLevel = 0x01
TrafficMarkerDrawer.updateITrafficInfo(it)
}
}
// 更新
else -> {

View File

@@ -32,11 +32,6 @@ object TrafficDataConvertUtils {
trafficData.heading = info.basic_info.heading
trafficData.speed = info.basic_info.speed
// 判断车辆V2X预警级别调整车辆颜色
if (!info.threat_infos.isNullOrEmpty()) {
trafficData.threatLevel = info.threat_infos.first().threat_level
}
return trafficData
}
@@ -45,9 +40,10 @@ object TrafficDataConvertUtils {
*/
fun cvxRtiThreatIndInfo2TrafficData(info: CvxRtiThreatIndInfo): TrafficData? {
// 这里只处理道路施工
if (info.rti_id == null || info.ext_info == null || info.ext_info.rti_type != 0x7 ||
info.zones_info == null || info.zones_info.first() == null
if (info.rti_id == null || info.ext_info == null || info.ext_info.rti_type != 0x7
|| info.zones_info == null || info.zones_info.first() == null
|| info.zones_info.first().path_points.first() == null
|| info.threat_info == null
) {
Logger.e(TAG, "数据转换异常,请检查参数是否齐全")
return null
@@ -59,6 +55,8 @@ object TrafficDataConvertUtils {
trafficData.lat = info.zones_info.first().path_points.first().latitude
trafficData.lon = info.zones_info.first().path_points.first().longitude
trafficData.threatLevel = info.threat_info.threat_level
return trafficData
}