From ffcf0ca35673c412a36ead0af928ea4d667f133f Mon Sep 17 00:00:00 2001 From: wujifei Date: Wed, 7 Apr 2021 18:06:19 +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 --- .../v2x/adapter/holder/V2XRoadEventVH.java | 8 +- .../mogo/module/v2x/utils/EventTypeUtils.java | 2 +- .../src/main/res/drawable-xhdpi/icon_play.png | Bin 0 -> 847 bytes .../main/res/layout/item_v2x_event_detail.xml | 78 ++++++++++++++++++ .../res/layout/item_v2x_event_detail_vr.xml | 38 ++++++--- 5 files changed, 112 insertions(+), 14 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_play.png 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 8e5b8b24e1..fe7e4d093f 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 ImageView ivPlay; private TextView tvLine; private TextView tvPlay; @@ -163,6 +164,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { ivEvent = itemView.findViewById(R.id.iv_event); tvEvent = itemView.findViewById(R.id.tv_event); + ivPlay = itemView.findViewById(R.id.iv_play); tvLine = itemView.findViewById(R.id.tv_line); tvPlay = itemView.findViewById(R.id.tv_play); } @@ -248,6 +250,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { ivEventImg.setOnClickListener(v -> { showRoadVideoInfo(v2XEventShowEntity); }); + ivPlay.setVisibility(VISIBLE); tvLine.setVisibility(VISIBLE); tvPlay.setVisibility(VISIBLE); tvPlay.setOnClickListener(v -> { @@ -261,6 +264,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { ivEventImg.setOnClickListener(null); ivEventPlay.setOnClickListener(null); ivEventPlay.setVisibility(GONE); + ivPlay.setVisibility(GONE); tvLine.setVisibility(GONE); tvPlay.setVisibility(GONE); } @@ -279,11 +283,11 @@ public class V2XRoadEventVH extends V2XBaseViewHolder { } ivEvent.setImageResource(EventTypeUtils.getPoiTypeSrcVr(mNoveltyInfo.getPoiType())); tvEvent.setText(EventTypeUtils.getPoiTypeStrVr(mNoveltyInfo.getPoiType())); - if (mNoveltyInfo.getPoiType() == V2XPoiTypeEnum.FOURS_FOG) { + if (V2XPoiTypeEnum.FOURS_FOG.equals(mNoveltyInfo.getPoiType())) { 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/java/com/mogo/module/v2x/utils/EventTypeUtils.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/EventTypeUtils.java index ad2838ce84..c8d2e6b766 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/EventTypeUtils.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/utils/EventTypeUtils.java @@ -135,7 +135,7 @@ public class EventTypeUtils { break; // 积水 case V2XPoiTypeEnum.FOURS_PONDING: - str = "前方道路积水道路积水"; + str = "前方道路积水"; break; // 浓雾 case V2XPoiTypeEnum.FOURS_FOG: diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_play.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_play.png new file mode 100644 index 0000000000000000000000000000000000000000..b38e732923807b71918da578a91600d53c308b73 GIT binary patch literal 847 zcmV-V1F-ywP)Px#L}ge>W=%~1DgXcg2mk?xX#fNO00031000^Q000001E2u_0{{R30RRC20H6W@ z1ONa40RR919-spN1ONa40RR916aWAK0D$o?qyPW{xk*GpR7eedR?lk_VGzx?jVVD) zF)5;8(1Sm2R;XL+hcS2T$JgrcLo6BAz_N9*QU) zL`*Qjv_cArjq^VDh1qfI!0gPtdGqGmB;Bn`h;_T&K?zghC&jbked12VK-J6%)eT)cAp z$g!cJ#l_`ZIAa$;i;Hwm>+h#H??5*>M2@dNeg2YewYK`EXJ!u-uiiLZuQxEOImltL z^C2ENnH}aKD8fE!Z!cc14vd~Ye{`k%YPSIFbB+;Q^w{?~F52Qw$szD8KT)mLc1;$q z=WkEX4z}Cvo#uhVIPWN`BT0zBtr!F%CV!G{>EUwr?72(%_4SXbut`lj?{O`x32`|4 zk)^t*RMz^(E?hp)Y;NLvhjHc~Jpzm*A`)XH<`s9kI8C2Lj%+!sw~i<3~&NeE#6JfaIYMJs6io^hso76SZ~-{N>221w}HM?B1EV z)hMq#{~j*oEF$%&ff0>4+;Id@wH5Ni6XRo>l@Dv_`TKJ}3Wbrj;#-~Ad5DMwcr8AY z1n*-I`S_yC%|ZNJI5M4emXxT9}eWVQj_GScv&3(p70KJgaB$7au{kY%$!_1UlsmS@nPBd Z^$%19bA&!gWxfCa002ovPDHLkV1fm$a<~8h literal 0 HcmV?d00001 diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail.xml index bc25522ee9..435eb8b454 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail.xml @@ -205,4 +205,82 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file 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 ac91f6c608..ae2ab6d8bb 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 @@ -229,28 +229,44 @@ android:id="@+id/iv_event" android:layout_width="@dimen/dp_100" android:layout_height="@dimen/dp_100" + android:layout_marginLeft="@dimen/dp_30" android:scaleType="fitXY" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" - android:layout_marginLeft="@dimen/dp_30" app:miv_failureHolder="@drawable/v2x_icon_live_logo" app:miv_overlayImageId="@drawable/v2x_icon_live_logo" app:miv_placeHolder="@drawable/v2x_icon_live_logo" app:miv_topLeftRadius="@dimen/dp_20" /> - + app:layout_constraintTop_toTopOf="parent"> + + + + + + From e3450f20cfdb2de2334feb573fb9f8e7b68fc93a Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 7 Apr 2021 19:16:32 +0800 Subject: [PATCH 02/10] opt --- .../common/drawer/V2XWarnDataDrawer.java | 23 ++--- .../com/mogo/module/v2x/V2XWaringManager.java | 21 +---- .../impl/MoGoPersonWarnPolylineManager.java | 20 +--- .../impl/MoGoV2XCloundDataManager.java | 91 +++++++++++-------- .../manager/impl/MoGoWarnPolylineManager.java | 21 +---- .../scene/warning/V2XWarningMarker.java | 9 +- .../res/raw/scenario_warning_event_data.json | 2 +- 7 files changed, 78 insertions(+), 109 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 bfadaf3c8e..a38bbb0632 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 @@ -26,9 +26,7 @@ import static com.mogo.module.common.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedListener { private static final String TAG = "V2XWarnDataDrawer"; - private static volatile V2XWarnDataDrawer sInstance; - private boolean mChangeCarModeStatus; private V2XWarnDataDrawer() { @@ -80,21 +78,18 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL markerShowEntity.setMarkerLocation(location); markerShowEntity.setMarkerType(TYPE_MARKER_CLOUD_WARN_DATA); - WorkThreadHandler.getInstance().postDelayed(() -> { - IMogoMarker marker = drawMarker(markerShowEntity); - Log.d("liyz", "renderWarnData marker != null "); - marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000); - - //移动完成以后,3s后消失 - UiThreadHandler.postDelayed( () -> { - marker.remove(); - }, 8000 ); - - }, 0); + IMogoMarker marker = drawMarker(markerShowEntity); + Log.d("liyz", "renderWarnData marker != null "); + marker.addDynamicAnchorPosition(new MogoLatLng(data.getCollisionLat(), data.getCollisionLon()), (float) data.getHeading(), 5000); + //移动完成以后,3s后消失 + UiThreadHandler.postDelayed(() -> { + marker.remove(); + }, 8000); } + public IMogoMarker drawMarker(MarkerShowEntity markerShowEntity) { MogoMarkerOptions options = new MogoMarkerOptions() .object(markerShowEntity) @@ -104,7 +99,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL options.icon3DRes(getModelRes(2)); //TODO // options.anchorColor("#FF4040"); - options.anchorColor("#FF3036"); //红色 + options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), options); iMarkerView.setMarker(marker); marker.setToTop(); 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 a274f3d9c6..66bc31e67d 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 @@ -138,27 +138,8 @@ public class V2XWaringManager { // info1.setHeading(10); // info1.setStartLocation(startLatlng1); // info1.setEndLocation(endLatlng1); -// -// //只有在3d模型下高精数据才有值 TODO -// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { -// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(116.411198243370, -// 39.9809517154582, (float) 3.13919341919472 , true, true); -// Log.d(V2XConst.LOG_NAME_WARN, "roadWidth = " + roadWidth); -// float pixel = V2XServiceManager.getMapUIController().getScalePerPixel(); -// float width = roadWidth / pixel; -// Log.d(V2XConst.LOG_NAME_WARN, "width = " + width + "---pixel = " + pixel); -// info1.setWidth(roadWidth); -// } -// -// V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info1); -// -// //延迟3秒清理线 -// UiThreadHandler.postDelayed( () -> { -// V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); -// }, 3000 ); - - // adas 每隔一秒传递的他车或行人数据 + // adas 每隔一秒传递的他车或行人数据,避免重复 // V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> { // // 绘制近景识别到的车辆,行人和二轮车 // AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList ); 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 5f64cf646b..d2d42ead25 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 @@ -39,26 +39,12 @@ 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); -// } - colors.add(0xFFE32F46); colors.add(0xFFE32F46); // 线条粗细,渐变,渐变色值 - Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth()); - options.width(info.getWidth()).useGradient(true).transparency(0.1f).colorValues(colors); + Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager width = " + info.getWidth()); + options.width(info.getWidth()).useGradient(true).colorValues(colors); // 当前车辆位置 options.add(info.getStartLocation()); // 目标车辆位置 @@ -66,7 +52,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan // 绘制线的对象 mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - + mMogoPolyline.setTransparency(0.5f); } catch (Exception e) { e.printStackTrace(); } 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 c7bfc74e61..e4722c5036 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 @@ -1,15 +1,19 @@ package com.mogo.module.v2x.manager.impl; import android.content.Context; +import android.content.Intent; import android.location.Location; import android.util.Log; +import androidx.localbroadcastmanager.content.LocalBroadcastManager; + import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.MogoLatLng; 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.V2XMessageEntity; import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.v2x.MoGoV2XServicePaths; import com.mogo.module.v2x.V2XConst; @@ -18,7 +22,7 @@ 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; @@ -31,6 +35,7 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext; public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 { private V2XWarningEntity mCloundWarningInfo; private static String TAG = "MoGoV2XCloundDataManager"; + private boolean isSelfLineClear; @Override public void init(Context context) { @@ -44,18 +49,36 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog mCloundWarningInfo = cloundWarningInfo; - //绘制识别物与交汇点连线,并且更新连线数据 + //发送预警提示 + V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>(); + // 控制类型 + v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP); + // 设置数据 + v2xMessageEntity.setContent(cloundWarningInfo); + // 控制展示状态 + v2xMessageEntity.setShowState(true); + + Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); + intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity); + LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); + + isSelfLineClear = false; + WorkThreadHandler.getInstance().postDelayed(() -> { + //绘制识别物与交汇点连线,并且更新连线数据 drawOtherObjectLine(cloundWarningInfo); + + //二轮车和行人的渲染和移动 + V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); + }, 0); - //二轮车和行人的渲染和移动 - V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo); - //延迟3秒清理线 - UiThreadHandler.postDelayed( () -> { + UiThreadHandler.postDelayed(() -> { V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); - }, 8000 ); + V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + isSelfLineClear = true; + }, 8000); } /** @@ -68,6 +91,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog Log.d(V2XConst.LOG_NAME_WARN, "polyLine != null"); polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()), new MogoLatLng(info.getCollisionLat(), info.getCollisionLon()))); + polyLine.setTransparency(0.5f); } else { Log.e(V2XConst.LOG_NAME_WARN, "polyLine == null"); DrawLineInfo lineInfo = new DrawLineInfo(); @@ -76,15 +100,14 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog lineInfo.setStartLocation(startLatlng); lineInfo.setEndLocation(endLatlng); lineInfo.setHeading(info.heading); - if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) { + 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, "drawOtherObjectLine width = " + info.getRoadwidth()); - lineInfo.setWidth(info.getRoadwidth()); } + Log.d(V2XConst.LOG_NAME_WARN, "drawOtherObjectLine width = " + info.getRoadwidth()); + lineInfo.setWidth(info.getRoadwidth()); V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo); } - } else { Log.e(V2XConst.LOG_NAME_WARN, "info == null"); V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); @@ -101,35 +124,31 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog */ @Override public void onCarLocationChanged2(Location latLng) { - Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude()); +// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear); //当行人经纬度交点 经纬度不为空,开始画线,否则清理 //自车只需要关注移动 - IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); - if (mCloundWarningInfo != null) { - if (mogoPolyline != null) { - mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()), - new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon()))); - + if (!isSelfLineClear) { + IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); + if (mCloundWarningInfo != null) { + if (mogoPolyline != null) { + mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()), + new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon()))); + mogoPolyline.setTransparency(0.5f); + } else { + 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(mCloundWarningInfo.getRoadwidth()); //TODO 还需要转换比例尺 + V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info); + } } else { - 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(mCloundWarningInfo.getRoadwidth()); //TODO 还需要转换比例尺 - V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info); - } - - //延迟3秒清理线 TODO 何时 清理 - UiThreadHandler.postDelayed( () -> { + Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null"); V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); - }, 13000 ); - - } else { - Log.e(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 mCloundWarningInfo == null"); - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + } } } 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 c38d3869d4..00af025217 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,34 +42,21 @@ 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); -// } - colors.add(0xFFE32F46); colors.add(0xFFE32F46); - Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); + Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + info.getWidth()); // 线条粗细,渐变,渐变色值 - options.width(info.getWidth()).useGradient(true).transparency(0.9f).colorValues(colors); -// options.width(info.getWidth()).useGradient(true).colorValues(colors); // 当前车辆位置 + options.width(info.getWidth() == 0.0 ? 60 : info.getWidth()).useGradient(true).colorValues(colors); +// options.width(60).useGradient(true).colorValues(colors); options.add(info.getStartLocation()); // 目标车辆位置 options.add(info.getEndLocation()); // 绘制线的对象 mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); + mMogoPolyline.setTransparency(0.5f); } catch (Exception e) { e.printStackTrace(); 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 4c9e3078ae..d7566943a1 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 @@ -48,7 +48,7 @@ public class V2XWarningMarker implements IV2XMarker { if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { pointsBetween(); //绘制停止线 - drawStopLines(fillPoints); +// drawStopLines(fillPoints); drawSafeLine(); WorkThreadHandler.getInstance().postDelayed(() -> { V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_STOP_LINE); @@ -72,9 +72,9 @@ public class V2XWarningMarker implements IV2XMarker { //根据到停止线的距离和方向角获取经纬度 MogoLatLng stopLineLo = LocationUtils.getNewLocation(car, mMarkerEntity.getStopLineDistance(), mMarkerEntity.getAngle()); - if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() > 0) { - drawLine(car, stopLineLo); - } +// if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() > 0) { +// drawLine(car, stopLineLo); +// } } else { Log.d(TAG, "自车位置没有拿到"); } @@ -152,6 +152,7 @@ public class V2XWarningMarker implements IV2XMarker { DrawLineInfo drawLineInfo = new DrawLineInfo(); drawLineInfo.setStartLocation(s); drawLineInfo.setEndLocation(e); + drawLineInfo.setWidth(60); V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, drawLineInfo); } 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 838ce52329..57b0dca7d9 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 @@ -26,5 +26,5 @@ "warningContent": "小心行人", "heading": 30, "showTime": 3000, - "roadwidth": 65.0 + "roadwidth": 60.0 } \ No newline at end of file From b0f5bcb6541bfd3941738c0b99b40041611086fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=AE=87?= Date: Wed, 7 Apr 2021 20:00:23 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=A7=A6=E5=8F=91=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/gradle.xml | 1 + .../src/main/java/com/mogo/module/extensions/navi/TopView.java | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 83405b8de1..4ff10f68a5 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -91,6 +91,7 @@ diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java index a883d44ad8..1648a8b388 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/navi/TopView.java @@ -52,8 +52,7 @@ public class TopView extends FrameLayout { originX = ev.getY(); } else if (ev.getAction() == MotionEvent.ACTION_MOVE) { // 垂直滑动,事件拦截 - return Math.abs(originY - ev.getY()) > ViewConfiguration.get(getContext()).getScaledTouchSlop() - ||Math.abs(originX - ev.getX()) > ViewConfiguration.get(getContext()).getScaledTouchSlop(); + return Math.abs(originY - ev.getY()) > ViewConfiguration.get(getContext()).getScaledTouchSlop(); } return false; } From 49d2f2a8f594381a62ea74490583462cd533ceee Mon Sep 17 00:00:00 2001 From: wujifei Date: Wed, 7 Apr 2021 20:05:38 +0800 Subject: [PATCH 04/10] =?UTF-8?q?new#=E4=BC=98=E5=8C=96Vr=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E6=95=85=E9=9A=9C=E6=B1=82=E5=8A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scene/help/V2XCarForHelpScenario.java | 12 ++++++------ .../scenario/scene/help/V2XCarForHelpWindow.java | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java index e1f35a4d4c..09fa98f8ee 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java @@ -67,7 +67,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM } else { closeWindow(); } - // return; + return; } if (isShow) { showButton(); @@ -98,8 +98,8 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM public void showWindow() { if (getV2XWindow() != null) { ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140)); + ViewGroup.LayoutParams.MATCH_PARENT, + (int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140)); V2XServiceManager.getMogoTopViewManager().addView(getV2XWindow().getView(), layoutParams); getV2XWindow().show(getV2XMessageEntity().getContent()); } @@ -107,9 +107,9 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM @Override public void closeWindow() { - if (getV2XWindow() != null) { - getV2XWindow().close(); - } +// if (getV2XWindow() != null) { +// getV2XWindow().close(); +// } } private V2XVoiceCallbackListener cancelCb = null; diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java index 84b1c8081d..00ecfd0077 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java @@ -75,10 +75,8 @@ public class V2XCarForHelpWindow extends V2XBasWindow implements IV2XWindow() { @Override public void onSuccess(BaseData result) { - AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null); //移除窗体 V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this); - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP); } @Override @@ -86,6 +84,20 @@ public class V2XCarForHelpWindow extends V2XBasWindow implements IV2XWindow Date: Thu, 8 Apr 2021 11:03:43 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scene/warning/V2XFrontWarningScenario.java | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) 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 2355cc0096..d8031e5759 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 @@ -42,7 +42,7 @@ import java.util.List; * @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警 * @since: 2021/3/24 */ -public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener , IMogoCarLocationChangedListener2 { +public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener { private int direction; private V2XWarningEntity mMarkerEntity; @@ -134,14 +134,4 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV } - @Override - public void onCarLocationChanged2(Location latLng) { - - } - - @Override - public void onCarLocationChanged(MogoLatLng latLng) { - mMarkerEntity.setCarLocation(latLng); - drawPOI(); - } } From 4d82c47eb35d12ce4d7925c37d4b39c59da4e75f Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 8 Apr 2021 14:18:15 +0800 Subject: [PATCH 06/10] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scenario/scene/test/V2XTestConsoleWindow.java | 12 ------------ .../src/main/res/layout/window_test_console.xml | 14 -------------- 2 files changed, 26 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java index eed5b0425d..be6b1185a1 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/test/V2XTestConsoleWindow.java @@ -53,7 +53,6 @@ public class V2XTestConsoleWindow extends ConstraintLayout { private Button mBtnTriggerRoadEvent; private Button mBtnClearRoadEvent; private Button mBtnTriggerPushEvent; - private Button mBtnTriggerWarningEvent; private Button mBtnTriggerPushLiveCarEvent; private Button mBtnTriggerAnimationEvent; private Button mBtnbtnFrontCarLiveEvent; @@ -117,7 +116,6 @@ public class V2XTestConsoleWindow extends ConstraintLayout { mBtnTriggerOpen = findViewById(R.id.btnTriggerOpen); mBtnClearRoadEvent = findViewById(R.id.btnClearRoadEvent); mBtnTriggerRoadEvent = findViewById(R.id.btnTriggerRoadEvent); - mBtnTriggerWarningEvent = findViewById(R.id.btnTriggerWarningEvent); mBtnTriggerPushEvent = findViewById(R.id.btnTriggerPushEvent); mBtnTriggerPushLiveCarEvent = findViewById(R.id.btnTriggerPushLiveCarEvent); mBtnTriggerAnimationEvent = findViewById(R.id.btnTriggerAnimationEvent); @@ -222,16 +220,6 @@ public class V2XTestConsoleWindow extends ConstraintLayout { }); - //车路云—场景预警-V1.0 碰撞预警 - mBtnTriggerWarningEvent.setOnClickListener(v -> { - V2XMessageEntity v2XMessageEntity = - TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData(); - - Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION); - intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity); - LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent); - }); - mBtnTriggerPushEvent.setOnClickListener(v -> { V2XMessageEntity v2XMessageEntity = TestOnLineCarUtils.getV2XScenarioPushEventData(); diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml index 85c806cb25..7c1583a11d 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/window_test_console.xml @@ -238,20 +238,6 @@ android:textSize="@dimen/dp_22" android:textStyle="bold" /> -