开始绘制对象来车的场景
This commit is contained in:
@@ -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<double[]> polyline;
|
||||
|
||||
public int getViewType() {
|
||||
return viewType;
|
||||
}
|
||||
@@ -266,6 +271,14 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public List<double[]> getPolyline() {
|
||||
return polyline;
|
||||
}
|
||||
|
||||
public void setPolyline(List<double[]> polyline) {
|
||||
this.polyline = polyline;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
|
||||
@@ -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<V2XPushMessageEntity> {
|
||||
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<Integer> colors = new ArrayList<>();
|
||||
colors.add(0xFFFA8C34);
|
||||
colors.add(0xFFBD6D36);
|
||||
colors.add(0xFFFA8C34);
|
||||
|
||||
List<MarkerExploreWayItem> 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<V2XPushMessageEntity> {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"tts": "前方发现障碍物注意避让",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"lat": 40.195204,
|
||||
"lon": 116.725092,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"tts": "发现后方车辆超速,注意保持车道",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"lat": 40.195204,
|
||||
"lon": 116.725092,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"tts": "前车急刹注意减速",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"lat": 40.195204,
|
||||
"lon": 116.725092,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
"msgImgUrl": "",
|
||||
"lat": 40.195246,
|
||||
"lon": 116.728154,
|
||||
"polyLine": [
|
||||
"polyline": [
|
||||
[
|
||||
116.725092,
|
||||
40.195204
|
||||
|
||||
@@ -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": [
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"tts": "对向来车注意减速",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"lat": 40.195204,
|
||||
"lon": 116.725092,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"tts": "已为您变灯,可优先通行",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"lat": 40.195204,
|
||||
"lon": 116.725092,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
"tts": "检测到路口行人穿行注意避让",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"lat": 40.968678,
|
||||
"lon": 116.405467,
|
||||
"lat": 40.195204,
|
||||
"lon": 116.725092,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"polyline": [
|
||||
|
||||
Reference in New Issue
Block a user