From 8e9655a564496cabe7205ebc6c8eae9c66a51cea Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 14 Apr 2021 12:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E6=96=B9=E8=AF=86=E5=88=AB=E7=89=A9?= =?UTF-8?q?=E4=B8=8E=E9=A2=84=E7=A2=B0=E6=92=9E=E7=82=B9=E4=B9=8B=E9=97=B4?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=AE=AD=E5=A4=B4marker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/drawer/V2XWarnDataDrawer.java | 13 ++++++++++++ .../impl/MoGoV2XCloundDataManager.java | 20 +++++++++++++++++-- 2 files changed, 31 insertions(+), 2 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 754728253a..a38db88df2 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 @@ -127,6 +127,19 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL return marker; } + public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location){ + MogoMarkerOptions options = new MogoMarkerOptions() + .object(markerShowEntity) + .latitude(location.getLat()) + .longitude(location.getLon()); + IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); + options.icon3DRes(getModelRes(2)); //TODO + + options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF + IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); + iMarkerView.setMarker(marker); + marker.setToTop(); + } /* * 2D资源绘制marker底部的红色圆圈 * */ 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 985807685d..882f35b916 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 @@ -11,6 +11,7 @@ import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.drawer.V2XWarnDataDrawer; +import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.common.utils.Trigonometric; import com.mogo.module.service.MarkerServiceHandler; @@ -119,7 +120,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } /** - * 绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置 + * 车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置 */ private void drawStopLine(V2XWarningEntity info, MogoLatLng mogoLatLng) { if (info != null) { @@ -153,7 +154,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog /** - * 目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置 + * 侧方目标物与预碰撞点连线,并且更新数据 TODO 需要实时给行人当前位置 */ private void drawOtherObjectLine(V2XWarningEntity info) { if (info != null) { @@ -185,6 +186,21 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } } + //侧面目标物与碰撞点之间添加多个小箭头 + private void addArrows(MogoLatLng startLatLng, MogoLatLng endLatLng) { + MarkerShowEntity markerShowEntity = new MarkerShowEntity(); + float distance = CoordinateUtils.calculateLineDistance( + startLatLng.lon, startLatLng.lat, endLatLng.lon, endLatLng.lat); + if (distance > 5) { + int count = (int) (distance / 5); + for (int i = 0; i < count; i++) { + MogoLatLng newLo = Trigonometric.getNewLocation( + startLatLng, 5 * i, mCloundWarningInfo.getAngle()); + V2XWarnDataDrawer.getInstance().drawerMarkerWithLocation(markerShowEntity, newLo); + } + } + } + @Override public void clearALLPOI() {