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 4d130e0246..ac326ff0d9 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 @@ -42,7 +42,7 @@ enum AdasRecognizedType { } public static AdasRecognizedType[] VAL = { - classIdBackground, + classIdBackground,//0 classIdPerson, classIdBicycle, classIdCar, 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 81e9ad5495..960931c3cc 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 @@ -229,7 +229,7 @@ class BaseDrawer { } else if (recognizedType == AdasRecognizedType.classIdStopLine) { return R.raw.stopline; } else if (recognizedType == AdasRecognizedType.classIdWarningArrows) { - return R.raw.stopline; + return R.raw.arraw; } 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 31fc25fa4e..6bda8bd39e 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 @@ -125,12 +125,16 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL return marker; } - public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type) { + public void drawerArrowsMarkerWithLocation(MogoLatLng location, String markerType, int type, int rotate) { MogoMarkerOptions options = new MogoMarkerOptions() .latitude(location.getLat()) - .longitude(location.getLon()); - options.icon3DRes(getModelRes(type)); //TODO - options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF + .longitude(location.getLon()) + .set3DMode(true) + .controlAngle(true) + .rotate(rotate); + options.icon3DRes(getModelRes(type)); + options.flat(true); + options.anchorColor("#FB3C3CFF"); IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerType, options); marker.setToTop(); } diff --git a/modules/mogo-module-common/src/main/res/raw/arraw.n3d b/modules/mogo-module-common/src/main/res/raw/arraw.n3d new file mode 100644 index 0000000000..ba973b34b6 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/raw/arraw.n3d differ 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 39a0aec234..b3d5ab2c6c 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 @@ -7,6 +7,8 @@ import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.map.MogoLatLng; +import com.mogo.map.marker.IMogoMarker; +import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.module.common.MogoApisHandler; @@ -158,7 +160,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon); float distance = CoordinateUtils.calculateLineDistance(startLatLng.lon, startLatLng.lat, endLatlng.lon, endLatlng.lat); MogoLatLng addMiddleLoc = Trigonometric.getNewLocation(startLatLng, distance / 2, mCloundWarningInfo.getAngle()); - Log.d(V2XConst.LOG_NAME_WARN, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat + + Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat + "中间点坐标:" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点" + endLatlng.lon + "," + endLatlng.lat); if (polyLine != null) { @@ -224,13 +226,15 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) { float distance = CoordinateUtils.calculateLineDistance( startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); + double rotate = Trigonometric.getAngle(startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); Log.d(TAG, "添加小箭头--目标物与预碰撞点之间的距离是" + String.valueOf(distance)); if (distance > 5) { int count = (int) (distance / 5); - for (int i = 0; i < count - 1; i++) { + for (int i = 0; i < count; i++) { MogoLatLng newLo = Trigonometric.getNewLocation( - startLatLng, 5 * (i + 1), 120); - V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10); + startLatLng, 5 * (i + 1), Trigonometric.getAngle(startLatLng.lon,startLatLng.lat,endLatLng.lon,endLatLng.lat)); + Log.d(TAG, "小箭头位置" + newLo); + V2XWarnDataDrawer.getInstance().drawerArrowsMarkerWithLocation(newLo, WARNING_ARROWS, 10, new Double(rotate).intValue()); } } //延迟3秒清理线 diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml index 5c509e9eeb..ce3007152d 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml @@ -482,7 +482,7 @@ android:layout_marginBottom="@dimen/dp_10" android:background="#8BC34A" android:padding="@dimen/dp_10" - android:text="adas预警数据发送" + android:text="车路云场景预警" android:textColor="#FFFFFF" android:textSize="@dimen/dp_22" app:layout_constraintBottom_toBottomOf="parent" 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 dd781a966a..0333d06e79 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": 1, + "direction": 2, "speed": 11.108121, "targetColor": "#FF4040", "stopLineDistance": 60,