diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/AdasRecognizedType.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/AdasRecognizedType.java index 7758ceb9eb..4d130e0246 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/AdasRecognizedType.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/constants/AdasRecognizedType.java @@ -49,10 +49,10 @@ enum AdasRecognizedType { classIdMoto, classIdTrafficSign, classIdTrafficBus, + null, classIdTrafficTruck, classIdStopLine, classIdWarningArrows, - null, }; public String getRes() { diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java index 7ac3c2d469..81e9ad5495 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/BaseDrawer.java @@ -226,6 +226,10 @@ class BaseDrawer { } else if (recognizedType == AdasRecognizedType.classIdBicycle || recognizedType == AdasRecognizedType.classIdMoto) { return R.raw.motorbike; + } else if (recognizedType == AdasRecognizedType.classIdStopLine) { + return R.raw.stopline; + } else if (recognizedType == AdasRecognizedType.classIdWarningArrows) { + return R.raw.stopline; } return R.raw.people; } 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 630d9d5d2d..2c9ea61434 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 @@ -115,7 +115,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL .latitude(markerShowEntity.getMarkerLocation().getLat()) .longitude(markerShowEntity.getMarkerLocation().getLon()); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); - options.icon3DRes(getModelRes(2)); //TODO + options.icon3DRes(getModelRes(1)); //TODO options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); @@ -140,7 +140,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL * */ private IMogoMarker drawMarkerWith2Resource(MarkerShowEntity markerShowEntity) { MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon()); - MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180); + MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 7, 180); MogoMarkerOptions optionsRipple = new MogoMarkerOptions() .latitude(newLocation.getLat()) .longitude(newLocation.getLon()) @@ -184,7 +184,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL .latitude(markerShowEntity.getMarkerLocation().getLat()) .longitude(markerShowEntity.getMarkerLocation().getLon()); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); - options.icon3DRes(getModelRes(1)); //TODO + options.icon3DRes(getModelRes(9)); //TODO options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); diff --git a/modules/mogo-module-common/src/main/res/raw/motorbike.n3d b/modules/mogo-module-common/src/main/res/raw/motorbike.n3d index f3d91fc71f..8e1ca5958a 100644 Binary files a/modules/mogo-module-common/src/main/res/raw/motorbike.n3d and b/modules/mogo-module-common/src/main/res/raw/motorbike.n3d differ diff --git a/modules/mogo-module-common/src/main/res/raw/stopline.n3d b/modules/mogo-module-common/src/main/res/raw/stopline.n3d new file mode 100644 index 0000000000..b0e54efbb5 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/raw/stopline.n3d differ diff --git a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml index 081c757d2f..85a1f59d64 100644 --- a/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml +++ b/modules/mogo-module-main/src/main/res/drawable-xhdpi/module_main_warning_bkg_bottom.xml @@ -3,6 +3,6 @@ \ No newline at end of file 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 4de035fa78..1121442ca8 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 @@ -50,6 +50,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(), MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon() ); + /* + * 自车前方的点,在停止线上--通过自车位置与距离停止线之间的距离计算 + * */ private MogoLatLng middleLocationInStopLine; private V2XFrontWarningScenario mV2XScenario; @@ -86,13 +89,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog if (cloundWarningInfo.getDirection() == 1) { //前方 TODO middleLocationInStopLine = getMiddleLocationInStopLine(); - MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 30, cloundWarningInfo.getAngle()); + MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle()); //停止线前方画线 WorkThreadHandler.getInstance().postDelayed(() -> { //二轮车和行人的渲染和移动 V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); //绘制识别物与交汇点连线,并且更新连线数据 - drawStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation); + drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation); //添加停止线marker handleStopLine(); //自车画线 @@ -133,7 +136,9 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } } - + /* + * 停止线绘制 + * */ private void handleStopLine() { if (mCloundWarningInfo != null) { for (int i = 0; i < fillPoints.size(); i++) { @@ -152,7 +157,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog /** * 场景如:车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置 */ - private void drawStopLine(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); @@ -179,6 +184,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } } else { V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); + V2XServiceManager.getMoGoStopPolylineManager().clearLine(); } } @@ -192,7 +198,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());//识别物坐标 MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());//预碰撞点坐标 float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);//识别物到碰撞点之间的距离 - MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, mCloundWarningInfo.getAngle());//补点 + MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, + Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));//补点 if (polyLine != null) { Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null"); polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); @@ -282,7 +289,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog endLatlng = new MogoLatLng(mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lat : mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getDirection() == 1 ? middleLocationInStopLine.lon : mCloundWarningInfo.getCollisionLon()); float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat); - addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon,startLatlng.lat,endLatlng.lon,endLatlng.lat)); + addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat)); Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon + "中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);