merge
This commit is contained in:
@@ -76,7 +76,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
/**
|
||||
* 渲染 adas 识别的数据
|
||||
*
|
||||
* @param resultList
|
||||
* @param resultList adas感知融合数据
|
||||
*/
|
||||
public void renderAdasRecognizedResult(List<ADASRecognizedResult> resultList) {
|
||||
final long start = System.nanoTime();
|
||||
@@ -114,7 +114,6 @@ 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);
|
||||
// 复用过期 marker
|
||||
@@ -232,7 +231,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if (recognizedListResult == null) {
|
||||
return true;
|
||||
}
|
||||
if (!isRenderType(recognizedListResult.type)) {
|
||||
if (nonRenderType(recognizedListResult.type)) {
|
||||
return true;
|
||||
}
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Typeface;
|
||||
@@ -15,8 +17,8 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.drawer.bean.SpeedData;
|
||||
import com.mogo.module.common.datacenter.SnapshotLocationDataCenter;
|
||||
import com.mogo.module.common.drawer.bean.SpeedData;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -26,12 +28,6 @@ import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_ADAS;
|
||||
import static com.mogo.cloud.socket.entity.SocketDownDataHelper.FROM_MY_LOCATION;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_ADAS;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA;
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
@@ -176,15 +172,15 @@ class BaseDrawer {
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return render
|
||||
*/
|
||||
public boolean isRenderType(int type) {
|
||||
public boolean nonRenderType(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto
|
||||
|| recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdPerson
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck
|
||||
|| recognizedType == AdasRecognizedType.classIdUnKnow;
|
||||
return recognizedType != AdasRecognizedType.classIdCar
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficBus
|
||||
&& recognizedType != AdasRecognizedType.classIdTrafficTruck
|
||||
&& recognizedType != AdasRecognizedType.classIdUnKnow;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -324,7 +320,6 @@ class BaseDrawer {
|
||||
* @param isVrMode 是否是vrMode
|
||||
*/
|
||||
public static void showSelfSpeed(IMogoMarker mogoMarker, double speed, String uuid, int type, double heading, boolean isVrMode) {
|
||||
Log.d("EmArrow", "showSelf uuid : " + uuid + " speed : " + speed);
|
||||
if (mogoMarker == null || mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.mogo.module.common.drawer;
|
||||
import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_DATA;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
@@ -22,7 +21,6 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.api.CallChatApi;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.drawer.bean.SpeedData;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
@@ -75,20 +73,13 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
private static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
private static final Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map<String, SocketDownData.CloudRoadDataProto> mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
/**
|
||||
* 注册StatusDescriptor.VR_MODE类型,VR_MODE状态改变回调
|
||||
*
|
||||
@@ -105,10 +96,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data
|
||||
}
|
||||
|
||||
public boolean isVrMode() {
|
||||
return mIsVrMode;
|
||||
}
|
||||
|
||||
public boolean isChangeCarModeStatus() {
|
||||
return mChangeCarModeStatus;
|
||||
}
|
||||
@@ -152,7 +139,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param data 自车周边数据
|
||||
*/
|
||||
public void renderSnapshotData(SocketDownData.LauncherSnapshotProto data) {
|
||||
|
||||
final long start = System.nanoTime();
|
||||
if (clear(data)) {
|
||||
return;
|
||||
}
|
||||
@@ -180,8 +167,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
newDiffSet.add(cloudRoadData);
|
||||
}
|
||||
}
|
||||
delayRemoveUselessMarker();
|
||||
removeUselessLastRecord();
|
||||
// 需要新增的 marker 数量
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// 复用过期 marker
|
||||
@@ -194,12 +179,14 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
if (marker == null) {
|
||||
continue;
|
||||
}
|
||||
Log.d("云端融合数据", "新增marker id : " + uniqueKey);
|
||||
renderSnapshotOneFrame(marker, uniqueKey, cloudRoadData, newMarkersCaches);
|
||||
}
|
||||
}
|
||||
// sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches.putAll(newMarkersCaches);
|
||||
// 移除超时 marker
|
||||
delayRemoveUselessMarker();
|
||||
removeUselessLastRecord();
|
||||
Log.d("云端数据延时绘制", "render 接收数据 -> 处理结束 " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)) + "ms");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -235,14 +222,16 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMarker result = iterator.next();
|
||||
SocketDownData.CloudRoadDataProto proto = ((SocketDownData.CloudRoadDataProto) result.getObject());
|
||||
if(proto == null){ // 后续有业务数据在操作,更新数据,不做处理
|
||||
continue;
|
||||
}
|
||||
long internal = Long.parseLong(adasControllerApi.getSatelliteTime()) - proto.getSatelliteTime();
|
||||
Log.d("EmArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid()
|
||||
+ " adasTime : " + adasControllerApi.getSatelliteTime()
|
||||
+ " protoTime : " + proto.getSatelliteTime()
|
||||
Log.d("MogoArrow", "delayRemoveUselessMarker uuid : " + proto.getUuid()
|
||||
+ " localTime : " + adasControllerApi.getSatelliteTime()
|
||||
+ " originTime : " + proto.getSatelliteTime()
|
||||
+ " internal : " + internal);
|
||||
if (internal > 2000) {
|
||||
if (internal > 5000) {
|
||||
iterator.remove();
|
||||
result.remove();
|
||||
result.destroy();
|
||||
}
|
||||
}
|
||||
@@ -277,7 +266,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
if (cloudRoadData == null) {
|
||||
return true;
|
||||
}
|
||||
if (!isRenderType(cloudRoadData.getType())) {
|
||||
if (nonRenderType(cloudRoadData.getType())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -292,10 +281,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @param newSnapshotCaches 缓存数据
|
||||
*/
|
||||
private void renderSnapshotOneFrame(IMogoMarker marker, String uniqueKey, SocketDownData.CloudRoadDataProto cloudRoadData, Map<String, IMogoMarker> newSnapshotCaches) {
|
||||
|
||||
Log.d("云端融合数据", " uuid : " + uniqueKey + " type : " + cloudRoadData.getType() + " fromType : " + cloudRoadData.getFromType());
|
||||
final long start = System.nanoTime();
|
||||
|
||||
SocketDownData.CloudRoadDataProto lastPosition = mLastPositions.remove(uniqueKey);
|
||||
// 道路吸附
|
||||
// double lastLon = -1;
|
||||
@@ -318,22 +304,21 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
final MogoLatLng point = new MogoLatLng(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
long cost = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start);
|
||||
final long intervalRef = interval - cost;
|
||||
Log.d("云端动画数据", "最终赋值 : " + intervalRef + " 两帧间隔 : " + interval + " uuid : " + cloudRoadData.getUuid());
|
||||
marker.addDynamicAnchorPosition(point, (float) cloudRoadData.getHeading(), intervalRef);
|
||||
marker.setAnchorColor(getModelRenderColor(cloudRoadData.getType(), cloudRoadData.getFromType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading()));
|
||||
|
||||
newSnapshotCaches.put(uniqueKey, marker);
|
||||
if (shouldShowSpeed(cloudRoadData.getType())) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
msg.obj = new SpeedData(marker
|
||||
, cloudRoadData.getSpeed()
|
||||
, cloudRoadData.getUuid()
|
||||
, cloudRoadData.getType()
|
||||
, cloudRoadData.getHeading()
|
||||
, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
}
|
||||
// if (shouldShowSpeed(cloudRoadData.getType())) {
|
||||
// Message msg = mRenderThreadHandler.obtainMessage();
|
||||
// msg.obj = new SpeedData(marker
|
||||
// , cloudRoadData.getSpeed()
|
||||
// , cloudRoadData.getUuid()
|
||||
// , cloudRoadData.getType()
|
||||
// , cloudRoadData.getHeading()
|
||||
// , MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
// msg.what = MSG_DISPLAY_SPEED;
|
||||
// msg.sendToTarget();
|
||||
// }
|
||||
Log.d("云端数据延时", "render 刷新一台车 cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -407,6 +392,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
* @return {@link IMogoMarker}
|
||||
*/
|
||||
public IMogoMarker drawSnapshotDataMarker(SocketDownData.CloudRoadDataProto data) {
|
||||
long start = System.nanoTime();
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -439,7 +425,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
if (!TextUtils.isEmpty(data.getSn())) {
|
||||
bindClickListener(marker);
|
||||
}
|
||||
|
||||
Log.d("云端数据延时", "创建一个新 marker cost : " + TimeUnit.NANOSECONDS.toMillis((System.nanoTime() - start)));
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.mogo.module.service.marker;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
@@ -38,13 +36,11 @@ import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.socket.IMogoCloudOnMsgListener;
|
||||
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.module.IMogoBizActionDoneListener;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.ICallChatResponse;
|
||||
|
||||
@@ -148,7 +144,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
@Override
|
||||
public void onMsgReceived(SocketDownData.LauncherSnapshotProto mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus(DebugConfig.sDownloadSnapshot, true);
|
||||
//SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
|
||||
// SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
|
||||
// Message msg = mSnapshotHandler.obtainMessage();
|
||||
// msg.obj = mogoSnapshotSetData;
|
||||
// msg.what = MSG_SNAPSHOT;
|
||||
|
||||
Reference in New Issue
Block a user