[6.10.0][Fix]过滤重复的车龙事件

This commit is contained in:
chenfufeng
2025-02-20 11:59:49 +08:00
parent d5bad20286
commit c2dca3c81d
2 changed files with 32 additions and 5 deletions

View File

@@ -61,6 +61,7 @@ import mogo.telematics.pad.MessagePad.TrackedObject
import mogo.telematics.pad.MessagePad.V2nCrossSpeed
import mogo.v2x.MogoV2X
import mogo.v2x.MogoV2X.RSI_PB
import java.util.HashMap
import kotlin.math.abs
/**
@@ -129,7 +130,8 @@ internal object V2NIdentifyDrawer : IEventDismissListener {
val polygon =
itx.polygonList.map { Pair.create(it.longitude, it.latitude) }
marker(
Marker(id,
Marker(
id,
poiType,
itx.longitude,
itx.latitude,
@@ -617,6 +619,7 @@ internal object V2NIdentifyDrawer : IEventDismissListener {
Handler(thread.looper, callback)
}
private var lastMap = HashMap<Int, Int>()
private val listener = object : IMoGoAutopilotIdentifyListener {
override fun onAutopilotIdentifyDataUpdate(trafficData: List<TrackedObject>?) {
@@ -635,9 +638,18 @@ internal object V2NIdentifyDrawer : IEventDismissListener {
var hasCheLong = false
val roadMsgList = ArrayList<NDEMsg.RoadMsg>()
trafficData?.forEach { obj ->
if (obj.type == 707) {
if (obj.polygonCount > 1) {
hasCheLong = true
if (obj.type == 707 && obj.polygonCount > 1) {// 当次数据有车龙事件
synchronized(this) {
val isSameSize = (lastMap.isNotEmpty() && lastMap.size == trafficData.size)// 判断是否是重复数据
// 个数不一样或前后两次uuid不同
if (!isSameSize || lastMap[obj.uuid] == null) {
// 所有车道的uuid都要存储起来
trafficData.forEach { objNew ->
lastMap[objNew.uuid] = 1
}
hasCheLong = true
return@forEach
}
}
roadMsgList.add(
NDEMsg.RoadMsg(
@@ -648,12 +660,13 @@ internal object V2NIdentifyDrawer : IEventDismissListener {
}
}
if (hasCheLong) {
val sortedList = roadMsgList.sortedWith(compareByDescending { it.laneNum })
saveMsgBox(MsgBoxBean(
MsgBoxType.NDE,
NDEMsg(
"", "路口车龙", "前方路口有车龙"
).also {
it.setRoadList(roadMsgList)
it.setRoadList(sortedList)
}
))
// 司机屏才TTS

View File

@@ -11,6 +11,7 @@ import com.mogo.eagle.core.function.call.map.CallerMapDevaListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.map.MogoData.Companion.mogoMapData
import kotlinx.android.synthetic.main.view_map_download_progress.view.download_pb
import kotlinx.android.synthetic.main.view_map_download_progress.view.ivBackground
@@ -35,6 +36,7 @@ class MapDownloadView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
CallerMapDevaListenerManager.addListener("${TAG}${this.hashCode()}", this)
initDownloadProgress()
}
override fun onDetachedFromWindow() {
@@ -78,4 +80,16 @@ class MapDownloadView @JvmOverloads constructor(
updateMapStatus(type, progress)
}
}
private fun initDownloadProgress() {
ThreadUtils.getIoPool().execute {
mogoMapData.get()?.isCityDataCached { isCached ->
if (isCached) {
UiThreadHandler.post {
updateMapStatus(1, 100)
}
}
}
}
}
}