[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

@@ -58,7 +58,7 @@ public class V2XWarningMarker implements IV2XMarker {
/*
* 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算
* */
private MogoLatLng middleLocationInStopLine;
private MogoLatLng middleLocationInStopLine = new MogoLatLng(0,0);
private static long showTime = 5000;
private float bearing;
@@ -75,8 +75,8 @@ public class V2XWarningMarker implements IV2XMarker {
}
public void drawLineWithEntity() {
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime() : 5000;
Log.d(TAG, "显示时间为++" + String.valueOf(showTime));
showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime()*1000 : 5000;
Log.d(TAG, "显示时间为++" + String.valueOf(showTime)+"识别物类型:"+String.valueOf(mCloundWarningInfo.getType()));
pointsBetween();
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
isSelfLineClear = false;
@@ -95,8 +95,12 @@ public class V2XWarningMarker implements IV2XMarker {
drawRedWarningLineFrontOfStopLine(mCloundWarningInfo, middleLocationInStopLine, warningLocation);
//添加停止线marker
handleStopLine();
//自车画线
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
if (carLocation.lat != 0 && carLocation.lon != 0){
//自车画线
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}else {
Log.d(TAG,"自车定位数据为空carLocation == null");
}
}, 0);
UiThreadHandler.postDelayed(() -> {
@@ -114,7 +118,11 @@ public class V2XWarningMarker implements IV2XMarker {
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
V2XWarnDataDrawer.getInstance().renderWarnData(mCloundWarningInfo);
//车辆静止的时候
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
if (carLocation.lat != 0 && carLocation.lon != 0){
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
}else {
Log.d(TAG,"数据为空carLocation == null");
}
}, 0);
@@ -242,16 +250,15 @@ public class V2XWarningMarker implements IV2XMarker {
if (!isSelfLineClear) {
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
MogoLatLng startLatlng = null;
MogoLatLng endLatlng = null;
MogoLatLng addMiddleLoc = null;
MogoLatLng startLatlng = new MogoLatLng(0,0);
MogoLatLng endLatlng = new MogoLatLng(0,0);
MogoLatLng addMiddleLoc = new MogoLatLng(0,0);
if (!isFirstLocation) {
carLocation = getMogoLat(new MogoLatLng(lat, lon));
isFirstLocation = true;
}
//绘制线的终点(在停止线上或者预碰撞点上)
endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(),
mCloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon());
//自车位置