diff --git a/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt b/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt index 9522dd12a0..3aa429fb26 100644 --- a/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt +++ b/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/MogoPrivateObuManager.kt @@ -261,11 +261,19 @@ class MogoPrivateObuManager private constructor() { ObuConstants.STATUS.DELETE -> { // 移除顶部弹窗 mIMoGoWaringProvider?.disableWarningV2X(appId) - TrafficMarkerDrawer.removeCvxRvInfoIndInfo(info.rti_id) + // 更新数据 + TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { + // 事件结束,还原车辆颜色 + it.threatLevel = 0x01 + TrafficMarkerDrawer.updateITrafficInfo(it) + } } // 更新 else -> { - + // 更新数据 + TrafficDataConvertUtils.cvxRtiThreatIndInfo2TrafficData(info)?.let { + TrafficMarkerDrawer.updateITrafficInfo(it) + } } } } @@ -302,7 +310,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 -> { @@ -334,7 +345,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()) } // 更新 @@ -442,8 +458,10 @@ class MogoPrivateObuManager private constructor() { * 处理红绿灯 */ private fun handlerTrafficLight(appId: Int, status: Int, lights: List, 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 -> { @@ -672,8 +690,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 -> { diff --git a/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/utils/TrafficDataConvertUtils.kt b/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/utils/TrafficDataConvertUtils.kt index c7058643da..fa61a8a6cb 100644 --- a/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/utils/TrafficDataConvertUtils.kt +++ b/modules/mogo-module-obu-mogo/src/main/java/com/mogo/module/obu/mogo/utils/TrafficDataConvertUtils.kt @@ -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 }