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 18aa0d0e0e..4de035fa78 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 @@ -25,6 +25,7 @@ import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.listener.V2XLocationListener; import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager; +import com.mogo.module.v2x.scenario.scene.warning.V2XFrontWarningScenario; import com.mogo.utils.UiThreadHandler; import com.mogo.utils.WorkThreadHandler; @@ -50,10 +51,12 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon() ); private MogoLatLng middleLocationInStopLine; + private V2XFrontWarningScenario mV2XScenario; private static long showTime = 0; private float bearing; + @Override public void init(Context context) { MogoApisHandler.getInstance().getApis().getRegisterCenterApi() @@ -69,12 +72,19 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog pointsBetween(); bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing(); + //顶部弹框 + if (mV2XScenario == null) { + mV2XScenario = new V2XFrontWarningScenario(); + } + mV2XScenario.setWarningEntity(cloundWarningInfo); + mV2XScenario.init(null); + //预警蒙层 MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getType(), MogoReceiver.ACTION_V2X_FRONT_WARNING); isSelfLineClear = false; isFirstLocation = false; - if (cloundWarningInfo.getDirection() == 1) { //前方 + if (cloundWarningInfo.getDirection() == 1) { //前方 TODO middleLocationInStopLine = getMiddleLocationInStopLine(); MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 30, cloundWarningInfo.getAngle()); //停止线前方画线 @@ -164,7 +174,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog lineInfo.setLocations(locations); lineInfo.setHeading(info.heading); Log.d(V2XConst.LOG_NAME_WARN, "drawStopLine width = " + info.getRoadwidth()); - lineInfo.setWidth(info.getRoadwidth() * 13 + 5); + lineInfo.setWidth(info.getRoadwidth() * 14 + 5); V2XServiceManager.getMoGoStopPolylineManager().drawStopPolyline(getContext(), lineInfo); } } else { @@ -197,7 +207,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog lineInfo.setLocations(locations); lineInfo.setHeading(info.heading); Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth()); - lineInfo.setWidth(info.getRoadwidth() * 13 + 5); + lineInfo.setWidth(info.getRoadwidth() * 14 + 5); V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo); //识别物到预碰撞点之间的箭头 addArrows(startLatlng, endLatlng); @@ -252,13 +262,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog @Override public void onCarLocationChanged(MogoLatLng latLng) { - Log.d("liyz", "latLng -- lon = " + latLng.lon + "----lat = " + latLng.lat); } /** * 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == 1 自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警) */ private void drawSlefCarLine(double lon, double lat, float bearing) { +// Log.d("liyz", "-------1-------- isSelfLineClear = " + isSelfLineClear + "--lon =" + lon + "---lat = " + lat"); if (!isSelfLineClear) { IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); if (mCloundWarningInfo != null) { @@ -278,10 +288,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog "中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat); isFirstLocation = true; } + if (mogoPolyline != null) { +// Log.d("liyz", "-------2-------- lon =" + lon + "---lat = " + lat); mogoPolyline.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); mogoPolyline.setTransparency(0.5f); } else { +// Log.d("liyz", "-------3-------- lon =" + lon + "---lat = " + lat); DrawLineInfo info = new DrawLineInfo(); // 对象 Log.d(TAG, "安全区域的画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); List locations = new ArrayList(); @@ -290,7 +303,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog locations.add(endLatlng); info.setLocations(locations); info.setHeading(bearing); - info.setWidth(mCloundWarningInfo.getRoadwidth() * 13 + 5); + info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5); info.setDirection(mCloundWarningInfo.getDirection()); V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info); } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java index d8031e5759..7245f74035 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java @@ -54,8 +54,15 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV @Override public void init(@Nullable V2XMessageEntity v2XMessageEntity) { try { - if (v2XMessageEntity != null && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { - mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent(); + if (v2XMessageEntity != null) { + if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { + mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent(); + direction = mMarkerEntity.getDirection(); + MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING); + show(); + drawPOI(); + } + } else { direction = mMarkerEntity.getDirection(); MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING); show(); @@ -66,6 +73,10 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV } } + public void setWarningEntity(V2XWarningEntity markerEntity) { + mMarkerEntity = markerEntity; + } + @Override public void show() { showWindow(); 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 0333d06e79..dd781a966a 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 @@ -17,7 +17,7 @@ ], "from": 1, "angle": 0, - "direction": 2, + "direction": 1, "speed": 11.108121, "targetColor": "#FF4040", "stopLineDistance": 60,