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 23fd49041f..d30a11282e 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 @@ -47,6 +47,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog private static String TAG = "MoGoV2XCloundDataManager"; private boolean isSelfLineClear; private List fillPoints = new ArrayList();//停止线经纬度合集 + private static long showTime = 0; @Override public void init(Context context) { @@ -59,6 +60,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> "); mCloundWarningInfo = cloundWarningInfo; + showTime = mCloundWarningInfo.getShowTime(); pointsBetween(); //发送预警提示 @@ -68,10 +70,10 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog Log.d(V2XConst.LOG_NAME_WARN, "direction = " + cloundWarningInfo.getDirection()); if (cloundWarningInfo.getDirection() == 1) { //前方 - //停止线前方画线 MogoLatLng newLocation = LocationUtils.getNewLocation((MogoLatLng) fillPoints.get(0), 80, cloundWarningInfo.getAngle()); + //停止线前方画线 WorkThreadHandler.getInstance().postDelayed(() -> { - //添加停止线marker + //添加停止线 drawStopLineWith2Resource(); //二轮车和行人的渲染和移动 V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); @@ -84,7 +86,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); V2XServiceManager.getMoGoStopPolylineManager().clearLine(); isSelfLineClear = true; - }, 8000); + }, showTime); } else { //左侧或者右侧 WorkThreadHandler.getInstance().postDelayed(() -> { @@ -98,9 +100,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog UiThreadHandler.postDelayed(() -> { V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - isSelfLineClear = true; - }, 8000); + }, showTime); } } @@ -124,10 +125,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog * 2D资源绘制停止线 * */ private void drawStopLineWith2Resource() { - - //自车位置39.97665425796924--116.41769983329762 - mCloundWarningInfo.setCarLocation(new MogoLatLng(39.97665425796924,116.41769983329762));//测试数据 - MogoLatLng carlo = mCloundWarningInfo.getCarLocation(); if (carlo == null) { double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); @@ -136,11 +133,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } //自车行驶方向的前方*米的经纬度,该经纬度在停止线上 MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle()); - Log.d(TAG, "2D资源绘制停止线"+drawStopLineLon); + Log.d(TAG, "2D资源绘制停止线" + drawStopLineLon); MogoMarkerOptions optionsRipple = new MogoMarkerOptions() .latitude(drawStopLineLon.getLat()) .longitude(drawStopLineLon.getLon()) - .anchor(0.5f, 0.5f) + .anchor(1.0f, 1.0f) .zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH); optionsRipple @@ -148,9 +145,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(TYPE_MARKER_CLOUD_STOP_LINE_DATA, optionsRipple); stopLine.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext()))); stopLine.showInfoWindow(); -// UiThreadHandler.postDelayed(() -> { -// stopLine.hideInfoWindow(); -// }, 8000); + UiThreadHandler.postDelayed(() -> { + stopLine.hideInfoWindow(); + }, showTime); } /** @@ -302,7 +299,6 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog private MogoLatLng getMogoLat(MogoLatLng latlng) { MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection()); - return newLocation; } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index 6470241db7..c6b26b9c3a 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -24,6 +24,7 @@ import com.mogo.module.v2x.marker.OptimalSpeedMarkerView; import com.mogo.module.v2x.marker.V2XFrontTargetMarkerView; import com.mogo.module.v2x.scenario.view.IV2XMarker; import com.mogo.module.v2x.utils.LocationUtils; +import com.mogo.utils.UiThreadHandler; import com.mogo.utils.ViewUtils; import com.mogo.utils.WorkThreadHandler; @@ -65,6 +66,9 @@ public class V2XWarningMarker implements IV2XMarker { optimalMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple); optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(mContext))); optimalMarker.showInfoWindow(); + UiThreadHandler.postDelayed(() -> { + optimalMarker.hideInfoWindow(); + }, 8000); } catch (Exception e) { diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index 5963e668f3..62454570d9 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -20,9 +20,13 @@ "direction": 1, "speed": 11.108121, "targetColor": "#FF4040", - "stopLineDistance": 15, + "stopLineDistance": 20, "warningContent": "小心行人", "heading": 0, - "showTime": 3000, - "roadwidth": 60.0 + "showTime": 8000, + "roadwidth": 60.0, + "carLocation": { + "lat": 39.97665425, + "lon": 116.41769983 + } } \ No newline at end of file