From 0b2ed3bff67f8b8e404decf3c2101593a1f02977 Mon Sep 17 00:00:00 2001 From: wujifei Date: Fri, 2 Apr 2021 18:03:35 +0800 Subject: [PATCH 01/10] =?UTF-8?q?new#=E4=BC=98=E5=8C=96Vr=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E9=81=93=E8=B7=AF=E4=BA=8B=E4=BB=B6UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/v2x/adapter/holder/V2XRoadEventVH.java | 13 +++++++++---- .../main/res/layout/item_v2x_event_detail_vr.xml | 3 +++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java index f89c9ed6d9..8e5b8b24e1 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java @@ -143,6 +143,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { private MogoImageView ivEvent; private TextView tvEvent; + private TextView tvLine; private TextView tvPlay; @@ -162,6 +163,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { ivEvent = itemView.findViewById(R.id.iv_event); tvEvent = itemView.findViewById(R.id.tv_event); + tvLine = itemView.findViewById(R.id.tv_line); tvPlay = itemView.findViewById(R.id.tv_play); } @@ -246,6 +248,8 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { ivEventImg.setOnClickListener(v -> { showRoadVideoInfo(v2XEventShowEntity); }); + tvLine.setVisibility(VISIBLE); + tvPlay.setVisibility(VISIBLE); tvPlay.setOnClickListener(v -> { showRoadVideoInfo(v2XEventShowEntity); }); @@ -257,6 +261,8 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { ivEventImg.setOnClickListener(null); ivEventPlay.setOnClickListener(null); ivEventPlay.setVisibility(GONE); + tvLine.setVisibility(GONE); + tvPlay.setVisibility(GONE); } } if (mNoveltyInfo.getUserInfo() != null && @@ -274,11 +280,10 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { ivEvent.setImageResource(EventTypeUtils.getPoiTypeSrcVr(mNoveltyInfo.getPoiType())); tvEvent.setText(EventTypeUtils.getPoiTypeStrVr(mNoveltyInfo.getPoiType())); if (mNoveltyInfo.getPoiType() == V2XPoiTypeEnum.FOURS_FOG) { - + V2XServiceManager.getDisplayEffectsManager().displayEffects(V2XPoiTypeEnum.FOURS_FOG); + // MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(ALERT_THE_FRONT_CRASH_WARNING_TOP, MogoReceiver.ACTION_V2X_FRONT_WARNING); } - V2XServiceManager.getDisplayEffectsManager().displayEffects(V2XPoiTypeEnum.FOURS_FOG); - // MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(ALERT_THE_FRONT_CRASH_WARNING_TOP, MogoReceiver.ACTION_V2X_FRONT_WARNING); - tvEventAddress.setText(mNoveltyInfo.getAddr()); + tvEventAddress.setText(mNoveltyInfo.getAddr()); tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "米"); Calendar c = Calendar.getInstance(); diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml index b8f9cd976a..ac91f6c608 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml @@ -253,9 +253,11 @@ app:layout_constraintTop_toTopOf="parent" /> Date: Fri, 2 Apr 2021 18:17:02 +0800 Subject: [PATCH 02/10] =?UTF-8?q?=E8=87=AA=E8=BD=A6=E4=B8=8E=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E7=BA=BF=E9=97=B4=E7=94=BB=E7=BA=BF(=E7=94=BB?= =?UTF-8?q?=E7=BA=BF=E7=B1=BB=E7=BC=BA=E5=B0=91=E8=89=B2=E5=80=BC=E9=80=82?= =?UTF-8?q?=E9=85=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scenario/scene/warning/V2XWarningMarker.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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 90eb63254b..4c9e3078ae 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 @@ -1,6 +1,7 @@ package com.mogo.module.v2x.scenario.scene.warning; import android.content.Context; +import android.util.Log; import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.map.MogoLatLng; @@ -28,6 +29,7 @@ import java.util.List; * @since: 2021/3/30 */ public class V2XWarningMarker implements IV2XMarker { + private static final String TAG = "V2XWarningMarker"; private V2XWarningEntity mMarkerEntity; private MarkerShowEntity markerShowEntity = new MarkerShowEntity(); private Context mContext = V2XServiceManager.getContext(); @@ -65,13 +67,7 @@ public class V2XWarningMarker implements IV2XMarker { clearPOI(); WorkThreadHandler.getInstance().postDelayed(() -> { //自车位置 - MogoLatLng car = mMarkerEntity.getCarLocation(); - if (car == null) { - double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); - double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(); - car = new MogoLatLng(lat, lon); - car = new MogoLatLng(39.977709,116.417703); - } + MogoLatLng car = V2XServiceManager.getNavi().getCarLocation(); if (car != null) { //根据到停止线的距离和方向角获取经纬度 MogoLatLng @@ -79,6 +75,8 @@ public class V2XWarningMarker implements IV2XMarker { if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() > 0) { drawLine(car, stopLineLo); } + } else { + Log.d(TAG, "自车位置没有拿到"); } }, 0); } @@ -105,7 +103,7 @@ public class V2XWarningMarker implements IV2XMarker { fillPoints.add(y); } } catch (Exception e) { - + e.printStackTrace(); } } From 8581b5e072008d0b36a143e9579565c49dcf3974 Mon Sep 17 00:00:00 2001 From: liujing Date: Fri, 2 Apr 2021 18:44:50 +0800 Subject: [PATCH 03/10] no message --- .../src/main/java/com/mogo/module/v2x/V2XConst.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java index 1430bf8fa2..74ef9948d2 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java @@ -141,12 +141,12 @@ public class V2XConst { public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER"; /* - *V2X 车路云前方预警 - * */ + *V2X 车路云前方预警-识别物 + * */ public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER"; /* - *V2X 车路云前方预警 + *V2X 车路云前方预警-线 * */ public static final String V2X_FRONT_STOP_LINE = "V2X_FRONT_STOP_LINE"; /** From 708144401f951f457ebd58261477b6a00af4a8f6 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 6 Apr 2021 14:47:22 +0800 Subject: [PATCH 04/10] upgrade aiSdk version --- gradle.properties | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 2172a6f8a0..9cf58fd805 100644 --- a/gradle.properties +++ b/gradle.properties @@ -155,19 +155,19 @@ LOGLIB_VERSION = 1.0.4 ######## MogoAiCloudSDK Version # 网络请求 -MOGO_NETWORK_VERSION=1.0.61 +MOGO_NETWORK_VERSION=1.0.62 # 鉴权 -MOGO_PASSPORT_VERSION=1.0.61 +MOGO_PASSPORT_VERSION=1.0.62 # 常链接 -MOGO_SOCKET_VERSION=1.0.61 +MOGO_SOCKET_VERSION=1.0.62 # 数据采集 -MOGO_REALTIME_VERSION=1.0.61 +MOGO_REALTIME_VERSION=1.0.62 # 探路,道路事件发布,获取 -MOGO_TANLU_VERSION=1.0.61 +MOGO_TANLU_VERSION=1.0.62 # 直播推流 -MOGO_LIVE_VERSION=1.0.61 +MOGO_LIVE_VERSION=1.0.62 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.0.61 +MOGO_TRAFFICLIVE_VERSION=1.0.62 ######## Foundation MogoAiCloud Moduletruetr # mogoAiCloud apk services From 42d00485812364386aa9a196431f3cfec262d46b Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 6 Apr 2021 15:25:35 +0800 Subject: [PATCH 05/10] fixbug --- gradle.properties | 14 +++++++------- .../scene/livecar/V2XVoiceCallLiveScenario.java | 8 ++++++-- .../src/main/res/values-xhdpi/dimens.xml | 2 ++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/gradle.properties b/gradle.properties index 9cf58fd805..3d9c247180 100644 --- a/gradle.properties +++ b/gradle.properties @@ -155,19 +155,19 @@ LOGLIB_VERSION = 1.0.4 ######## MogoAiCloudSDK Version # 网络请求 -MOGO_NETWORK_VERSION=1.0.62 +MOGO_NETWORK_VERSION=1.0.63 # 鉴权 -MOGO_PASSPORT_VERSION=1.0.62 +MOGO_PASSPORT_VERSION=1.0.63 # 常链接 -MOGO_SOCKET_VERSION=1.0.62 +MOGO_SOCKET_VERSION=1.0.63 # 数据采集 -MOGO_REALTIME_VERSION=1.0.62 +MOGO_REALTIME_VERSION=1.0.63 # 探路,道路事件发布,获取 -MOGO_TANLU_VERSION=1.0.62 +MOGO_TANLU_VERSION=1.0.63 # 直播推流 -MOGO_LIVE_VERSION=1.0.62 +MOGO_LIVE_VERSION=1.0.63 # 直播拉流 -MOGO_TRAFFICLIVE_VERSION=1.0.62 +MOGO_TRAFFICLIVE_VERSION=1.0.63 ######## Foundation MogoAiCloud Moduletruetr # mogoAiCloud apk services diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java index 405295e884..29ad1c1247 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java @@ -1,7 +1,7 @@ package com.mogo.module.v2x.scenario.scene.livecar; import android.view.View; -import android.view.ViewGroup; +import android.widget.RelativeLayout; import androidx.annotation.Nullable; @@ -64,7 +64,11 @@ public class V2XVoiceCallLiveScenario extends AbsV2XScenario32px 1060px 583px + 160px + 32px 390px 410px From 70b9b6d1ff541b441376b7ad009176333455894a Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Tue, 6 Apr 2021 15:37:59 +0800 Subject: [PATCH 06/10] opt --- .../common/drawer/V2XWarnDataDrawer.java | 7 +-- .../common/entity/V2XWarningEntity.java | 12 +++++ .../com/mogo/module/v2x/V2XWaringManager.java | 3 +- .../impl/MoGoPersonWarnPolylineManager.java | 7 ++- .../impl/MoGoV2XCloundDataManager.java | 50 +++++++++++-------- .../manager/impl/MoGoWarnPolylineManager.java | 6 +-- .../res/raw/scenario_warning_event_data.json | 3 +- 7 files changed, 52 insertions(+), 36 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 b9f839be11..5928d1df61 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 @@ -85,12 +85,12 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL WorkThreadHandler.getInstance().postDelayed(() -> { IMogoMarker marker = drawMarker(markerShowEntity); Log.d("liyz", "renderWarnData marker != null "); - marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 4000); + marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000); //移动完成以后,3s后消失 UiThreadHandler.postDelayed( () -> { marker.remove(); - }, 3000 ); + }, 8000 ); }, 0); @@ -105,7 +105,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); options.icon3DRes(getModelRes(2)); //TODO - options.anchorColor("#FF4040"); +// options.anchorColor("#FF4040"); + options.anchorColor("#FF3036"); //红色 IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); iMarkerView.setMarker(marker); marker.setToTop(); diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java index 9f294af585..532dca9d7a 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java @@ -54,6 +54,7 @@ public class V2XWarningEntity implements Serializable { public long satelliteTime; //预警蒙层等展示时长 private long showTime; + private float roadwidth; //自组字段 //tts播报 @@ -218,6 +219,14 @@ public class V2XWarningEntity implements Serializable { return stopLines; } + public float getRoadwidth() { + return roadwidth; + } + + public void setRoadwidth(float roadwidth) { + this.roadwidth = roadwidth; + } + @Override public String toString() { return "V2XWarningEntity{" + @@ -231,6 +240,7 @@ public class V2XWarningEntity implements Serializable { ", angle=" + angle + ", direction=" + direction + ", speed=" + speed + + ", stopLines=" + stopLines + ", stopLineDistance=" + stopLineDistance + ", roadId='" + roadId + '\'' + ", laneId='" + laneId + '\'' + @@ -241,6 +251,8 @@ public class V2XWarningEntity implements Serializable { ", heading=" + heading + ", systemTime=" + systemTime + ", satelliteTime=" + satelliteTime + + ", showTime=" + showTime + + ", roadwidth=" + roadwidth + ", tts='" + tts + '\'' + ", carLocation=" + carLocation + '}'; diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java index 9e98307aa5..a274f3d9c6 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java @@ -67,7 +67,7 @@ public class V2XWaringManager { } /** - * TODO 测试数据 + * 测试数据 */ private void testData() { @@ -86,7 +86,6 @@ public class V2XWaringManager { // 加载数据源 V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class); V2XServiceManager.getMoGoV2XCloundDataManager().analysisV2XCloundDataEvent(warningEntity); - Logger.d(V2XConst.LOG_NAME_WARN, "testData -----> "); } catch (Exception e) { e.printStackTrace(); } 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 43e5a4eb06..0a124b9e96 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 @@ -16,7 +16,7 @@ import java.util.ArrayList; import java.util.List; /** - * 当前车辆与道路事件的连接线 + * 绘制行人和二轮车连线 */ @Route(path = MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER) public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineManager { @@ -54,9 +54,8 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan } // 线条粗细,渐变,渐变色值 -// Logger.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager roadWidth = " + roadWidth); - options.width(60).useGradient(true).colorValues(colors); -// options.width(info.getWidth()).useGradient(true).colorValues(colors); + Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth()); + options.width(info.getWidth()).useGradient(true).transparency(0.1f).colorValues(colors); // 当前车辆位置 options.add(info.getStartLocation()); // 目标车辆位置 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 216058ac4a..c7bfc74e61 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 @@ -17,6 +17,7 @@ import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager; import com.mogo.utils.UiThreadHandler; +import com.mogo.utils.WorkThreadHandler; import com.mogo.utils.logger.Logger; import java.util.Arrays; @@ -29,24 +30,36 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext; @Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER) public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 { private V2XWarningEntity mCloundWarningInfo; + private static String TAG = "MoGoV2XCloundDataManager"; @Override public void init(Context context) { + MogoApisHandler.getInstance().getApis().getRegisterCenterApi() + .registerCarLocationChangedListener(TAG, this); } @Override public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) { + Log.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> "); + mCloundWarningInfo = cloundWarningInfo; - //绘制识别物与交汇点连线,并且更新连线数据 TODO VR模式无法获取道路宽度 - drawOtherObjectLine(cloundWarningInfo); - Logger.d(V2XConst.LOG_NAME_WARN, "analysisV2XCloundDataEvent -----> "); + //绘制识别物与交汇点连线,并且更新连线数据 + WorkThreadHandler.getInstance().postDelayed(() -> { + drawOtherObjectLine(cloundWarningInfo); + }, 0); + //二轮车和行人的渲染和移动 V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + + //延迟3秒清理线 + UiThreadHandler.postDelayed( () -> { + V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); + }, 8000 ); } /** - * 绘制行人和二轮车连线,并且更新数据 + * 绘制行人和二轮车连线,并且更新数据 TODO 需要实时给行人当前位置 */ private void drawOtherObjectLine(V2XWarningEntity info) { IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline(); @@ -56,7 +69,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()), new MogoLatLng(info.getCollisionLat(), info.getCollisionLon()))); } else { - Log.d(V2XConst.LOG_NAME_WARN, "polyLine == null"); + Log.e(V2XConst.LOG_NAME_WARN, "polyLine == null"); DrawLineInfo lineInfo = new DrawLineInfo(); MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon()); MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon()); @@ -64,21 +77,14 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog lineInfo.setEndLocation(endLatlng); lineInfo.setHeading(info.heading); if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { - float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getLon(), - info.getLat(), (float) info.heading, true, true); - Log.d(V2XConst.LOG_NAME_WARN, "roadWidth = " + roadWidth); - float pixel = V2XServiceManager.getMapUIController().getScalePerPixel(); - float width = roadWidth / pixel; - lineInfo.setWidth(width); +// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getLon(), +// info.getLat(), (float) info.heading, true, true); + Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth()); + lineInfo.setWidth(info.getRoadwidth()); } V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo); } - //延迟3秒清理线 - UiThreadHandler.postDelayed( () -> { - V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); - }, 6000 ); - } else { Log.e(V2XConst.LOG_NAME_WARN, "info == null"); V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); @@ -91,11 +97,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } /** - * 自车定位 移动完成需要 3s消失 + * 自车定位 移动完成需要 3s消失,这里何时清理,应该是没有数据的时候 */ @Override public void onCarLocationChanged2(Location latLng) { - Log.d(V2XConst.LOG_NAME_WARN, "latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude()); + Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude()); //当行人经纬度交点 经纬度不为空,开始画线,否则清理 //自车只需要关注移动 IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); @@ -105,21 +111,21 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon()))); } else { - Log.e(V2XConst.LOG_NAME_WARN, "mogoPolyline == null"); + Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mogoPolyline == null width = " + mCloundWarningInfo.getRoadwidth()); DrawLineInfo info = new DrawLineInfo(); // 对象 MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()); MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon()); info.setHeading(latLng.getBearing()); info.setStartLocation(startLatlng); info.setEndLocation(endLatlng); - info.setWidth(60); //TODO + info.setWidth(mCloundWarningInfo.getRoadwidth()); //TODO 还需要转换比例尺 V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info); } - //延迟3秒清理线 + //延迟3秒清理线 TODO 何时 清理 UiThreadHandler.postDelayed( () -> { V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - }, 3000 ); + }, 13000 ); } else { Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null"); 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 723e182ccc..4362aac4c3 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 @@ -38,8 +38,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { mMogoPolyline.remove(); } - Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager --------> "); - // 连接线参数 MogoPolylineOptions options = new MogoPolylineOptions(); List colors = new ArrayList<>(); @@ -58,9 +56,9 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { colors.add(0xFFE32F46); } -// Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth); + Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); // 线条粗细,渐变,渐变色值 - options.width(60).useGradient(true).colorValues(colors); + options.width(info.getWidth()).useGradient(true).transparency(0.9f).colorValues(colors); // options.width(info.getWidth()).useGradient(true).colorValues(colors); // 当前车辆位置 options.add(info.getStartLocation()); 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 91f29e6187..838ce52329 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 @@ -25,5 +25,6 @@ "stopLineLon": 116.417634, "warningContent": "小心行人", "heading": 30, - "showTime": 3000 + "showTime": 3000, + "roadwidth": 65.0 } \ No newline at end of file From 82b70c1696b133257a4d02ccb028cffcedbf1fa4 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 6 Apr 2021 15:40:34 +0800 Subject: [PATCH 07/10] fixbug --- .../v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java | 4 ++-- modules/mogo-module-v2x/src/main/res/values-xhdpi/dimens.xml | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java index 29ad1c1247..a802d93962 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveScenario.java @@ -66,9 +66,9 @@ public class V2XVoiceCallLiveScenario extends AbsV2XScenario1060px 583px 160px + 0px 32px + 0px 390px 410px From b49d74b201dee9280d2e4ee8d28ae7ca79892bf0 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Tue, 6 Apr 2021 15:47:28 +0800 Subject: [PATCH 08/10] opt --- .../com/mogo/module/share/TanluManager.java | 2 +- .../impl/MoGoPersonWarnPolylineManager.java | 27 +++++++++-------- .../manager/impl/MoGoWarnPolylineManager.java | 29 ++++++++++--------- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java index 79767d4021..9b62ffc657 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/TanluManager.java @@ -449,7 +449,7 @@ public class TanluManager implements IMogoMarkerClickListener, } /** - * TODO 释放资源 + * 释放资源 */ public void releaseAction() { // EventBus.getDefault().unregister(this); 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 0a124b9e96..5f64cf646b 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 @@ -40,18 +40,21 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan // 渐变色 List colors = new ArrayList<>(); - if (info.getType() != null) { - if (info.getType().equals("1")) { //预警 TODO - colors.add(0xFFFFA31A); - colors.add(0xFFFFA31A); - } else { - colors.add(0xFFE32F46); - colors.add(0xFFE32F46); - } - } else { - colors.add(0xFFE32F46); - colors.add(0xFFE32F46); - } +// if (info.getType() != null) { +// if (info.getType().equals("1")) { //预警 TODO +// colors.add(0xFFFFA31A); +// colors.add(0xFFFFA31A); +// } else { +// colors.add(0xFFE32F46); +// colors.add(0xFFE32F46); +// } +// } else { +// colors.add(0xFFE32F46); +// colors.add(0xFFE32F46); +// } + + colors.add(0xFFE32F46); + colors.add(0xFFE32F46); // 线条粗细,渐变,渐变色值 Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth()); 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 4362aac4c3..c38d3869d4 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 @@ -42,19 +42,22 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { MogoPolylineOptions options = new MogoPolylineOptions(); List colors = new ArrayList<>(); - if (info.getType() != null) { - if (info.getType().equals("1")) { //预警 TODO - colors.add(0xFFFFA31A); - colors.add(0xFFFFA31A); - } else { - colors.add(0xFFE32F46); - colors.add(0xFFE32F46); - } - } else { - Log.e(V2XConst.LOG_NAME_WARN, "drawWarnPolyline info.getType() == null "); - colors.add(0xFFE32F46); - colors.add(0xFFE32F46); - } +// if (info.getType() != null) { +// if (info.getType().equals("1")) { //预警 TODO +// colors.add(0xFFFFA31A); +// colors.add(0xFFFFA31A); +// } else { +// colors.add(0xFFE32F46); +// colors.add(0xFFE32F46); +// } +// } else { +// Log.e(V2XConst.LOG_NAME_WARN, "drawWarnPolyline info.getType() == null "); +// colors.add(0xFFE32F46); +// colors.add(0xFFE32F46); +// } + + colors.add(0xFFE32F46); + colors.add(0xFFE32F46); Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); // 线条粗细,渐变,渐变色值 From 1bb1cfbc7ed798b233c23ede356038178946fa3f Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 6 Apr 2021 16:25:46 +0800 Subject: [PATCH 09/10] add init live --- .../java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java index b861da543a..2b9dccc17b 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java @@ -13,6 +13,8 @@ import android.widget.TextView; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; +import com.mogo.cloud.live.manager.LiveStreamManagerImpl; +import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.cloud.trafficlive.api.ITrafficCarLiveCallBack; import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; import com.mogo.commons.AbsMogoApplication; @@ -102,6 +104,8 @@ public class CarZegoLiveVideoView extends RoundLayout { */ private void playLiveVideo() { if (mSurfaceView != null) { + LiveStreamManagerImpl.getInstance(AbsMogoApplication.getApp(), + MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId()); MogoLocation mogoLocation = V2XServiceManager.getMogoLocationClient().getLastKnowLocation(); MoGoAiCloudTrafficLive.viewFrontVehicleLive(mogoLocation.getLatitude(), mogoLocation.getLongitude(), ((int) mogoLocation.getBearing()), mSurfaceView, new ITrafficCarLiveCallBack() { @Override From fd221d8137227cd9c20e98b49ebdd2187bb7074c Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 6 Apr 2021 16:43:30 +0800 Subject: [PATCH 10/10] fixbug of init live --- .../v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java | 5 +++++ .../java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java | 2 -- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java index 9f59163b2a..817ba97e12 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/livecar/V2XVoiceCallLiveBiz.java @@ -3,8 +3,11 @@ package com.mogo.module.v2x.scenario.scene.livecar; import android.content.Context; import android.text.TextUtils; +import com.mogo.cloud.live.manager.LiveStreamManagerImpl; +import com.mogo.cloud.passport.MoGoAiCloudClientConfig; import com.mogo.cloud.trafficlive.api.ITrafficIntersectionLiveCallBack; import com.mogo.cloud.trafficlive.api.MoGoAiCloudTrafficLive; +import com.mogo.commons.AbsMogoApplication; import com.mogo.commons.voice.AIAssist; import com.mogo.map.location.MogoLocation; import com.mogo.module.common.entity.V2XMessageEntity; @@ -100,6 +103,8 @@ public class V2XVoiceCallLiveBiz { * 查看前方车辆直播,同方向角 200米范围 */ public void getFrontCarLive() { + LiveStreamManagerImpl.getInstance(AbsMogoApplication.getApp(), + MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId()); V2XMessageEntity v2XMessageEntity = buildCallLiveParams(null, null); mV2XVoiceCallLiveScenario = new V2XVoiceCallLiveScenario(); mV2XVoiceCallLiveScenario.setV2XWindow(new V2XVoiceCallLiveCarWindow()); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java index 2b9dccc17b..b29196ae28 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/view/CarZegoLiveVideoView.java @@ -104,8 +104,6 @@ public class CarZegoLiveVideoView extends RoundLayout { */ private void playLiveVideo() { if (mSurfaceView != null) { - LiveStreamManagerImpl.getInstance(AbsMogoApplication.getApp(), - MoGoAiCloudClientConfig.getInstance().getThirdPartyDeviceId()); MogoLocation mogoLocation = V2XServiceManager.getMogoLocationClient().getLastKnowLocation(); MoGoAiCloudTrafficLive.viewFrontVehicleLive(mogoLocation.getLatitude(), mogoLocation.getLongitude(), ((int) mogoLocation.getBearing()), mSurfaceView, new ITrafficCarLiveCallBack() { @Override