From 1de59f0753ccca5ae7b3f05730bad7912157452b Mon Sep 17 00:00:00 2001 From: lianglihui Date: Sun, 28 Nov 2021 16:34:51 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E5=89=8D=E8=BD=A6=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E7=BA=BF=20=E8=B0=83=E6=95=B4=E5=BC=95=E5=AF=BC=E7=BA=BF?= =?UTF-8?q?=E7=9A=84index=20=E5=88=B010000f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/module/service/routeoverlay/RouteOverlayDrawer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java index 7513682bc7..8063bc1913 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java @@ -30,6 +30,7 @@ public class RouteOverlayDrawer { private RouteOverlayDrawer(Context context) { mPolylineOptions = new MogoPolylineOptions(); + mPolylineOptions.zIndex(10000f); // 绘制路径集合 mPolylinePointList = new ArrayList<>(); // 引导线颜色 @@ -130,7 +131,6 @@ public class RouteOverlayDrawer { mPolylinePointList.add(latLng); } mPolylineOptions.setGps(true); - mPolylineOptions.zIndex(10000f); mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size())); // 替换路径集合 mPolylineOptions.points(mPolylinePointList); From 0b66920dd908dec0e339ff75dc3a107d9ad32e4d Mon Sep 17 00:00:00 2001 From: lianglihui Date: Sun, 28 Nov 2021 16:51:53 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E5=89=8D=E8=BD=A6=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E7=BA=BF=20=E5=A2=9E=E5=8A=A0=E7=BB=98=E5=88=B6line=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E5=B1=82=E7=BA=A7=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/mogo/map/impl/custom/utils/ObjectUtils.java | 1 + 1 file changed, 1 insertion(+) 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 5de9c4a3cd..1a868e2d8f 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 @@ -732,6 +732,7 @@ public class ObjectUtils { target.lonLatPoints( points ); } target.setLineWidth( options.getWidth() ); + target.zIndex(options.getZIndex()); target.setColor( options.getColor() ); target.useGradient( options.isGradient() ); if ( options.getColorValues() != null ) { From 683aae244481e95935c959e1b9465963a2c9fd3d Mon Sep 17 00:00:00 2001 From: donghongyu Date: Sun, 28 Nov 2021 19:26:45 +0800 Subject: [PATCH 03/11] =?UTF-8?q?[Add]=20=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?=E8=87=AA=E8=BD=A6=E5=AE=9A=E4=BD=8D=E6=97=A5=E5=BF=97=E8=BE=93?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- .../CallerAutopilotCarStatusListenerManager.kt | 8 +++++--- .../call/map/CallerMapLocationListenerManager.kt | 2 ++ .../com/mogo/map/impl/custom/AMapViewWrapper.java | 6 ++++-- .../map/impl/custom/location/ALocationClient.java | 2 ++ .../com/mogo/module/adas/OnAdasListenerAdapter.java | 12 ++++++------ 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt index 79a0f790ff..045f9e9e3c 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutopilotCarStatusListenerManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.call.autopilot +import android.util.Log import androidx.annotation.Nullable import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarStateListener @@ -17,7 +18,7 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() { // 存储所有注册了监听的对象,invokeXXXX进行遍历回调,将信息同步 private val M_AUTOPILOT_STATUS_LISTENERS: ConcurrentHashMap = - ConcurrentHashMap() + ConcurrentHashMap() /** @@ -26,8 +27,8 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() { * @param listener 监听回调 */ fun addListener( - @Nullable tag: String, - @Nullable listener: IMoGoAutopilotCarStateListener + @Nullable tag: String, + @Nullable listener: IMoGoAutopilotCarStateListener ) { if (M_AUTOPILOT_STATUS_LISTENERS.containsKey(tag)) { LogUtils.eTag(TAG, "Tag:$tag already exists,please use other tag") @@ -67,6 +68,7 @@ object CallerAutopilotCarStatusListenerManager : CallerBase() { @Synchronized fun invokeAutopilotCarStateData(autoPilotCarStateInfo: AutopilotCarStateInfo?) { //LogUtils.dTag(TAG, "$autoPilotCarStateInfo") + //Log.w("DHY-location", "${autoPilotCarStateInfo?.values?.lon},${autoPilotCarStateInfo?.values?.lat} CallerAutopilotCarStatusListenerManager-invokeAutopilotCarStateData") M_AUTOPILOT_STATUS_LISTENERS.forEach { val tag = it.key val listener = it.value diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt index 71cab938a2..fcbb46228a 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapLocationListenerManager.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.call.map +import android.util.Log import androidx.annotation.Nullable import com.mogo.eagle.core.data.map.MogoLocation import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener @@ -87,6 +88,7 @@ object CallerMapLocationListenerManager : CallerBase() { */ fun invokeMapLocationChangeListener(location: MogoLocation?) { //LogUtils.dTag(TAG, "mapStyleMode:$location") + Log.w("DHY-location", "${location?.longitude},${location?.latitude} CallerMapLocationListenerManager-invokeMapLocationChangeListener") mLocation = location mMapStyleChangeListeners.forEach { val tag = it.key diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 24d223f968..4d2703d868 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -29,6 +29,7 @@ import com.mogo.eagle.core.function.call.map.CallerLocationUpdaterManager; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager; import com.mogo.eagle.core.utilcode.mogo.toast.TipToast; +import com.mogo.eagle.core.utilcode.util.GsonUtils; import com.mogo.map.IMogoMap; import com.mogo.map.IMogoMapView; import com.mogo.map.impl.custom.navi.NaviClient; @@ -750,6 +751,7 @@ public class AMapViewWrapper implements IMogoMapView, @Override public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) { + Log.w("DHY-location", location.getLon() + "," + location.getLat() + " AMapViewWrapper-onLocationChanged:"); MogoLocation mLastLocation = ObjectUtils.fromLocation(location); UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation)); @@ -788,7 +790,7 @@ public class AMapViewWrapper implements IMogoMapView, } else { mIsFirstLocated = true; mIsDelayed = false; - Logger.d(TAG, "同步定位"); + Logger.d(TAG, "同步定位:" + GsonUtils.toJson(location)); MapStyleController.getInstance().onLocationChanged(location, this); } } @@ -797,8 +799,8 @@ public class AMapViewWrapper implements IMogoMapView, try { mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker(); mSelfMarker.setInfoWindowEnable(true); - } catch (Exception e) { + e.printStackTrace(); } } else { // 通过不同的方向类型来改变车模,目前暂定三种模型,drawlevel 1 绿,2 黄,3 红,绿色的时候需要把相应的切换为默认模型 diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java index 6e00a0fd97..fce687b201 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/location/ALocationClient.java @@ -2,6 +2,7 @@ package com.mogo.map.impl.custom.location; import android.content.Context; import android.os.Trace; +import android.util.Log; import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.map.impl.custom.utils.ObjectUtils; @@ -113,6 +114,7 @@ public class ALocationClient implements IMogoLocationClient { @Override public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) { + Log.w("DHY-location", location.getLon() + "," + location.getLat() + " ALocationClient-onLocationChanged"); if ( mIsDestroyed ) { destroyWarming(); return; diff --git a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/OnAdasListenerAdapter.java b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/OnAdasListenerAdapter.java index 3cdab38a1d..3e8a93fab4 100644 --- a/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/OnAdasListenerAdapter.java +++ b/modules/mogo-module-adas/src/main/java/com/mogo/module/adas/OnAdasListenerAdapter.java @@ -2,7 +2,6 @@ package com.mogo.module.adas; import android.util.Log; -import com.mogo.commons.AbsMogoApplication; import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo; import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo; import com.mogo.eagle.core.data.autopilot.AutopilotGuardianStatusInfo; @@ -10,14 +9,12 @@ import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.autopilot.AutopilotWarnMessage; -import com.mogo.eagle.core.data.constants.MoGoConfig; import com.mogo.eagle.core.data.traffic.TrafficData; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; import com.mogo.utils.logger.Logger; -import com.mogo.utils.storage.SharedPrefsMgr; import com.zhidao.support.adas.high.AdasManager; import com.zhidao.support.adas.high.OnAdasListener; import com.zhidao.support.adas.high.bean.AutopilotRoute; @@ -45,7 +42,7 @@ import java.util.List; public class OnAdasListenerAdapter implements OnAdasListener { private final String TAG = "OnAdasListenerAdapter"; - + @Override public void onRectData(RectInfo rectInfo) { ArrayList recognizedListResults = AdasObjectUtils.INSTANCE.regroupTrafficDataData(rectInfo.getModels()); @@ -56,10 +53,10 @@ public class OnAdasListenerAdapter implements OnAdasListener { @Override public void onCarStateData(CarStateInfo carStateInfo) { Logger.d(TAG, "--------carStateInfo.toString() = " + carStateInfo.toString()); - AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo); - CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo); //can数据转发 CarStateInfo.ValuesBean bean = carStateInfo.getValues(); + Log.w("DHY-location", bean.getLon() + "," + bean.getLat() + " OnAdasListenerAdapter-onCarStateData:"); + if (bean != null) { int turn_light = bean.getTurn_light(); //转向灯状态 0是正常 1是左转 2是右转 Logger.d(TAG, "onCarStateData ---- turn_light = " + turn_light); @@ -67,6 +64,9 @@ public class OnAdasListenerAdapter implements OnAdasListener { } else { Logger.e(TAG, "bean == null "); } + + AutopilotCarStateInfo autopilotCarStateInfo = AdasObjectUtils.INSTANCE.fromAdasCarStateInfoObject(carStateInfo); + CallerAutopilotCarStatusListenerManager.INSTANCE.invokeAutopilotCarStateData(autopilotCarStateInfo); } @Override From 7c85f8355b8c975eef7e326248b64435952b9b6d Mon Sep 17 00:00:00 2001 From: donghongyu Date: Mon, 29 Nov 2021 14:34:08 +0800 Subject: [PATCH 04/11] =?UTF-8?q?[Add]=20=E4=B8=B4=E6=97=B6=E5=85=B3?= =?UTF-8?q?=E9=97=ADOBU=E7=BB=98=E5=88=B6=E6=84=9F=E7=9F=A5=E8=BD=A6?= =?UTF-8?q?=E8=BE=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: donghongyu --- app/proguard-rules.pro | 2 +- .../java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 5fb51b1544..5da3d57d2c 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -424,7 +424,7 @@ -keep class org.conscrypt.HandshakeListener{*;} -keep class org.conscrypt.BufferAllocator{*;} -keep class com.squareup.haha.guava.collect.*{*;} - +-keep class **.zego.**{*;} diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt index 64c6977d7b..bdadc0aa11 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/drawer/TrafficMarkerDrawer.kt @@ -44,7 +44,8 @@ object TrafficMarkerDrawer { object : Handler(WorkThreadHandler.newInstance("other_traffic_drawer").looper) { override fun handleMessage(msg: Message) { super.handleMessage(msg) - drawerTrafficInfo() + // TODO 因为与自动驾驶的感知重合,临时关掉OBU车辆绘制 + // drawerTrafficInfo() // 延时50毫秒重复发送自己,定时轮询进行车辆绘制,可以及时将已经不存在车辆删除 sendEmptyMessageDelayed(0, 50L) } From 096b10136325693941b61187384100e8895e1537 Mon Sep 17 00:00:00 2001 From: lianglihui Date: Mon, 29 Nov 2021 16:41:21 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E5=89=8D=E8=BD=A6=E5=BC=95=E5=AF=BC?= =?UTF-8?q?=E7=BA=BF=20=E4=BF=AE=E6=94=B9line=E7=BB=98=E5=88=B6zindex?= =?UTF-8?q?=E4=B8=BA20000?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mogo/module/service/routeoverlay/RouteOverlayDrawer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java index 8063bc1913..03560d8f22 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/RouteOverlayDrawer.java @@ -30,7 +30,7 @@ public class RouteOverlayDrawer { private RouteOverlayDrawer(Context context) { mPolylineOptions = new MogoPolylineOptions(); - mPolylineOptions.zIndex(10000f); + mPolylineOptions.zIndex(20000f); // 绘制路径集合 mPolylinePointList = new ArrayList<>(); // 引导线颜色 From 221c8bdbaed40467ae43089f7e540f1161b46698 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Mon, 29 Nov 2021 16:57:19 +0800 Subject: [PATCH 06/11] fixed topview null --- .../utils/TopViewNoLinkageAnimHelper.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java index 4c2822fea3..d6789edd09 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/utils/TopViewNoLinkageAnimHelper.java @@ -150,16 +150,18 @@ public class TopViewNoLinkageAnimHelper { public void removeAllView() { Logger.d(TAG, "remove all view"); isTopViewOut = true; - int lastCount = topContainerNoLinkage.getChildCount(); - for (int i = 0; i < lastCount; i++) { - View child = topContainerNoLinkage.getChildAt(i); - IMogoTopViewStatusListener listener = statusListenerMap.remove(child); - if (listener != null) { - listener.beforeViewRemoveAnim(child); - listener.onViewRemoved(child); + if (topContainerNoLinkage != null) { + int lastCount = topContainerNoLinkage.getChildCount(); + for (int i = 0; i < lastCount; i++) { + View child = topContainerNoLinkage.getChildAt(i); + IMogoTopViewStatusListener listener = statusListenerMap.remove(child); + if (listener != null) { + listener.beforeViewRemoveAnim(child); + listener.onViewRemoved(child); + } } + topContainerNoLinkage.removeAllViews(); } - topContainerNoLinkage.removeAllViews(); MapCenterPointStrategy.setMapCenterPointByScene(mogoMapUIController, Scene.AIMLESS); } From 9983a817df0e927faa9bbe5a5ee0f4121d002ece Mon Sep 17 00:00:00 2001 From: lianglihui Date: Mon, 29 Nov 2021 17:15:59 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E4=BA=A4=E8=AD=A6=E8=B0=83=E5=BA=A6=20?= =?UTF-8?q?=E5=B0=86=E8=B0=83=E5=BA=A6=E5=9D=90=E6=A0=87=E8=BD=AC=E6=8D=A2?= =?UTF-8?q?=E4=B8=BAwgs84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/hmi/ui/notice/NoticeTrafficDialog.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java index 01f75b5c54..c11ff09f3f 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/notice/NoticeTrafficDialog.java @@ -12,6 +12,7 @@ import androidx.lifecycle.LifecycleObserver; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.StaggeredGridLayoutManager; +import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters; import com.mogo.eagle.core.data.notice.NoticeTrafficStyleInfo; @@ -177,12 +178,14 @@ public class NoticeTrafficDialog extends BaseFloatDialog implements LifecycleObs AutopilotControlParameters parameters = new AutopilotControlParameters(); parameters.isSpeakVoice = false; parameters.vehicleType = 10; + //云平台使用的是火星坐标,自动驾驶需要wgs84 + double[] gcj02 = CoordinateUtils.transformGcj02toWgs84(mTrafficStyleInfo.getLat(),mTrafficStyleInfo.getLon()); AutopilotControlParameters.AutoPilotLonLat startLocation = new AutopilotControlParameters.AutoPilotLonLat (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(), MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat()); parameters.startLatLon = startLocation; AutopilotControlParameters.AutoPilotLonLat endLocation = new AutopilotControlParameters.AutoPilotLonLat - (mTrafficStyleInfo.getLon(), mTrafficStyleInfo.getLat()); + (gcj02[0],gcj02[1]); parameters.endLatLon = endLocation; CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters); } From c262c9fcfb2a8015b6632769e80fcd24d5793922 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Mon, 29 Nov 2021 18:50:51 +0800 Subject: [PATCH 08/11] =?UTF-8?q?[Fix]=E8=B7=AF=E4=BE=A7=E6=91=84=E5=83=8F?= =?UTF-8?q?=E5=A4=B4=E7=9B=B4=E6=92=AD=E8=BF=99=E4=B8=80=E5=A5=97=E6=96=B9?= =?UTF-8?q?=E6=A1=88=E4=B8=B4=E6=97=B6=E4=B8=AD=E6=96=AD=E5=86=8D=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E7=BD=91=E7=BB=9C=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/function/hmi/ui/camera/CameraListView.kt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt index fcc51df921..ccaf2b79c6 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/camera/CameraListView.kt @@ -148,13 +148,18 @@ class CameraListView : FrameLayout { Logger.d(TAG, "onPlayEvent: event is:$event") when (event) { SimpleVideoPlayer.PLAY_EVT_PLAY_LOADING -> { - + // 会出现临时中断后又可以继续播放,需要停掉倒计时 + if (valueAnimator.isStarted || valueAnimator.isRunning) { + valueAnimator.cancel() + } } SimpleVideoPlayer.PLAY_EVT_PLAY_BEGIN -> { - clickListener?.onShowLive(true) - progressBar.visibility = View.GONE - svpPlayer.visibility = View.VISIBLE - isPlaySuccess = true + if (!isFirstPage && !isCarLive()) { + clickListener?.onShowLive(true) + progressBar.visibility = View.GONE + svpPlayer.visibility = View.VISIBLE + isPlaySuccess = true + } } else -> { Logger.w(TAG, "播放视频异常,event is:$event") From ba47f45a9a37e2a0e315f64dcd840be1b3916b18 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Mon, 29 Nov 2021 18:52:05 +0800 Subject: [PATCH 09/11] =?UTF-8?q?[Fix]=E7=94=B1=E4=BA=8E=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E4=B8=8D=E5=87=86=EF=BC=8C=E5=BE=AE=E8=B0=83=E4=BA=86=E4=B8=8B?= =?UTF-8?q?=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 多报出错不如少报但正确 --- .../redlightwarning/RedLightWarningManager.kt | 91 ++++++++++++++----- 1 file changed, 67 insertions(+), 24 deletions(-) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index fafd9c6d4e..a512f5a423 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -1,15 +1,18 @@ package com.mogo.eagle.core.function.v2x.redlightwarning +import android.location.Location +import com.mogo.eagle.core.data.map.MogoLatLng import com.mogo.eagle.core.data.trafficlight.* import com.mogo.eagle.core.data.trafficlight.TrafficLightStatusHelper.getCurrentRoadTrafficLight import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener import com.mogo.eagle.core.function.api.vip.IMoGoVipSetListener import com.mogo.eagle.core.function.call.hmi.CallerHmiManager -import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager import com.mogo.eagle.core.function.call.trafficlight.CallTrafficLightListenerManager import com.mogo.eagle.core.function.call.vip.CallVipSetListenerManager -import com.mogo.eagle.core.utilcode.util.SPUtils +import com.mogo.eagle.core.function.v2x.vip.VipCarManager import com.mogo.eagle.core.utilcode.util.ThreadUtils +import com.mogo.map.navi.IMogoCarLocationChangedListener2 +import com.mogo.module.common.MogoApisHandler import com.mogo.module.common.enums.EventTypeEnum import com.mogo.utils.logger.Logger import kotlin.math.abs @@ -17,14 +20,19 @@ import kotlin.math.ceil import kotlin.math.floor -class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener { +class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, + IMogoCarLocationChangedListener2 { private var vip: Boolean = false + // 是否第一次进入道路100m处 private var isFirst = true + // 是否已进入到路口(停止线处) private var isEnter = false + private var mLocation: Location? = null + companion object { const val TAG = "RedLightWarningManager" @@ -35,10 +43,11 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener { } override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { + // 到路口100m时回调 Logger.d(TAG, "处理路口交通数据:是否是第一次处理:${isFirst}是否进入路口:${isEnter}") if (isFirst && !isEnter) { getCurrentRoadTrafficLight(trafficLightResult)?.let { - handleRedLightWarning(it, trafficLightResult.flashYellow) + handleRedLightWarning(it, trafficLightResult) } isFirst = false } @@ -59,36 +68,57 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener { fun listenTrafficLight() { CallTrafficLightListenerManager.registerEnterCrossRoadListener(TAG, this) CallTrafficLightListenerManager.registerTrafficLightListener(TAG, this) + MogoApisHandler.getInstance().apis.registerCenterApi.registerCarLocationChangedListener( + VipCarManager.TAG, + this + ) CallVipSetListenerManager.registerVipSetListener(TAG, this) } - private fun handleRedLightWarning(trafficLightStatus: TrafficLightStatus, yellowLightTime: Int = 0) { + private fun handleRedLightWarning( + trafficLightStatus: TrafficLightStatus, + trafficLightResult: TrafficLightResult + ) { // 如果是Vip则不处理 if (vip) { Logger.w(TAG, "Vip用户不处理闯红灯、绿灯通行预警逻辑!") return } // 路口100m闯红灯预警 - CallerMapLocationListenerManager.getCurrentLocation()?.let { + mLocation?.let { // 单位m/s val speed = it.speed // 车停止或者速度非常慢,可能返回负数或者很小的值,需要过滤 + Logger.d(TAG, "speed is:$speed") if (speed <= 2.5f) return// 小于等于9km/h不处理 - val distance = 100 + // 由于到路口100m时回调不准,手动计算直线距离 + val distance = MogoApisHandler.getInstance().apis.mapServiceApi + .mapUIController.calculateLineDistance( + MogoLatLng(it.latitude, it.longitude), + MogoLatLng(trafficLightResult.lat, trafficLightResult.lon) + ) + Logger.d( + TAG, + "路口经度为:${trafficLightResult.lon},纬度为:${trafficLightResult.lat};车的经度为:${it.longitude},纬度为:${it.latitude};两点距离为:${distance}" + ) val remainTime = trafficLightStatus.remain val arriveTime = distance / speed - Logger.d(TAG, "speed is:$speed,remainTime is:$remainTime,arriveTime is:$arriveTime,yellowTime is:$yellowLightTime") + Logger.d( + TAG, + "speed is:$speed,remainTime is:$remainTime,arriveTime is:$arriveTime,yellowTime is:${trafficLightResult.flashYellow}" + ) when { trafficLightStatus.isRed() -> { Logger.d(TAG, "=====当前为红灯=====") - // 到达路口时红灯还没走完 - if (arriveTime <= remainTime) { + // 到达路口时红灯还没走完(由于多个数据有偏差,红灯预警延长1s,绿灯提示延长2s,多报出错不如少报且准) + if (arriveTime <= remainTime + 1) { redLightWarning() - } else if (arriveTime > remainTime + yellowLightTime) {// 到达时红、黄灯都走完 + } else if (arriveTime > remainTime + trafficLightResult.flashYellow + 2) {// 到达时红、黄灯都走完 // 单位Km/h,当前为红灯,推荐速度越慢越容易绿灯通过,且要满足[10,50] - val originRemainSpeed = floor(100 / (remainTime + yellowLightTime) * 3.6).toInt() - when { + val originRemainSpeed = + floor(distance / (remainTime + trafficLightResult.flashYellow) * 3.6).toInt() + when { originRemainSpeed > 50 -> greenLightWarning("10到50") originRemainSpeed in 10..50 -> greenLightWarning("10到$originRemainSpeed") } @@ -96,13 +126,13 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener { } trafficLightStatus.isYellow() -> { Logger.d(TAG, "=====当前为黄灯=====") - // 到达路口时黄灯还没走完 - if (arriveTime <= remainTime) { + // 到达路口时黄灯还没走完(由于多个数据有偏差,红灯预警延长1s,绿灯提示延长2s,多报出错不如少报且准) + if (arriveTime <= remainTime + 1) { redLightWarning() - } else { + } else if (arriveTime > remainTime + 2) { // 单位Km/h,当前为黄灯,推荐速度越慢越容易绿灯通过,且要满足[10,50] - val originRemainSpeed = floor(100 / remainTime * 3.6).toInt() - when { + val originRemainSpeed = floor(distance / remainTime * 3.6).toInt() + when { originRemainSpeed > 50 -> greenLightWarning("10到50") originRemainSpeed in 10..50 -> greenLightWarning("10到$originRemainSpeed") } @@ -110,17 +140,16 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener { } trafficLightStatus.isGreen() -> { Logger.d(TAG, "=====当前为绿灯=====") - // 到达路口时绿灯已经走完 - if (arriveTime >= remainTime) { + // 到达路口时绿灯已经走完(由于多个数据有偏差,多报出错不如少报且准,绿灯时间减少一点) + if (arriveTime >= remainTime - 1) { redLightWarning() - } else if (arriveTime < remainTime) { + } else if (arriveTime < remainTime - 2) { // 单位Km/h,当前为绿灯,推荐速度越快越容易绿灯通过,且要满足[10,50] - val originRemainSpeed = ceil(100 / remainTime * 3.6).toInt() - when { + val originRemainSpeed = ceil(distance / remainTime * 3.6).toInt() + when { originRemainSpeed < 10 -> greenLightWarning("10到50") originRemainSpeed in 10..50 -> greenLightWarning("${originRemainSpeed}到50") } - greenLightWarning() } } } @@ -174,5 +203,19 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener { fun onDestroy() { CallTrafficLightListenerManager.unRegisterTrafficLightListener(TAG) CallVipSetListenerManager.unRegisterVipSetListener(TAG) + CallTrafficLightListenerManager.unRegisterEnterCrossRoadListener(TAG) + MogoApisHandler.getInstance().apis.registerCenterApi.unregisterCarLocationChangedListener( + TAG, this + ) + } + + override fun onCarLocationChanged(latLng: MogoLatLng?) { + + } + + override fun onCarLocationChanged2(latLng: Location?) { + latLng?.let { + mLocation = it + } } } \ No newline at end of file From 11ee70d24d6d13914f9199ea930034ec2e7719a4 Mon Sep 17 00:00:00 2001 From: liujing Date: Mon, 29 Nov 2021 18:59:59 +0800 Subject: [PATCH 10/11] =?UTF-8?q?81=E5=B0=8F=E5=B7=B4=E8=BD=A6=E8=81=94?= =?UTF-8?q?=E8=B0=83=E5=BC=B1=E5=8A=BF=E4=BA=A4=E9=80=9A=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E9=83=A8=E5=88=86=E5=88=A4=E7=A9=BA=E6=B7=BB=E5=8A=A0;=20?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=B7=BB=E5=8A=A0,=E5=90=8E=E7=BB=AD?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/entity/V2XMessageEntity.java | 12 +++++ .../mogo/module/v2x/V2XModuleProvider.java | 9 ++++ .../v2x/scenario/impl/V2XScenarioManager.java | 2 +- .../warning/V2XFrontWarningScenario.java | 44 +++++++++++-------- .../scene/warning/V2XWarningMarker.java | 33 +++++++++----- .../scene/warning/V2XWarningWindow.java | 4 +- 6 files changed, 74 insertions(+), 30 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java index 8d40920263..98a0129bda 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java @@ -197,4 +197,16 @@ public class V2XMessageEntity implements Serializable { @Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中 public @interface MessageType { //接口,定义新的注解类型 } + + @Override + public String toString() { + return "V2XMessageEntity{" + + "type=" + type + + ", showState=" + showState + + ", isNeedCompareSameScenario=" + isNeedCompareSameScenario + + ", onlyShow=" + onlyShow + + ", needAddLine=" + needAddLine + + ", content=" + content + + '}'; + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java index d9e5e45f51..4fe45ef1d2 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java @@ -16,6 +16,8 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; import com.mogo.eagle.core.utilcode.util.TimeUtils; import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.map.listener.IMogoMapListener; @@ -54,6 +56,8 @@ import com.mogo.utils.network.utils.GsonUtil; import com.mogo.utils.storage.SharedPrefsMgr; import com.tencent.liteav.basic.log.TXCLog; +import org.jetbrains.annotations.Nullable; + import static com.mogo.module.v2x.V2XConst.MODULE_NAME; import static com.mogo.module.v2x.VideoInitKt.initVideo; @@ -441,4 +445,9 @@ public class V2XModuleProvider implements public void onDestroy() { } + +// @Override +// public void onLocationChanged(@Nullable MogoLocation location) { +// V2XScenarioManager.getInstance().handlerMessage(entity); +// } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java index 8465087e30..71468c3b52 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/impl/V2XScenarioManager.java @@ -59,7 +59,7 @@ public class V2XScenarioManager implements IV2XScenarioManager { @Override public void handlerMessage(V2XMessageEntity v2XMessageEntity) { - //Logger.d(MODULE_NAME, "处理V2X场景:" + GsonUtil.jsonFromObject(v2XMessageEntity)); + Logger.d(MODULE_NAME, "处理V2X场景:" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); try { synchronized (V2XScenarioManager.class) { // 展示 diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java index 482b58be7c..ec6e48687f 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XFrontWarningScenario.java @@ -7,7 +7,12 @@ import android.view.ViewGroup; import androidx.annotation.Nullable; +import com.google.protobuf.DescriptorProtos; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; +import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; +import com.mogo.eagle.core.utilcode.util.ObjectUtils; import com.mogo.eagle.core.utilcode.util.Utils; import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.module.common.MogoApisHandler; @@ -23,7 +28,8 @@ import com.mogo.service.windowview.IMogoTopViewStatusListener; * @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警 * @since: 2021/3/24 */ -public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener, IMogoCarLocationChangedListener2 { +public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener ,IMoGoMapLocationListener{ + private static final String TAG = "V2XWarningMarker"; private V2XWarningEntity mMarkerEntity; static private V2XWarningMarker sV2XWarningMarker = new V2XWarningMarker(); @@ -34,10 +40,9 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV @Override public void init(@Nullable V2XMessageEntity v2XMessageEntity) { + Log.d(TAG, "----- init -----:\n" + (v2XMessageEntity == null ? "null" : v2XMessageEntity.toString())); try { if (v2XMessageEntity.getContent() != null) { - MogoApisHandler.getInstance().getApis().getRegisterCenterApi() - .registerCarLocationChangedListener(TAG, this); if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) { mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent(); show(); @@ -57,7 +62,9 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV @Override public void showWindow() { + Log.d(TAG, "----- showWindow --- 1 --:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); if (getV2XWindow() != null && mMarkerEntity != null) { + Log.d(TAG, "----- showWindow --- 2 --:\n" + mMarkerEntity.toString()); ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, @@ -72,17 +79,17 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV @Override public void closeWindow() { - + Log.d(TAG, "----- closeWindow -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); } @Override public void showButton() { - + Log.d(TAG, "----- showButton -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); } @Override public void closeButton() { - + Log.d(TAG, "----- closeButton -----:\n" + (mMarkerEntity == null ? "null" : mMarkerEntity.toString())); } @Override @@ -95,37 +102,38 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV @Override public void clearPOI() { - + Log.d(TAG, "----- clearPOI -----"); } @Override public void onViewAdded(View view) { + Log.d(TAG, "----- onViewAdded -----"); } @Override public void onViewRemoved(View view) { - Log.d(TAG, "onViewRemoved"); + Log.d(TAG, "----- onViewRemoved -----"); } @Override public void beforeViewAddAnim(View view) { - + Log.d(TAG, "----- beforeViewAddAnim -----"); } @Override public void beforeViewRemoveAnim(View view) { - + Log.d(TAG, "----- beforeViewRemoveAnim -----"); } +// @Override +// public void onCarLocationChanged2(Location latLng) { +// sV2XWarningMarker.onCarLocationChanged2(latLng); +// } + + @Override - public void onCarLocationChanged2(Location latLng) { - sV2XWarningMarker.onCarLocationChanged2(latLng); + public void onLocationChanged(@org.jetbrains.annotations.Nullable MogoLocation location) { + sV2XWarningMarker.onCarLocationChanged2(location); } - - @Override - public void onCarLocationChanged(MogoLatLng latLng) { - - } - } 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 289ba22aa7..a8cfdbe204 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 @@ -5,6 +5,8 @@ import android.util.Log; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; +import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.drawer.V2XWarnDataDrawer; @@ -34,7 +36,7 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext; * @description 前方预警marker打点 绘制安全线和预警线 * @since: 2021/3/30 */ -public class V2XWarningMarker implements IV2XMarker { +public class V2XWarningMarker implements IV2XMarker{ private static final String TAG = "V2XWarningMarker"; private static String WARNING_ARROWS = "WARNING_ARROWS"; private V2XWarningEntity mCloundWarningInfo; @@ -57,6 +59,7 @@ public class V2XWarningMarker implements IV2XMarker { @Override public void drawPOI(Object entity) { try { + Log.d(TAG, "===drawPOI"); mCloundWarningInfo = (V2XWarningEntity) entity; drawLineWithEntity(); @@ -71,10 +74,12 @@ public class V2XWarningMarker implements IV2XMarker { fillPointOnStopLine(); bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing(); - hasStopLines = mCloundWarningInfo.getStopLines().size() > 0; + if (mCloundWarningInfo != null && mCloundWarningInfo.getStopLines() != null) { + hasStopLines = mCloundWarningInfo.getStopLines().size() > 0; + } isSelfLineClear = false; isFirstLocation = false; - if (fillPoints.size() > 0) { + if (fillPoints != null && fillPoints.size() > 0) { //存在停止线的情况 自车与停止线之间绘制蓝色安全线 停止线向前50m绘制红色预警线 middleLocationInStopLine = getMiddleLocationInStopLine(); //停止线前方画线 @@ -83,7 +88,6 @@ public class V2XWarningMarker implements IV2XMarker { //在自车与停止线直线绘制蓝色预警线 drawSelfCarLine(carLocation.lon, carLocation.lat, bearing); } else { - Log.d(TAG, "自车定位数据为空carLocation == null"); } //二轮车和行人的渲染和移动 V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA); @@ -102,7 +106,9 @@ public class V2XWarningMarker implements IV2XMarker { clearAllLine(); } else { //无停止线 + Log.d(TAG, "无停止线"); WorkThreadHandler.getInstance().postDelayed(() -> { + Log.d(TAG, "无停止线" + mCloundWarningInfo.toString()); //绘制识别物与交汇点连线,并且更新连线数据 drawOtherObjectLine(mCloundWarningInfo); //二轮车和行人的渲染和移动 @@ -195,7 +201,7 @@ public class V2XWarningMarker implements IV2XMarker { try { fillPoints.clear(); List stopLines = mCloundWarningInfo.getStopLines(); - if (stopLines.size() > 1) { + if (stopLines != null && stopLines.size() > 1) { MogoLatLng x = mCloundWarningInfo.getStopLines().get(0); MogoLatLng y = mCloundWarningInfo.getStopLines().get(1); //两点间的距离 @@ -210,8 +216,11 @@ public class V2XWarningMarker implements IV2XMarker { fillPoints.add(newLocation); } fillPoints.add(y); + } else { + Log.d(TAG, "停止线数据不存在"); } } catch (Exception e) { + Log.d(TAG, "Exception"); e.printStackTrace(); } } @@ -251,7 +260,7 @@ public class V2XWarningMarker implements IV2XMarker { Log.d(TAG, "获取不到车的位置"); } MogoLatLng newLocation = new MogoLatLng(0, 0); - if (mCloundWarningInfo.getStopLines().size() > 1) { + if (mCloundWarningInfo != null && mCloundWarningInfo.getStopLines() != null && mCloundWarningInfo.getStopLines().size() > 1) { MogoLatLng x = mCloundWarningInfo.getStopLines().get(0); MogoLatLng y = mCloundWarningInfo.getStopLines().get(1); float distance = CoordinateUtils.calculateLineDistance(x.lon, x.lat, y.lon, y.lat); @@ -270,6 +279,7 @@ public class V2XWarningMarker implements IV2XMarker { * lat 自车纬度 */ public void drawSelfCarLine(double lon, double lat, float bearing) { + Log.d(TAG, "drawSelfCarLine"); if (!isSelfLineClear) { if (mCloundWarningInfo != null) { IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); @@ -305,7 +315,9 @@ public class V2XWarningMarker implements IV2XMarker { info.setLocations(locations); info.setHeading(bearing); info.setWidth(mCloundWarningInfo.getRoadwidth() * 14 + 5); - info.setHasStopLines(mCloundWarningInfo.getStopLines().size() > 0); + if (mCloundWarningInfo.getStopLines() != null){ + info.setHasStopLines(mCloundWarningInfo.getStopLines().size() > 0); + } V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info); Log.d(TAG, "自车前方第一条线" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); } @@ -322,6 +334,7 @@ public class V2XWarningMarker implements IV2XMarker { */ private void drawOtherObjectLine(V2XWarningEntity info) { if (info != null) { + Log.d(TAG, "info != null"); IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline(); MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());//识别物坐标 MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());//预碰撞点坐标 @@ -329,7 +342,7 @@ public class V2XWarningMarker implements IV2XMarker { 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"); + Log.d(TAG, "目标物与碰撞点连线 != null"); polyLine.setPoints(Arrays.asList(startLatlng, addMiddleLoc, endLatlng)); polyLine.setTransparency(0.5f); } else { @@ -347,7 +360,7 @@ public class V2XWarningMarker implements IV2XMarker { Log.d(TAG, "目标物与预碰撞点画线点为" + "起点:" + startLatlng + "中间点:" + addMiddleLoc + "终点:" + endLatlng); } } else { - Log.e(V2XConst.LOG_NAME_WARN, "info == null"); + Log.e(TAG, "info == null"); clearAllLine(); } } @@ -371,7 +384,7 @@ public class V2XWarningMarker implements IV2XMarker { } //线随车动 - public void onCarLocationChanged2(Location latLng) { + public void onCarLocationChanged2(MogoLocation latLng) { carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()); if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && isSelfLineClear == false) { if (mCloundWarningInfo != null) { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java index 62e126a6d4..71bb06e681 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java @@ -3,6 +3,7 @@ package com.mogo.module.v2x.scenario.scene.warning; import android.content.Context; import android.os.Handler; import android.util.AttributeSet; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.widget.ImageView; @@ -25,7 +26,7 @@ import java.math.BigDecimal; * @since: 2021/3/25 */ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { - + private static final String TAG = "V2XWarningMarker"; private ImageView typeImage; private TextView warningTextView; private TextView distance; @@ -63,6 +64,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { public void show(Object entity) { if (entity != null) { mV2XWarningEntity = (V2XWarningEntity) entity; + Log.d(TAG, mV2XWarningEntity.toString()); //1行人/2自行车/4摩托车 switch (mV2XWarningEntity.getType()) { case 1: From 25ef9fb765d5eab8df2d06a43cf435b5b4211fcc Mon Sep 17 00:00:00 2001 From: liujing Date: Tue, 30 Nov 2021 11:00:59 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BA=91=E7=AB=AF=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E6=94=B9=E4=B8=BAgps,=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E4=BE=A7=E4=BC=A0=E5=8F=82=E4=B8=BAgps=E5=AE=9A=E4=BD=8D,?= =?UTF-8?q?=E4=B8=8D=E9=9C=80=E8=A6=81=E5=9C=B0=E5=9B=BE=E4=BE=A7=E8=BD=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1,setGps(true)=20=E5=A6=82=E6=9E=9C=E4=BC=A0?= =?UTF-8?q?=E5=8F=82=E4=B8=BA=E9=AB=98=E5=BE=B7=E5=AE=9A=E4=BD=8D,setGps(f?= =?UTF-8?q?alse),=E5=9C=B0=E5=9B=BE=E4=BE=A7=E8=BD=AC=E9=AB=98=E5=BE=B7?= =?UTF-8?q?=E5=AE=9A=E4=BD=8D=E4=B8=BAGPS=E5=86=8D=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../map/impl/custom/CustomMapApiBuilder.java | 2 +- .../common/drawer/V2XWarnDataDrawer.java | 4 ++-- .../impl/MoGoPersonWarnPolylineManager.java | 2 +- .../manager/impl/MoGoWarnPolylineManager.java | 4 ++-- ...enario_warning_event_data_pedestrians.json | 22 +++++-------------- 5 files changed, 12 insertions(+), 22 deletions(-) diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java index eb23706c19..3fd73a29f7 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/CustomMapApiBuilder.java @@ -74,7 +74,7 @@ public class CustomMapApiBuilder implements IMogoMapApiBuilder { Log.d(TAG, "setDebugMode==true"); MapParams mapParams = MapParams.Companion.init(); - mapParams.setDebugMode(false) + mapParams.setDebugMode(true) //.setDataFileSource(1) //todo 1-使用本地地图数据,0-使用在线地图数据 .setCoordinateType(MapParams.COORDINATETYPE_GCJ02) .setPerspectiveMode(MapParams.MAP_PERSPECTIVE_2D) 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 ee17d909ff..6968b30acb 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 @@ -108,7 +108,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL .object(markerShowEntity) .latitude(markerShowEntity.getMarkerLocation().getLat()) .longitude(markerShowEntity.getMarkerLocation().getLon()) - .setGps(false); + .setGps(true); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); options.icon3DRes(getModelRes(modeResType)); //TODO options.anchorColor("#FB3C3CFF"); @@ -124,7 +124,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL .latitude(location.getLat()) .longitude(location.getLon()) .set3DMode(true) - .setGps(false) + .setGps(true) .controlAngle(true) .icon3DRes(getModelRes(type)) .anchorColor("#FB3C3CFF") diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java index 9bd3af9936..dfcd9256dc 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java @@ -36,7 +36,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan } // 连接线参数 - MogoPolylineOptions options = new MogoPolylineOptions().setGps(false); + MogoPolylineOptions options = new MogoPolylineOptions().setGps(true); // 渐变色 List colors = new ArrayList<>(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java index 9107b2144f..c39ab0aa07 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java @@ -37,7 +37,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { // 连接线参数 MogoPolylineOptions options = new MogoPolylineOptions() - .setGps(false); + .setGps(true); List colors = new ArrayList<>(); if (info.isHasStopLines() == true) { @@ -50,7 +50,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { colors.add(0x0DE32F46); } - Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); + Log.d("V2XWarningMarker", "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); // 线条粗细,渐变,渐变色值 options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors); List locations = info.getLocations(); diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json index 6226dfd0de..198ddc19d6 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data_pedestrians.json @@ -1,29 +1,19 @@ { "type": 1, - "lat": 26.87912015, - "lon": 112.56885373, - "distance": 2.678, - "collisionLat": 26.8791769, - "collisionLon": 112.56896496, + "lat": 26.851993861219782, + "lon": 112.57065318116094, + "distance": 5.89, + "collisionLat": 26.85198163866211, + "collisionLon": 112.57059540184451, "stopLines": [ - { - "lat": 26.8791769, - "lon": 112.56896496 - - }, - { - "lat": 26.879153, - "lon": 112.568997 - } ], "from": 1, "angle": 240, "direction": 1, "speed": 11.108121, - "targetColor": "#FF4040", "stopLineDistance": 60, "warningContent": "小心行人", - "heading": 0, + "heading": 76, "showTime": 3, "roadwidth": 4.0 } \ No newline at end of file