From 6fb89a2265fc9a62b3596e850c389eff41d0c091 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Tue, 13 Apr 2021 17:30:45 +0800 Subject: [PATCH] add vr judge --- .../impl/MoGoV2XCloundDataManager.java | 88 ++++++++++--------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java index 4ba2230b01..db6f53c4d2 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java @@ -51,49 +51,51 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog @Override public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) { - Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> "); - mCloundWarningInfo = cloundWarningInfo; - showTime = mCloundWarningInfo.getShowTime(); - pointsBetween(); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> "); + mCloundWarningInfo = cloundWarningInfo; + showTime = mCloundWarningInfo.getShowTime(); + pointsBetween(); - //预警蒙层 - MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING); - isSelfLineClear = false; - isFirstLocation = false; + //预警蒙层 + MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING); + isSelfLineClear = false; + isFirstLocation = false; - if (cloundWarningInfo.getDirection() == 1) { //前方 - MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle()); - //停止线前方画线 - WorkThreadHandler.getInstance().postDelayed(() -> { - //二轮车和行人的渲染和移动 - V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); - //绘制识别物与交汇点连线,并且更新连线数据 - drawStopLine(cloundWarningInfo, newLocation); - //添加停止线marker - handleStopLine(); - }, 600); + if (cloundWarningInfo.getDirection() == 1) { //前方 + MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle()); + //停止线前方画线 + WorkThreadHandler.getInstance().postDelayed(() -> { + //二轮车和行人的渲染和移动 + V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + //绘制识别物与交汇点连线,并且更新连线数据 + drawStopLine(cloundWarningInfo, newLocation); + //添加停止线marker + handleStopLine(); + }, 500); - UiThreadHandler.postDelayed(() -> { - V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - V2XServiceManager.getMoGoStopPolylineManager().clearLine(); - isSelfLineClear = true; - }, showTime); + UiThreadHandler.postDelayed(() -> { + V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); + V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + V2XServiceManager.getMoGoStopPolylineManager().clearLine(); + isSelfLineClear = true; + }, showTime); - } else { //左侧或者右侧 - WorkThreadHandler.getInstance().postDelayed(() -> { - //绘制识别物与交汇点连线,并且更新连线数据 - drawOtherObjectLine(cloundWarningInfo); - //二轮车和行人的渲染和移动 - V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); - }, 500); + } else { //左侧或者右侧 + WorkThreadHandler.getInstance().postDelayed(() -> { + //绘制识别物与交汇点连线,并且更新连线数据 + drawOtherObjectLine(cloundWarningInfo); + //二轮车和行人的渲染和移动 + V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + }, 500); - //延迟3秒清理线 - UiThreadHandler.postDelayed(() -> { - V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - isSelfLineClear = true; - }, showTime); + //延迟3秒清理线 + UiThreadHandler.postDelayed(() -> { + V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); + V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + isSelfLineClear = true; + }, showTime); + } } } @@ -191,11 +193,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog @Override public void onCarLocationChanged2(Location latLng) { // Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear); - //当行人经纬度交点 开始画线,否则清理 - if (mCloundWarningInfo != null) { - mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude())); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + //当行人经纬度交点 开始画线,否则清理 + if (mCloundWarningInfo != null) { + mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude())); + } + drawSlefCarLine(latLng); } - drawSlefCarLine(latLng); } @Override