diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java index 78e6e6e47d..dbcd153c22 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XPushMessageEntity.java @@ -3,6 +3,7 @@ package com.mogo.module.common.entity; import android.text.TextUtils; import java.io.Serializable; +import java.util.List; import java.util.Objects; /** @@ -29,8 +30,7 @@ public class V2XPushMessageEntity implements Serializable { private String videoChannel; private int expireTime; private long createTime; - private double lat; - private double lon; + private String sn; private String headImgUrl; private String msgImgUrl; @@ -43,6 +43,11 @@ public class V2XPushMessageEntity implements Serializable { private int sex; private long userId; + private double lat; + private double lon; + + private List polyline; + public int getViewType() { return viewType; } @@ -266,6 +271,14 @@ public class V2XPushMessageEntity implements Serializable { this.userId = userId; } + public List getPolyline() { + return polyline; + } + + public void setPolyline(List polyline) { + this.polyline = polyline; + } + @Override public boolean equals(Object o) { if (this == o) { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java index f0c145d8d4..13312c991d 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/pushVR/V2XPushVREventMarker.java @@ -1,15 +1,14 @@ package com.mogo.module.v2x.scenario.scene.pushVR; -import com.mogo.module.common.entity.MarkerExploreWay; -import com.mogo.module.common.entity.MarkerExploreWayItem; -import com.mogo.module.common.entity.MarkerLocation; -import com.mogo.module.common.entity.V2XPoiTypeEnum; +import com.mogo.map.MogoLatLng; +import com.mogo.map.overlay.IMogoPolyline; +import com.mogo.map.overlay.MogoPolylineOptions; import com.mogo.module.common.entity.V2XPushMessageEntity; -import com.mogo.module.common.entity.V2XRoadEventEntity; +import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.listener.V2XMarkerClickListener; import com.mogo.module.v2x.scenario.view.IV2XMarker; import com.mogo.module.v2x.utils.MarkerUtils; +import com.mogo.utils.logger.Logger; import java.util.ArrayList; import java.util.List; @@ -22,42 +21,52 @@ import java.util.List; * version: 1.0 */ public class V2XPushVREventMarker implements IV2XMarker { + private final String TAG = "V2XPushVREventMarker"; + + private static IMogoPolyline mMogoPolyline; + @Override public void drawPOI(V2XPushMessageEntity entity) { + Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "drawPOI 绘制VR Marker"); + try { // 清除道路事件 V2XServiceManager .getMoGoV2XMarkerManager().clearALLPOI(); - // 位置信息 - MarkerLocation markerLocation = new MarkerLocation(); - markerLocation.setLon(entity.getLon()); - markerLocation.setLat(entity.getLat()); + if (mMogoPolyline != null) { + mMogoPolyline.remove(); + } - // 进行数据转换,用于Marker展示 - V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity(); - v2XRoadEventEntity.setLocation(markerLocation); - // 探路目前只有上报拥堵 - v2XRoadEventEntity.setPoiType(V2XPoiTypeEnum.ALERT_TRAFFIC_EXPRESS); + // 连接线参数 + MogoPolylineOptions options = new MogoPolylineOptions(); - MarkerExploreWay markerNoveltyInfo = new MarkerExploreWay(); + // 渐变色 + List colors = new ArrayList<>(); + colors.add(0xFFFA8C34); + colors.add(0xFFBD6D36); + colors.add(0xFFFA8C34); - List items = new ArrayList<>(); - MarkerExploreWayItem exploreWayItem = new MarkerExploreWayItem(); - exploreWayItem.setThumbnail(entity.getMsgImgUrl()); - items.add(exploreWayItem); - markerNoveltyInfo.setPoiType(V2XPoiTypeEnum.ALERT_TRAFFIC_EXPRESS); - markerNoveltyInfo.setItems(items); - markerNoveltyInfo.setUploadType("1"); + // 线条粗细,渐变,渐变色值 + options.width(10).useGradient(true).colorValues(colors); - v2XRoadEventEntity.setNoveltyInfo(markerNoveltyInfo); - v2XRoadEventEntity.setExpireTime(20000); + for (double[] doubles : entity.getPolyline()) { + options.add(doubles[0],doubles[1]); + } + // 当前车辆位置 +// MogoLatLng carLocation = V2XServiceManager.getNavi().getCarLocation(); +// if (carLocation != null) { +// options.add(carLocation); +// } else { +// options.add(V2XServiceManager.getV2XStatusManager().getLocation()); +// } +// // 目标车辆位置 +// options.add(entity.getLon(), entity.getLat()); + + + // 绘制线的对象 + mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - V2XServiceManager - .getMoGoV2XMarkerManager() - .drawableAlarmPOI(V2XServiceManager.getContext(), - v2XRoadEventEntity, - V2XMarkerClickListener.getInstance()); } catch (Exception e) { e.printStackTrace(); @@ -69,10 +78,18 @@ public class V2XPushVREventMarker implements IV2XMarker { // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 MarkerUtils.resetMapZoom(16); // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); + clearLine(); // 移除事件POI V2XServiceManager.getMoGoV2XMarkerManager().clearAlarmPOI(); // 绘制上次的数据 V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); } + + public void clearLine() { + if (mMogoPolyline != null) { + mMogoPolyline.remove(); + mMogoPolyline = null; + V2XServiceManager.getV2XStatusManager().setAlarmInfo(null); + } + } } diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json index a724bde64f..d97df3895b 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_barrier_data.json @@ -11,8 +11,8 @@ "tts": "前方发现障碍物注意避让", "zoom": false, "zoomScale": 15, - "lat": 40.968678, - "lon": 116.405467, + "lat": 40.195204, + "lon": 116.725092, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json index 9532b6d466..1e7377e4a9 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_behind_danger_car_data.json @@ -11,8 +11,8 @@ "tts": "发现后方车辆超速,注意保持车道", "zoom": false, "zoomScale": 15, - "lat": 40.968678, - "lon": 116.405467, + "lat": 40.195204, + "lon": 116.725092, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json index 346e288e7d..2b117e711f 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_car_break_data.json @@ -11,8 +11,8 @@ "tts": "前车急刹注意减速", "zoom": false, "zoomScale": 15, - "lat": 40.968678, - "lon": 116.405467, + "lat": 40.195204, + "lon": 116.725092, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json index cfe56edbf5..24dc98ea44 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_shuangshan.json @@ -14,9 +14,9 @@ "zoomScale": 15, "userHead": "", "msgImgUrl": "", - "lat": 40.195246, - "lon": 116.728154, - "polyLine": [ + "lat": 40.195204, + "lon": 116.725092, + "polyline": [ [ 116.725092, 40.195204 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json index cfe56edbf5..382ee8769d 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_event_data_yongdu.json @@ -16,7 +16,7 @@ "msgImgUrl": "", "lat": 40.195246, "lon": 116.728154, - "polyLine": [ + "polyline": [ [ 116.725092, 40.195204 diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json index b79e0b3eea..6e30d6ffb2 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_hehind_vip_data.json @@ -11,8 +11,8 @@ "tts": "发现后方VIP车辆,注意避让", "zoom": false, "zoomScale": 15, - "lat": 40.968678, - "lon": 116.405467, + "lat": 40.195204, + "lon": 116.725092, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json index 293720ccad..1cbcfaa335 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_reverse_car_data.json @@ -11,8 +11,8 @@ "tts": "对向来车注意减速", "zoom": false, "zoomScale": 15, - "lat": 40.968678, - "lon": 116.405467, + "lat": 40.195204, + "lon": 116.725092, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json index 6f813c17c8..75b2010462 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_vip_light_change_data.json @@ -11,8 +11,8 @@ "tts": "已为您变灯,可优先通行", "zoom": false, "zoomScale": 15, - "lat": 40.968678, - "lon": 116.405467, + "lat": 40.195204, + "lon": 116.725092, "userHead": "", "msgImgUrl": "", "polyline": [ diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json index 6fd53b8765..dab74b6060 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_push_vr_xingren_yujing_data.json @@ -11,8 +11,8 @@ "tts": "检测到路口行人穿行注意避让", "zoom": false, "zoomScale": 15, - "lat": 40.968678, - "lon": 116.405467, + "lat": 40.195204, + "lon": 116.725092, "userHead": "", "msgImgUrl": "", "polyline": [