From 0bb2fedd619e8fb680c43a9da971eefdd7f2b387 Mon Sep 17 00:00:00 2001 From: liujing Date: Fri, 9 Apr 2021 17:48:28 +0800 Subject: [PATCH] =?UTF-8?q?2D=E8=B5=84=E6=BA=90=E5=AE=9E=E7=8E=B0=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/MoGoV2XCloundDataManager.java | 40 +++++++++++++++++-- .../scene/warning/V2XWarningMarker.java | 1 - 2 files changed, 37 insertions(+), 4 deletions(-) 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 fa03c9630f..e9b15b4f78 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,10 +7,15 @@ 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; +import com.mogo.module.common.drawer.MarkerDrawer; import com.mogo.module.common.drawer.V2XWarnDataDrawer; +import com.mogo.module.common.drawer.marker.EmptyMarkerView; +import com.mogo.module.common.drawer.marker.SimpleWindow3DAdapter; import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.service.receiver.MogoReceiver; @@ -19,14 +24,17 @@ import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager; +import com.mogo.module.v2x.marker.V2XFrontTargetMarkerView; import com.mogo.module.v2x.utils.LocationUtils; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.ViewUtils; import com.mogo.utils.WorkThreadHandler; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import static com.mogo.module.v2x.V2XConst.V2X_FRONT_WARNING_MARKER; import static com.mogo.module.v2x.V2XServiceManager.getContext; /** @@ -68,7 +76,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog //绘制识别物与交汇点连线,并且更新连线数据 drawStopLine(cloundWarningInfo, newLocation); //添加停止线marker - handleStopLine(); + drawStopLineWith2Resource(); }, 200); UiThreadHandler.postDelayed(() -> { @@ -113,6 +121,32 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } } + /* + * 2D资源绘制停止线 + * */ + private void drawStopLineWith2Resource() { + mCloundWarningInfo.setCarLocation(new MogoLatLng(39.976866,116.417622));//测试数据 + MogoLatLng carlo = mCloundWarningInfo.getCarLocation(); + if (carlo == null){ + double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); + double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(); + carlo = new MogoLatLng(lat, lon); + } + MogoLatLng drawStopLineLon = LocationUtils.getNewLocation(carlo, mCloundWarningInfo.getStopLineDistance(), mCloundWarningInfo.getAngle()); + + MogoMarkerOptions optionsRipple = new MogoMarkerOptions() + .latitude(drawStopLineLon.getLat()) + .longitude(drawStopLineLon.getLon()) + .anchor(0.5f, 0.5f) + .zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH); + + optionsRipple + .icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext()))); + IMogoMarker stopLine = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple); + stopLine.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext()))); + stopLine.showInfoWindow(); + } + /** * 绘制停止线前方线 TODO 需要实时给行人当前位置 */ @@ -201,7 +235,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog /** * 绘制自车连线 */ - private void drawSlefCarLine (Location latLng) { + private void drawSlefCarLine(Location latLng) { if (!isSelfLineClear) { IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); if (mCloundWarningInfo != null) { @@ -262,7 +296,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog private MogoLatLng getMogoLat(MogoLatLng latlng) { MogoLatLng newLocation = LocationUtils.getNewLocation(latlng, mCloundWarningInfo.getDistance(), mCloundWarningInfo.getDirection()); - return newLocation; + return newLocation; } } 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 770099118b..2b44bef806 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 @@ -65,7 +65,6 @@ public class V2XWarningMarker implements IV2XMarker { } optionsRipple .icon(ViewUtils.fromView(new EmptyMarkerView(V2XServiceManager.getContext()))); -// optionsRipple.icon3DRes(com.mogo.module.common.R.raw.people); optimalMarker = V2XServiceManager.getMarkerManager().addMarker(V2X_FRONT_WARNING_MARKER, optionsRipple); optimalMarker.setInfoWindowAdapter(new SimpleWindow3DAdapter(new V2XFrontTargetMarkerView(V2XServiceManager.getContext()))); optimalMarker.showInfoWindow();