fix bug of delay and update map version
This commit is contained in:
@@ -19,6 +19,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
|
||||
@@ -76,6 +77,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
* @param resultList
|
||||
*/
|
||||
public void renderAdasRecognizedResult(List<ADASRecognizedResult> resultList) {
|
||||
final long start = System.nanoTime();
|
||||
if (resultList == null || resultList.isEmpty() || !DebugConfig.isUseAdasRecognize()) {
|
||||
clearOldMarker();
|
||||
return;
|
||||
@@ -100,7 +102,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
Log.d(TAG, "发现缓存marker id : " + uniqueKey);
|
||||
// Log.d(TAG, "发现缓存marker id : " + uniqueKey);
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
renderAdasOneFrame(true, marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
} else {
|
||||
@@ -110,9 +112,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
removeUselessMarker(mMarkersCaches);
|
||||
removeUselessLastRecord();
|
||||
|
||||
Log.d("ADAS数据延时绘制", "查找缓存绘制 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||
// Log.d(TAG, "原数据量 : " + resultList.size() + " 新增marker数量 : " + newDiffSetSize);
|
||||
// 复用过期 marker
|
||||
if (newDiffSetSize > 0) {
|
||||
for (int i = 0; i < newDiffSetSize; i++) {
|
||||
@@ -122,14 +124,15 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
Log.d(TAG, "新增marker id : " + uniqueKey);
|
||||
// Log.d(TAG, "新增marker id : " + uniqueKey);
|
||||
renderAdasOneFrame(false, marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
}
|
||||
}
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches.clear();
|
||||
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
Log.d(TAG, "更新缓存marker, size : " + mMarkersCaches.size());
|
||||
// Log.d(TAG, "更新缓存marker, size : " + mMarkersCaches.size());
|
||||
Log.d("ADAS数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -245,9 +248,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
String uniqueKey,
|
||||
ADASRecognizedResult recognizedListResult,
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading);
|
||||
final long start = System.nanoTime();
|
||||
// Log.d(TAG, "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type + " heading : " + recognizedListResult.heading);
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey);
|
||||
// 道路吸附
|
||||
// double lastLon = -1;
|
||||
@@ -264,7 +266,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
|
||||
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||
// if (useCache) {
|
||||
Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||
// Log.d(TAG, "使用缓存 id : " + uniqueKey);
|
||||
long interval = 45;
|
||||
if (lastPosition != null) {
|
||||
interval = computeAnimDuration(lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime);
|
||||
@@ -286,9 +288,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
marker.setAnchorColor(carColor);
|
||||
|
||||
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
|
||||
if (shouldShowSpeed(recognizedListResult.type)) {
|
||||
showSelfSpeed(marker, recognizedListResult.speed, recognizedListResult.uuid, recognizedListResult.type, recognizedListResult.heading, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
}
|
||||
// if (shouldShowSpeed(recognizedListResult.type)) {
|
||||
// showSelfSpeed(marker, recognizedListResult.speed, recognizedListResult.uuid, recognizedListResult.type, recognizedListResult.heading, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
// }
|
||||
Log.d("ADAS数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -298,6 +301,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
private IMogoMarker drawAdasRecognizedDataMarker(ADASRecognizedResult recognizedListResult) {
|
||||
long start = System.nanoTime();
|
||||
if (recognizedListResult == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -322,6 +326,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
.position(new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon));
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(DataTypes.TYPE_MARKER_ADAS, options);
|
||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||
Log.d("ADAS数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,45 +211,8 @@ class BaseDrawer {
|
||||
// AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
// if (recognizedType == AdasRecognizedType.classIdUnKnow) {
|
||||
// return Car3DModelColor.Normal.color;
|
||||
// }
|
||||
// 距离策略 todo 此处两种策略是临时方案
|
||||
// double[] coordinates = getCurCoordinates();
|
||||
// double distance = CoordinateUtils.calculateLineDistance(lon, lat, coordinates[0], coordinates[1]) * 100;
|
||||
// if (distance < 15) {
|
||||
// return Car3DModelColor.Dangerous.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
|
||||
// } else if (distance < 50 && distance >= 15) {
|
||||
// return Car3DModelColor.Warming.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
|
||||
// }
|
||||
|
||||
// 他车车速和自车车速对比速度策略
|
||||
// 自车速度 >= 50% 危险
|
||||
// 10% < 自车速度 < 50% 警告
|
||||
// double curSpeed = getCurSpeed();
|
||||
// if (curSpeed > 0 && speed > curSpeed) {
|
||||
// double rate = ((speed - curSpeed) / curSpeed) * 100;
|
||||
// if (rate >= 50) {
|
||||
// return Car3DModelColor.Dangerous.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Dangerous); // todo 方案2
|
||||
// } else if (rate > 10 && rate < 50) {
|
||||
// return Car3DModelColor.Warming.color; // todo 方案1
|
||||
//// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Close); // todo 方案2
|
||||
// }
|
||||
// }
|
||||
|
||||
// 默认颜色 // todo 方案1
|
||||
// switch (fromType) {
|
||||
// case FROM_ADAS:
|
||||
// return Car3DModelColor.Normal_Visual.color;
|
||||
// case FROM_ROAD_UNIT:
|
||||
// return Car3DModelColor.Normal_Cloud.color;
|
||||
// default:
|
||||
// return Car3DModelColor.Normal.color;
|
||||
// }
|
||||
return Car3DModelColor.Normal.color;
|
||||
// todo 方案2
|
||||
// return Car3DTestModelColor.getTestModelColor(fromType, Waring_Normal);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user