From 050c08a54be8641b39cfdaacd06c609cc55ee308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Thu, 9 Sep 2021 20:11:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A2=84=E8=AD=A6=E6=B0=94?= =?UTF-8?q?=E6=B3=A1=E6=B6=88=E5=A4=B1=E5=90=8E=E5=89=8D=E8=BD=A6=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E6=B6=88=E5=A4=B1=EF=BC=9B=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=89=8D=E8=BD=A6=E7=A2=B0=E6=92=9E=E9=A2=84=E8=AD=A6=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E5=8F=98=E6=8D=A2=E5=BB=B6=E8=BF=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/obu/mogo/MogoPrivateObuManager.kt | 42 +++++++++++++++---- .../obu/mogo/utils/TrafficDataConvertUtils.kt | 12 +++--- 2 files changed, 38 insertions(+), 16 deletions(-) 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 5d3d914749..762c4c5804 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 @@ -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, 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 -> { 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 }