[6.10.0][Fix]过滤重复的车龙事件
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user