fix bug
This commit is contained in:
@@ -52,7 +52,7 @@ class IdentifyOriginDataDrawer : Identify, IMoGoAutopilotStatusListener {
|
||||
/**
|
||||
* planning 感知物预警缓存,用于重置color状态
|
||||
*/
|
||||
private val colorTrafficData = ConcurrentHashMap<String, String>()
|
||||
private val colorTrafficData = ConcurrentHashMap<String, PlanningTrack>()
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
override fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?) {
|
||||
@@ -62,20 +62,18 @@ class IdentifyOriginDataDrawer : Identify, IMoGoAutopilotStatusListener {
|
||||
if (planningObjects == null) {
|
||||
return
|
||||
}
|
||||
val tempTrafficData = ArrayList<TrackedObject>()
|
||||
planningObjects.forEach { planningObj ->
|
||||
val trackId = planningObj.uuid.toString()
|
||||
if(mMarkersCaches.containsKey(trackId)){
|
||||
if (mMarkersCaches.containsKey(trackId)) {
|
||||
val trackObj = mMarkersCaches[trackId]
|
||||
trackObj?.let {
|
||||
colorTrafficData[trackId] = "#FFBCB239"
|
||||
val temp = it.toBuilder().setColor("#FFBCB239").build()
|
||||
tempTrafficData.add(temp)
|
||||
colorTrafficData[trackId] = PlanningTrack(
|
||||
"#FFBCB239",
|
||||
CallerAutoPilotStatusListenerManager.getCurWgs84SatelliteTime()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.updateBatchMarkerPosition(tempTrafficData)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,22 +136,28 @@ class IdentifyOriginDataDrawer : Identify, IMoGoAutopilotStatusListener {
|
||||
if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type) {
|
||||
continue
|
||||
}
|
||||
var temp:TrackedObject = data
|
||||
var temp: TrackedObject = data
|
||||
val uuid = "" + data.uuid
|
||||
//首次过来的数据不添加,首次未添加的感知物在调用完绘制方法后再塞入cache map
|
||||
val cacheData = mMarkersCaches[uuid]
|
||||
if (cacheData != null) {
|
||||
if (data.speed < 0.5) {
|
||||
temp = data.toBuilder().setHeading(cacheData.heading).setLongitude(cacheData.longitude)
|
||||
temp = data.toBuilder().setHeading(cacheData.heading)
|
||||
.setLongitude(cacheData.longitude)
|
||||
.setLatitude(cacheData.latitude).build()
|
||||
}
|
||||
if (colorTrafficData.containsKey(uuid)) {
|
||||
val planningTrack = colorTrafficData[uuid]
|
||||
if (!timeOut(planningTrack!!.time)) {
|
||||
temp = data.toBuilder().setColor(planningTrack.color).build()
|
||||
} else {
|
||||
colorTrafficData.remove(uuid)
|
||||
}
|
||||
}
|
||||
mFilterTrafficData.add(temp)
|
||||
}
|
||||
mMarkersCaches[uuid] = temp
|
||||
trafficDataUuidList.add(uuid)
|
||||
if(colorTrafficData.containsKey(uuid)){
|
||||
continue
|
||||
}
|
||||
mFilterTrafficData.add(temp)
|
||||
}
|
||||
return mFilterTrafficData
|
||||
}
|
||||
@@ -173,4 +177,10 @@ class IdentifyOriginDataDrawer : Identify, IMoGoAutopilotStatusListener {
|
||||
mAutopilotStatus = autoPilotStatusInfo.state
|
||||
}
|
||||
|
||||
private fun timeOut(time: Double): Boolean {
|
||||
val duration =
|
||||
(CallerAutoPilotStatusListenerManager.getCurWgs84SatelliteTime() * 1000).toLong() - (time * 1000).toLong()
|
||||
return duration >= 1000
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
|
||||
data class PlanningTrack(var color: String, var time: Double) {
|
||||
}
|
||||
Reference in New Issue
Block a user