diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java index b666458f78..c5655e7cc7 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java @@ -735,6 +735,7 @@ public class ObjectUtils { } target.setLineWidth( options.getWidth() ); target.setColor( options.getColor() ); + target.setGps(options.gps()); // target.zIndex( options.getWidth() ); // target.visible( options.isVisible() ); //// target.geodesic( options.isGeodesic() ); 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 ed43f6c5fa..f3921c9ee1 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 @@ -58,7 +58,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog private MogoLatLng middleLocationInStopLine; private V2XFrontWarningScenario mV2XScenario; - private static long showTime = 0; + private static long showTime = 4000; private float bearing; @@ -70,70 +70,69 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog @Override public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) { -// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - mCloundWarningInfo = cloundWarningInfo; - showTime = mCloundWarningInfo.getShowTime(); - pointsBetween(); - bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing(); + if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { + mCloundWarningInfo = cloundWarningInfo; + showTime = mCloundWarningInfo.getShowTime(); + pointsBetween(); + bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing(); - //顶部弹框 - if (mV2XScenario == null) { - mV2XScenario = new V2XFrontWarningScenario(); - } - mV2XScenario.setWarningEntity(cloundWarningInfo); - mV2XScenario.init(null); - //预警蒙层 - MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING); - isSelfLineClear = false; - isFirstLocation = false; - V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS); - if (cloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO - middleLocationInStopLine = getMiddleLocationInStopLine(); - //如果是正前方类型,红色绘制区域从停止线向前绘制50米 - MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle()); - //停止线前方画线 - WorkThreadHandler.getInstance().postDelayed(() -> { - //二轮车和行人的渲染和移动 - V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA); - V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); - //绘制识别物与交汇点连线,并且更新连线数据 - drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation); - //添加停止线marker - handleStopLine(); - //自车画线 - drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); - }, 500); + //顶部弹框 + if (mV2XScenario == null) { + mV2XScenario = new V2XFrontWarningScenario(); + } + mV2XScenario.setWarningEntity(cloundWarningInfo); + mV2XScenario.init(null); + //预警蒙层 + MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING); + isSelfLineClear = false; + isFirstLocation = false; + V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS); + if (cloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO + middleLocationInStopLine = getMiddleLocationInStopLine(); + //如果是正前方类型,红色绘制区域从停止线向前绘制50米 + MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle()); + //停止线前方画线 + WorkThreadHandler.getInstance().postDelayed(() -> { + //二轮车和行人的渲染和移动 + V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA); + V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + //绘制识别物与交汇点连线,并且更新连线数据 + drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation); + //添加停止线marker + handleStopLine(); + //自车画线 + drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); + }, 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); - //二轮车和行人的渲染和移动 - V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA); - V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + } else { //左侧或者右侧 + WorkThreadHandler.getInstance().postDelayed(() -> { + //绘制识别物与交汇点连线,并且更新连线数据 + drawOtherObjectLine(cloundWarningInfo); + //二轮车和行人的渲染和移动 + V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA); + V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); - //车辆静止的时候 - drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); + //车辆静止的时候 + drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); - }, 500); + }, 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); + } } } -// } - /** * 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警) @@ -208,7 +207,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog /** * 场景如:车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置 */ - private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng startLatLng, MogoLatLng mogoLatLng) { + private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng + startLatLng, MogoLatLng mogoLatLng) { if (info != null) { IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline(); MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon); @@ -310,13 +310,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog @Override public void onCarLocationChanged2(Location latLng) { // Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 lat = " + latLng.getLatitude() + "--lon =" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear); -// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - //当行人经纬度交点 开始画线,否则清理 - 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())); + } + drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing()); } - drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing()); -// } carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()); } 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 19b04f09a7..891e86c408 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 @@ -1,7 +1,7 @@ { "type": 1, - "lat": 26.8824956, - "lon": 112.5634341, + "lat": 26.8825429, + "lon": 112.5634378, "distance": 2, "collisionLat": 26.88271105, "collisionLon": 112.5636347, 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 817e55ad07..b4f8a70913 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 @@ -1,7 +1,7 @@ { "type": 2, - "lat": 26.8825972, - "lon": 112.5634219, + "lat": 26.8825826, + "lon": 112.5633788, "distance": 2, "collisionLat": 26.8826135, "collisionLon": 112.5635520,