[fix] 容错 返回值null崩溃问题修复;类型备注;模型与返回类型验证修改

This commit is contained in:
liujing
2021-07-08 20:01:04 +08:00
parent b42d063107
commit a97eb6c1f3
5 changed files with 31 additions and 29 deletions

View File

@@ -80,17 +80,15 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
*/
public void renderWarnData(V2XWarningEntity data) {
MarkerLocation location = new MarkerLocation();
location.setLat(data.getDirection() == 1 ? data.getStopLines().get(0).lat : data.getLat());
location.setLon(data.getDirection() == 1 ? data.getStopLines().get(0).lon : data.getLon());
location.setLat(data.getLat());
location.setLon(data.getLon());
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
markerShowEntity.setMarkerLocation(location);
markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA);
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(data.getType()));
//识别物
marker.addDynamicAnchorPosition(new MogoLatLng(
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000);
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
@@ -98,19 +96,16 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
}
//根据识别物类型 (行人0/自行车1/摩托车2/小汽车3/公交车4)获取3D模型(对应查看getModelRes)
//根据识别物类型 (行人1/自行车2/摩托车4/骑行车辆11)获取3D模型(对应查看getModelRes)
private int modeResType(int dataType) {
switch (dataType) {
case 0:
return 1;
case 1:
return 2;
case 11:
return 1;
case 2:
return 4;
case 3:
return 3;
return 2;
case 4:
return 6;
return 4;
}
return 1;
}

View File

@@ -12,7 +12,7 @@ import java.util.List;
*/
public class V2XWarningEntity implements Serializable {
//事件类型 行人0/自行车1/摩托车2/小汽车3/公交车4
//事件类型 行人1/自行车2/摩托车4/骑行车辆11
private int type;
//目标物位置
private double lat;