add func in beautyObj of pnc warning
This commit is contained in:
@@ -5,9 +5,7 @@ import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
|
||||
interface Identify {
|
||||
|
||||
fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?){
|
||||
|
||||
}
|
||||
fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?)
|
||||
|
||||
fun renderAdasRecognizedResult(resultList: List<TrackedObject>?)
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ class IdentifyBeautifyDataDrawer : Identify {
|
||||
private const val TAG = "IdentifyDataDrawer"
|
||||
}
|
||||
|
||||
override fun renderPlanningWarningObj(planningObjects: List<MessagePad.PlanningObject>?) {
|
||||
TrackManager.getInstance().renderPlanningWarningObj(planningObjects)
|
||||
}
|
||||
|
||||
/**
|
||||
* 渲染 adas 识别的数据
|
||||
*
|
||||
|
||||
@@ -154,11 +154,6 @@ class IdentifyOriginDataDrawer : Identify, IMoGoAutopilotStatusListener {
|
||||
//首次过来的数据不添加,首次未添加的感知物在调用完绘制方法后再塞入cache map
|
||||
val cacheData = mMarkersCaches[uuid]
|
||||
if (cacheData != null) {
|
||||
// if (data.speed < 0.5) {
|
||||
// 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)) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.map.identify;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
@@ -11,6 +10,7 @@ import com.google.common.collect.HashBiMap;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
@@ -35,6 +35,9 @@ public class TrackManager {
|
||||
|
||||
public static double LIMIT_SPEED = 0.45;
|
||||
|
||||
private TrackManager() {
|
||||
}
|
||||
|
||||
/**
|
||||
* marker缓存队列
|
||||
*/
|
||||
@@ -57,6 +60,42 @@ public class TrackManager {
|
||||
@SuppressLint("NewApi")
|
||||
private final HashMap<String, MessagePad.TrackedObject> mFilterTrafficData = new HashMap<>();
|
||||
|
||||
/**
|
||||
* planning 感知物预警缓存,用于重置color状态
|
||||
*/
|
||||
private final ConcurrentHashMap<String, PlanningTrack> colorTrafficData = new ConcurrentHashMap<>();
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public synchronized void renderPlanningWarningObj(List<MessagePad.PlanningObject> planningObjects) {
|
||||
colorTrafficData.clear();
|
||||
//处于美化模式或者自动驾驶状态下展示
|
||||
if (FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData || CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState() == 2) {
|
||||
if (planningObjects == null) {
|
||||
return;
|
||||
}
|
||||
planningObjects.forEach(planningObj -> {
|
||||
String trackId = "" + planningObj.getUuid();
|
||||
if (mMarkersCaches.containsKey(trackId)) {
|
||||
TrackObj trackObj = mMarkersCaches.get(trackId);
|
||||
if (trackObj == null) {
|
||||
return;
|
||||
}
|
||||
if (planningObj.getType() == 0) {
|
||||
colorTrafficData.put(trackId, new PlanningTrack(
|
||||
"#D65D5AFF",
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84SatelliteTime()
|
||||
));
|
||||
} else if (planningObj.getType() == 1) {
|
||||
colorTrafficData.put(trackId, new PlanningTrack(
|
||||
"#E4DD94FF",
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84SatelliteTime()
|
||||
));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤后的数据集合
|
||||
*/
|
||||
@@ -71,6 +110,17 @@ public class TrackManager {
|
||||
}
|
||||
String uuid = "" + data.getUuid();
|
||||
TrackObj trackObj = mMarkersCaches.get(uuid);
|
||||
|
||||
// 判断物体是否与预警信息
|
||||
if (colorTrafficData.containsKey(uuid)) {
|
||||
PlanningTrack planningTrack = colorTrafficData.get(uuid);
|
||||
if (planningTrack != null && !timeOut(planningTrack.getTime())) {
|
||||
data = data.toBuilder().setColor(planningTrack.getColor()).build();
|
||||
} else {
|
||||
colorTrafficData.remove(uuid);
|
||||
}
|
||||
}
|
||||
|
||||
if (trackObj != null) {
|
||||
trackObj.updateObj(data);
|
||||
} else {
|
||||
@@ -80,7 +130,6 @@ public class TrackManager {
|
||||
// 融合逻辑 : 判断是否有重合元素
|
||||
if (cellIdCaches.containsValue(pos)) {
|
||||
String findSameValue = cellIdCaches.inverse().get(pos);
|
||||
Log.d("hy uuid : " + findSameValue, " 与新感知物 : " + uuid + "相同");
|
||||
//uuid处理
|
||||
data = data.toBuilder().setUuid(Integer.parseInt(findSameValue)).build();
|
||||
TrackObj cacheTrack = mMarkersCaches.get(findSameValue);
|
||||
@@ -102,6 +151,7 @@ public class TrackManager {
|
||||
trackObj = new TrackObj(data);
|
||||
}
|
||||
}
|
||||
|
||||
mFilterTrafficData.put(uuid, trackObj.getCache());
|
||||
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
|
||||
mMarkersCaches.put(uuid, trackObj);
|
||||
@@ -146,5 +196,9 @@ public class TrackManager {
|
||||
mMarkersCaches.forEach((uuid, trackObj) -> removeKey(uuid));
|
||||
}
|
||||
|
||||
private Boolean timeOut(Double time) {
|
||||
long duration = (long) (CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84SatelliteTime() * 1000) - (long) (time * 1000);
|
||||
return duration >= 500;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user