[dev_arch_opt_3.0] add log

This commit is contained in:
lixiaopeng
2023-03-01 19:26:51 +08:00
12 changed files with 215 additions and 364 deletions

View File

@@ -2,6 +2,8 @@ package com.mogo.eagle.core.function.business.identify;
import android.annotation.SuppressLint;
import android.os.Build;
import android.util.ArraySet;
import android.util.Log;
import androidx.annotation.RequiresApi;
@@ -50,7 +52,7 @@ public class TrackManager {
* 记录每次实际绘制的交通元素UUID
*/
@SuppressLint("NewApi")
private final ConcurrentHashMap<String, Long> trafficDataUuid = new ConcurrentHashMap<>();
private final ArraySet<String> trafficDataUuid = new ArraySet<>();
/**
* 过滤后的数据集合
@@ -71,9 +73,10 @@ public class TrackManager {
* 过滤后的数据集合
*/
@SuppressLint("NewApi")
public synchronized HashMap<String, MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
public HashMap<String, MessagePad.TrackedObject> filterTrafficData(List<MessagePad.TrackedObject> trafficData) {
//清空上次返回数据,做到缓存复用
mFilterTrafficData.clear();
long cost = System.currentTimeMillis();
//进入过滤机制的感知物体,首先从缓存队列中进行查找 uuid
for (MessagePad.TrackedObject data : trafficData) {
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
@@ -121,35 +124,34 @@ public class TrackManager {
mFilterTrafficData.put(uuid, trackObj.getCache());
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
mMarkersCaches.put(uuid, trackObj);
trafficDataUuid.put(uuid, System.currentTimeMillis());
trafficDataUuid.add(uuid);
Log.i("costTime","" + (System.currentTimeMillis() - cost));
}
return mFilterTrafficData;
}
@RequiresApi(api = Build.VERSION_CODES.N)
public void clearCache(List<MessagePad.TrackedObject> resultList) {
//过滤现有元素
for (MessagePad.TrackedObject data : resultList) {
String uuid = "" + data.getUuid();
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
continue;
}
if (trafficDataUuid.size() > 0) {
if (trafficDataUuid.size() > 0 && trafficDataUuid.contains(uuid)) {
if (TrackerSourceColorHelper.INSTANCE.filterData(data)) {
continue;
}
trafficDataUuid.remove(uuid);
}
}
//清除缓存,删除marker
Iterator<Map.Entry<String, Long>> it = trafficDataUuid.entrySet().iterator();
Iterator<String> it = trafficDataUuid.iterator();
while (it.hasNext()) {
Map.Entry<String, Long> next = it.next();
String key = next.getKey();
String key = it.next();
it.remove();
removeKey(key);
}
}
public synchronized void removeKey(String key) {
public void removeKey(String key) {
cellIdCaches.remove(key);
mMarkersCaches.remove(key);
WarningHelper.INSTANCE.remove(key);
@@ -157,15 +159,12 @@ public class TrackManager {
.removeMarker(key);
}
@SuppressLint("NewApi")
public void clearAll() {
MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).clearAllMarker();
cellIdCaches.clear();
trafficDataUuid.clear();
WarningHelper.INSTANCE.clear();
mMarkersCaches.forEach((uuid, trackObj) -> {
trackObj.clear();
});
mMarkersCaches.forEach((uuid, trackObj) -> trackObj.clear());
mMarkersCaches.clear();
}

View File

@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener;
@@ -103,6 +104,9 @@ public class MogoRouteOverlayManager implements
if (arrivalNotification == null) {
return;
}
if(!HdMapBuildConfig.isMapLoaded){
return;
}
if (!isArriveAtStation.get()) {
isArriveAtStation.set(true);
}