From 1a8e8663e1d00801a40beb07fd0cfcd70b770196 Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 12 May 2021 18:20:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BD=A6=E8=B7=AF=E4=BA=91=E9=A2=84=E8=AD=A6-?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E6=97=B6=E9=97=B4;=E4=B8=AD=E6=99=AF?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=83=A8=E5=88=86=E4=BB=A3=E7=A0=81=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0(=E6=9C=AA=E5=AE=8C=E6=88=90)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/drawer/V2XWarnDataDrawer.java | 8 +------ .../v2x/scenario/impl/V2XScenarioManager.java | 14 ++++++++++++ .../scene/warning/V2XWarningMarker.java | 22 ++++++++++++------- .../raw/scenario_warning_event_data_left.json | 2 +- ...enario_warning_event_data_pedestrians.json | 2 +- .../scenario_warning_event_data_right.json | 2 +- 6 files changed, 32 insertions(+), 18 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java index 9fa7c928fe..9b84d3463c 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/V2XWarnDataDrawer.java @@ -94,7 +94,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL //移动完成以后,3s后消失 UiThreadHandler.postDelayed(() -> { marker.remove(); - }, 8000); + }, data.getShowTime()); } @@ -180,13 +180,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL MarkerShowEntity markerShowEntity = new MarkerShowEntity(); markerShowEntity.setMarkerLocation(location); markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_STOP_LINE_DATA); - IMogoMarker marker = drawStopLineMarker(markerShowEntity); - //移动完成以后,3s后消失 - UiThreadHandler.postDelayed(() -> { - marker.remove(); - }, 8000); } @@ -205,7 +200,6 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); iMarkerView.setMarker(marker); marker.setToTop(); - return marker; } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java index de2c7fc936..dd8ac647b1 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java @@ -4,6 +4,8 @@ import android.content.Intent; import androidx.localbroadcastmanager.content.LocalBroadcastManager; +import com.mogo.map.uicontroller.VisualAngleMode; +import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.entity.V2XMessageEntity; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; @@ -63,6 +65,7 @@ public class V2XScenarioManager implements IV2XScenarioManager { V2XUtils.runOnUiThread(() -> { // 提取之前存储的场景 if (v2XMessageEntity != null) { + sceneChange(); // 广播给应用内部其它模块 Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION); intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); @@ -138,6 +141,17 @@ public class V2XScenarioManager implements IV2XScenarioManager { } } + /** + * http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52833468 + * 道路事件触发后,切换到中景 + */ + private void sceneChange() { + if (MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController(). + getCurrentMapVisualAngle() != VisualAngleMode.MODE_MEDIUM_SIGHT) { + V2XServiceManager.getMapService().getMapUIController().changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT); + } + } + private void hidOtherPanel() { try { // 与其它面板互斥 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 4cb25d0aa2..78d610c64e 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 @@ -68,7 +68,7 @@ public class V2XWarningMarker implements IV2XMarker { * 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算 * */ private MogoLatLng middleLocationInStopLine; - private static long showTime = 4000; + private static long showTime = 5000; private float bearing; @Override @@ -78,13 +78,14 @@ public class V2XWarningMarker implements IV2XMarker { drawLineWithEntity(); } catch (Exception e) { - Log.d(TAG,e.toString()); + Log.d(TAG, e.toString()); } } public void drawLineWithEntity() { - showTime = mCloundWarningInfo.getShowTime(); + showTime = mCloundWarningInfo.getShowTime() > 0 ? mCloundWarningInfo.getShowTime() : 5000; + Log.d(TAG, "显示时间为++" + String.valueOf(showTime)); pointsBetween(); bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing(); //预警蒙层 @@ -107,7 +108,7 @@ public class V2XWarningMarker implements IV2XMarker { handleStopLine(); //自车画线 drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); - }, 500); + }, 0); UiThreadHandler.postDelayed(() -> { V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); @@ -127,7 +128,7 @@ public class V2XWarningMarker implements IV2XMarker { //车辆静止的时候 drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); - }, 500); + }, 0); //延迟3秒清理线 UiThreadHandler.postDelayed(() -> { @@ -217,6 +218,10 @@ public class V2XWarningMarker implements IV2XMarker { V2XWarnDataDrawer.getInstance().renderStopLineData(entity); } } + //移动完成以后,3s后消失 + UiThreadHandler.postDelayed(() -> { + V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_STOP_LINE_DATA); + }, mCloundWarningInfo.getShowTime()); } catch (Exception e) { e.printStackTrace(); } @@ -231,8 +236,8 @@ public class V2XWarningMarker implements IV2XMarker { * 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算 * */ private MogoLatLng getMiddleLocationInStopLine() { - Log.d(TAG, "计算停止线上的某个点"+String.valueOf(carLocation.lat+","+String.valueOf(carLocation.lon))); - if (carLocation.lat == 0 || carLocation.lon == 0){ + Log.d(TAG, "计算停止线上的某个点" + String.valueOf(carLocation.lat + "," + String.valueOf(carLocation.lon))); + if (carLocation.lat == 0 || carLocation.lon == 0) { Log.d(TAG, "获取不到车的位置"); } MogoLatLng newLocation = Trigonometric.getNewLocation(carLocation, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle()); @@ -341,6 +346,7 @@ public class V2XWarningMarker implements IV2XMarker { } //延迟3秒清理线 UiThreadHandler.postDelayed(() -> { + V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS); }, showTime); @@ -372,7 +378,7 @@ public class V2XWarningMarker implements IV2XMarker { stopLine.showInfoWindow(); UiThreadHandler.postDelayed(() -> { stopLine.hideInfoWindow(); - }, 8000); + }, showTime); } public void onCarLocationChanged2(Location latLng) { diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json index a296b7fb70..e40d1ca509 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_left.json @@ -23,6 +23,6 @@ "stopLineDistance": 60, "warningContent": "注意自行车", "heading": 0, - "showTime": 8000, + "showTime": 5000, "roadwidth": 4.0 } \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json index e47038e955..d5f3806969 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json @@ -24,6 +24,6 @@ "stopLineDistance": 60, "warningContent": "小心行人", "heading": 0, - "showTime": 8000, + "showTime": 5000, "roadwidth": 4.0 } \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_right.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_right.json index 9b504b7dd9..e48d85967e 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_right.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_right.json @@ -23,6 +23,6 @@ "stopLineDistance": 60, "warningContent": "注意摩托车", "heading": 0, - "showTime": 8000, + "showTime": 5000, "roadwidth": 4.0 }