merge qa_yingyan_custom
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.socket.entity.SocketDownData;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -12,9 +12,9 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.utils.SimpleHandlerThreadPool;
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -79,7 +79,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new HashMap<>();
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches = new ConcurrentHashMap<>();
|
||||
List<ADASRecognizedResult> newDiffSet = new ArrayList<>();
|
||||
for (ADASRecognizedResult recognizedListResult : resultList) {
|
||||
|
||||
@@ -91,21 +91,23 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
IMogoMarker marker = mMarkersCaches.remove(uniqueKey);
|
||||
if (marker != null && !marker.isDestroyed()) {
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
} else {
|
||||
// 新增差集
|
||||
// 新增添加进差集
|
||||
newDiffSet.add(recognizedListResult);
|
||||
}
|
||||
}
|
||||
|
||||
removeUselessMarker();
|
||||
removeUselessLastRecord();
|
||||
|
||||
// 能复用的 marker 数量
|
||||
int cachedMarkerSize = mMarkersCaches.size();
|
||||
// 需要新增的 marker 数量
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// 能复用的数量
|
||||
int size = cachedMarkerSize >= newDiffSetSize ? newDiffSetSize : cachedMarkerSize;
|
||||
int size = Math.min(cachedMarkerSize, newDiffSetSize);
|
||||
|
||||
// 复用过期 marker
|
||||
if (newDiffSetSize > 0) {
|
||||
@@ -118,30 +120,17 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
ADASRecognizedResult old = mLastPositions.remove(entry.getKey());
|
||||
IMogoMarker marker = entry.getValue();
|
||||
if (marker == null) {
|
||||
Log.d("EmArrow", "存在复用marker为空数据");
|
||||
continue;
|
||||
}
|
||||
|
||||
// 更新资源内容
|
||||
// 复用,更新marker 3D资源
|
||||
if (old == null || old.type != recognizedListResult.type) {
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes(recognizedListResult.type);
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||
if (!TextUtils.isEmpty(resName)) {
|
||||
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource(resId);
|
||||
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||
}
|
||||
updateCacheMarkerRes(marker, recognizedListResult);
|
||||
}
|
||||
|
||||
renderAdasOneFrame(marker, uniqueKey, recognizedListResult, newAdasRecognizedMarkersCaches);
|
||||
}
|
||||
|
||||
// 复用过后还需新增的 marker
|
||||
|
||||
for (int i = size; i < newDiffSetSize; i++) {
|
||||
ADASRecognizedResult recognizedListResult = newDiffSet.get(i);
|
||||
String uniqueKey = recognizedListResult.uuid;
|
||||
@@ -158,6 +147,46 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
mMarkersCaches = newAdasRecognizedMarkersCaches;
|
||||
}
|
||||
|
||||
/**
|
||||
* todo 后面涉及到此类变化的数据均改动
|
||||
*
|
||||
* @param marker
|
||||
* @param recognizedListResult
|
||||
*/
|
||||
private void updateCacheMarkerRes(IMogoMarker marker, ADASRecognizedResult recognizedListResult) {
|
||||
String resIdVal;
|
||||
int resId = getModelRes(recognizedListResult.type);
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get(resIdVal);
|
||||
if (!TextUtils.isEmpty(resName)) {
|
||||
if (!TextUtils.equals(resName, marker.getMarkerResName())) {
|
||||
marker.use3DResource(resName);
|
||||
}
|
||||
} else {
|
||||
resName = marker.use3DResource(resId);
|
||||
mMarkerCachesResMd5Values.put(resIdVal, resName);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeUselessLastRecord() { // todo 最好重新设计一个数据结构,用于多线程数据过期失效的场景,参见redis数据过期
|
||||
if (mLastPositions == null || mLastPositions.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
IMogoADASController adasControllerApi = MogoApisHandler.getInstance().getApis().getAdasControllerApi();
|
||||
if (TextUtils.isEmpty(adasControllerApi.getSatelliteTime()) || adasControllerApi.getSatelliteTime().equals("0")) {
|
||||
return;
|
||||
}
|
||||
Iterator<ADASRecognizedResult> iterator = mLastPositions.values().iterator();
|
||||
Log.d("EmArrow","removeUselessLastRecord size : " + mLastPositions.size());
|
||||
while (iterator.hasNext()) {
|
||||
ADASRecognizedResult result = iterator.next();
|
||||
long internal = result.satelliteTime - Long.parseLong(adasControllerApi.getSatelliteTime());
|
||||
if (internal > 1000) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isUselessValue(ADASRecognizedResult recognizedListResult) {
|
||||
if (recognizedListResult == null) {
|
||||
return true;
|
||||
@@ -174,7 +203,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
* 绘制某个物体的一个数据 todo 缓存问题
|
||||
*
|
||||
* @param recognizedListResult
|
||||
* @param newAdasRecognizedMarkersCaches
|
||||
@@ -185,22 +214,21 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
Map<String, IMogoMarker> newAdasRecognizedMarkersCaches) {
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey);
|
||||
double lastLon = -1;
|
||||
double lastLat = -1;
|
||||
if (lastPosition != null) {
|
||||
lastLon = lastPosition.lon;
|
||||
lastLat = lastPosition.lat;
|
||||
}
|
||||
double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat);
|
||||
|
||||
recognizedListResult.lon = matchLonLat[0];
|
||||
recognizedListResult.lat = matchLonLat[1];
|
||||
Log.d("EmArrow", "renderAdasOneFrame uuid : " + uniqueKey + " type : " + recognizedListResult.type);
|
||||
ADASRecognizedResult lastPosition = mLastPositions.remove(uniqueKey); //todo 缓存数据太多
|
||||
// double lastLon = -1;
|
||||
// double lastLat = -1;
|
||||
// if (lastPosition != null) {
|
||||
// lastLon = lastPosition.lon;
|
||||
// lastLat = lastPosition.lat;
|
||||
// }
|
||||
// double[] matchLonLat = getMatchLonLat(recognizedListResult.uuid, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading, lastLon, lastLat);
|
||||
//
|
||||
// recognizedListResult.lon = matchLonLat[0];
|
||||
// recognizedListResult.lat = matchLonLat[1];
|
||||
|
||||
mLastPositions.put(uniqueKey, recognizedListResult);
|
||||
// Logger.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
|
||||
// Log.d( "matchRoad", "cost = %s", System.currentTimeMillis() - start );
|
||||
newAdasRecognizedMarkersCaches.put(uniqueKey, marker);
|
||||
if (lastPosition != null) {
|
||||
long interval = computeAnimDuration(lastPosition.systemTime, recognizedListResult.systemTime, lastPosition.satelliteTime, recognizedListResult.satelliteTime);
|
||||
@@ -208,9 +236,9 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
final MogoLatLng renderLoc = new MogoLatLng(recognizedListResult.lat, recognizedListResult.lon);
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
final long intervalRef = interval - cost;
|
||||
SimpleHandlerThreadPool.getInstance().postRender(() -> {
|
||||
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
|
||||
});
|
||||
// SimpleHandlerThreadPool.getInstance().postRender(() -> {
|
||||
marker.addDynamicAnchorPosition(renderLoc, (float) recognizedListResult.heading, intervalRef);
|
||||
// });
|
||||
} else {
|
||||
marker.setRotateAngle(((float) recognizedListResult.heading));
|
||||
marker.setPosition(recognizedListResult.lat, recognizedListResult.lon);
|
||||
@@ -222,14 +250,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
marker.setAnchorColor(carColor);
|
||||
|
||||
if (shouldShowSpeed(recognizedListResult.type)) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
SpeedData obj = new SpeedData();
|
||||
obj.context = mContext;
|
||||
obj.marker = marker;
|
||||
obj.speed = recognizedListResult.speed;
|
||||
msg.obj = obj;
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
showSelfSpeed(marker, recognizedListResult.speed, recognizedListResult.uuid, recognizedListResult.type, MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,9 +265,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
return null;
|
||||
}
|
||||
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes(recognizedListResult.type);
|
||||
resIdVal = resId + "";
|
||||
String resIdVal = resId + "";
|
||||
|
||||
String carColor = recognizedListResult.color;
|
||||
if (TextUtils.isEmpty(carColor)) {
|
||||
|
||||
@@ -20,12 +20,15 @@ import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
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 com.mogo.realtime.entity.CloudRoadData.FROM_ADAS;
|
||||
import static com.mogo.realtime.entity.CloudRoadData.FROM_MY_LOCATION;
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
public
|
||||
@@ -37,35 +40,9 @@ public
|
||||
*/
|
||||
class BaseDrawer {
|
||||
|
||||
/**
|
||||
* 速度显示对象
|
||||
*/
|
||||
public class SpeedData {
|
||||
|
||||
public IMogoMarker marker;
|
||||
public Context context;
|
||||
double speed;
|
||||
|
||||
public void showSpeed() {
|
||||
try {
|
||||
showSelfSpeed(context,
|
||||
marker,
|
||||
speed,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 移除过期的 marker
|
||||
public static final int MSG_REMOVE_DIRTY_MARKERS = 9990;
|
||||
|
||||
/**
|
||||
* 显示速度
|
||||
*/
|
||||
public static final int MSG_DISPLAY_SPEED = 11;
|
||||
|
||||
/**
|
||||
* 地图刷新频率
|
||||
*/
|
||||
@@ -79,20 +56,31 @@ class BaseDrawer {
|
||||
/**
|
||||
* 地图内部资源md5缓存,便于资源复用
|
||||
*/
|
||||
protected static final Map<String, String> mMarkerCachesResMd5Values = new HashMap<>();
|
||||
protected static final ConcurrentHashMap<String, String> mMarkerCachesResMd5Values = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected Map<String, IMogoMarker> mMarkersCaches = new HashMap<>();
|
||||
protected static Map<String, IMogoMarker> mMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
protected final Context mContext;
|
||||
|
||||
protected static Handler mRenderThreadHandler = null;
|
||||
private TextView mSpeedView;
|
||||
|
||||
public BaseDrawer() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
initWorkThreadHandler();
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(mContext);
|
||||
mSpeedView.setSingleLine(false);
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
}
|
||||
|
||||
private static Handler mWorkThreadHandler;
|
||||
@@ -124,32 +112,6 @@ class BaseDrawer {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (mRenderThreadHandler == null) {
|
||||
mRenderThreadHandler = new Handler(WorkThreadHandler.newInstance("render-thread-" + new Random().nextLong()).getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_DISPLAY_SPEED) {
|
||||
if (msg.obj instanceof SpeedData) {
|
||||
showSpeed((SpeedData) msg.obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示速度
|
||||
*
|
||||
* @param data {@link SpeedData}
|
||||
*/
|
||||
private static void showSpeed(SpeedData data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
data.showSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,6 +128,7 @@ class BaseDrawer {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,8 +171,7 @@ class BaseDrawer {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson
|
||||
&& recognizedType != AdasRecognizedType.classIdUnKnow; //todo unKnow物体不绘制车速
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -222,7 +184,7 @@ class BaseDrawer {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return R.raw.othercar;
|
||||
return R.raw.othercar; //todo otherCar be replacing tache for now to test,remember to fix
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return R.raw.bus;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|
||||
@@ -233,7 +195,7 @@ class BaseDrawer {
|
||||
} else if (recognizedType == AdasRecognizedType.classIdWarningArrows) {
|
||||
return R.raw.arraw;
|
||||
} else if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow物体3D模型
|
||||
return R.raw.othercar;
|
||||
return R.raw.tache;
|
||||
}
|
||||
return R.raw.people;
|
||||
}
|
||||
@@ -252,8 +214,8 @@ class BaseDrawer {
|
||||
if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return "#D8D8D8FF";
|
||||
}
|
||||
if (recognizedType == AdasRecognizedType.classIdUnKnow){ //todo unKnow颜色绘制
|
||||
return "#FF2894FF";
|
||||
if (recognizedType == AdasRecognizedType.classIdUnKnow) { //todo unKnow颜色绘制
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
// 距离策略
|
||||
double[] coordinates = getCurCoordinates();
|
||||
@@ -328,17 +290,15 @@ class BaseDrawer {
|
||||
}
|
||||
}
|
||||
|
||||
private TextView mSpeedView = null;
|
||||
|
||||
/**
|
||||
* 展示车辆速度
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param mogoMarker {@link IMogoMarker}
|
||||
* @param speed 是否显示速度
|
||||
* @param isVrMode 是否是vrMode
|
||||
*/
|
||||
public void showSelfSpeed(Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode) {
|
||||
public void showSelfSpeed(IMogoMarker mogoMarker, double speed, String uuid, int type, boolean isVrMode) {
|
||||
Log.d("EmArrow", "showSelf uuid : " + uuid + " speed : " + speed);
|
||||
if (mogoMarker == null || mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
@@ -347,26 +307,14 @@ class BaseDrawer {
|
||||
return;
|
||||
}
|
||||
int speedIntVal = (int) (speed * 3.6);
|
||||
if (speedIntVal <= 0) {
|
||||
if (speedIntVal <= 0) { //速度为0 隐藏InfoWindow
|
||||
mogoMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
String speedVal = speedIntVal + "";
|
||||
String infoResName = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMarkerInfoResName(speedVal);
|
||||
mogoMarker.setInfoWindowOffset(0, 20);
|
||||
if (TextUtils.isEmpty(infoResName)) {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(context);
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
mSpeedView.setText(speedVal);
|
||||
mogoMarker.updateInfoWindowView(mSpeedView);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setMarkerInfoResName(speedVal, mogoMarker.getMarkerInfoResName());
|
||||
} else {
|
||||
mogoMarker.updateInfoWindowView(infoResName);
|
||||
}
|
||||
String text = speedIntVal + "\n" + uuid + "\n" + type;
|
||||
mSpeedView.setText(text);
|
||||
mogoMarker.updateInfoWindowView(mSpeedView);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,4 +454,15 @@ class BaseDrawer {
|
||||
|
||||
return new double[]{lon, lat};
|
||||
}
|
||||
|
||||
protected String getDataTypes(int fromType) {
|
||||
switch (fromType) {
|
||||
case FROM_MY_LOCATION:
|
||||
return TYPE_MARKER_CLOUD_DATA;
|
||||
case FROM_ADAS:
|
||||
return TYPE_MARKER_ADAS;
|
||||
default:
|
||||
return TYPE_MARKER_CLOUD_DATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -17,7 +16,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.utils.SimpleHandlerThreadPool;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.utils.ViewUtils;
|
||||
@@ -26,7 +24,6 @@ import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
import com.zhidao.carchattingprovider.MogoDriverInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -88,7 +85,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
Logger.d(TAG, "%s - %s", descriptor, isTrue);
|
||||
mChangeCarModeStatus = true;
|
||||
sendMessage(MSG_REMOVE_DIRTY_MARKERS, mMarkersCaches);
|
||||
mMarkersCaches = new HashMap<>();
|
||||
mMarkersCaches = new ConcurrentHashMap<>();
|
||||
mLastPositions.clear();
|
||||
AdasRecognizedResultDrawer.getInstance().notifyVrModeChanged(); //清除ADAS old marker data
|
||||
}
|
||||
@@ -135,7 +132,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
}
|
||||
|
||||
/**
|
||||
* mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
|
||||
* 绘制来自云端的 mogo 他车、mogo 他车识别的社会车辆、路边单元识别的车辆
|
||||
*
|
||||
* @param data 自车周边数据
|
||||
*/
|
||||
@@ -148,7 +145,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
List<SocketDownData.CloudRoadDataProto> allDatumsList = new ArrayList<>();
|
||||
prepareData(data.getAllListList(), allDatumsList);
|
||||
|
||||
Map<String, IMogoMarker> newMarkersCaches = new HashMap<>(allDatumsList.size());
|
||||
Map<String, IMogoMarker> newMarkersCaches = new ConcurrentHashMap<>(allDatumsList.size());
|
||||
List<SocketDownData.CloudRoadDataProto> newDiffSet = new ArrayList<>();
|
||||
|
||||
for (SocketDownData.CloudRoadDataProto cloudRoadData : allDatumsList) {
|
||||
@@ -281,25 +278,14 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
final MogoLatLng point = new MogoLatLng(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
final long intervalRef = interval - cost;
|
||||
|
||||
SocketDownData.CloudRoadDataProto finalCloudRoadData = cloudRoadData;
|
||||
SimpleHandlerThreadPool.getInstance().postRender(() -> marker.addDynamicAnchorPosition(point, (float) finalCloudRoadData.getHeading(), intervalRef));
|
||||
marker.addDynamicAnchorPosition(point, (float) cloudRoadData.getHeading(), intervalRef);
|
||||
} else {
|
||||
marker.setRotateAngle(((float) cloudRoadData.getHeading()));
|
||||
marker.setPosition(cloudRoadData.getWgslat(), cloudRoadData.getWgslon());
|
||||
}
|
||||
|
||||
marker.setAnchorColor(getModelRenderColor(cloudRoadData.getType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading()));
|
||||
|
||||
if (shouldShowSpeed(cloudRoadData.getType())) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
SpeedData obj = new SpeedData();
|
||||
obj.context = mContext;
|
||||
obj.marker = marker;
|
||||
obj.speed = cloudRoadData.getSpeed();
|
||||
msg.obj = obj;
|
||||
msg.what = MSG_DISPLAY_SPEED;
|
||||
msg.sendToTarget();
|
||||
showSelfSpeed(marker, cloudRoadData.getSpeed(), cloudRoadData.getUuid(), cloudRoadData.getType(), MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,6 +302,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
|
||||
/**
|
||||
* vr 模式下显示合并数据,否则只显示 mogo 车辆上报的数据
|
||||
* 展示融合数据,不包括自车定位数据和adas识别数据
|
||||
*
|
||||
* @param data 道路数据集合
|
||||
*/
|
||||
@@ -359,7 +346,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
}
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner(DataTypes.TYPE_MARKER_CLOUD_DATA)
|
||||
.owner(getDataTypes(data.getFromType()))
|
||||
.anchor(0.5f, 0.5f)
|
||||
.rotate((float) data.getHeading())
|
||||
.object(data)
|
||||
@@ -380,7 +367,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
options.icon(view);
|
||||
resIdVal = view.getId() + "";
|
||||
}
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(DataTypes.TYPE_MARKER_CLOUD_DATA, options);
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(getDataTypes(data.getFromType()), options);
|
||||
cacheMarkerIconResMd5Val(resIdVal, marker);
|
||||
|
||||
if (!TextUtils.isEmpty(data.getSn())) {
|
||||
|
||||
Reference in New Issue
Block a user