[add] 预警marker打点,类型:行人
This commit is contained in:
@@ -19,20 +19,37 @@ public class V2XWarningEntity implements Serializable {
|
||||
//预测碰撞点位置
|
||||
private double collisionLat;
|
||||
private double collisionLon;
|
||||
//来源 ADAS/云端
|
||||
private int from;
|
||||
//朝向 角度
|
||||
private double angle;
|
||||
//方位 前 后 左 右
|
||||
private int direction;
|
||||
//速度
|
||||
private float speed;
|
||||
//停止线经纬度
|
||||
private double stopLineLat;
|
||||
private double stopLineLon;
|
||||
|
||||
//以下为自组字段
|
||||
//预警文案
|
||||
private String tipContent;
|
||||
//tts播报
|
||||
private String tts;
|
||||
//打点位置
|
||||
private MarkerLocation location;
|
||||
|
||||
public void setLocation(MarkerLocation location) {
|
||||
this.location = location;
|
||||
}
|
||||
|
||||
public MarkerLocation getLocation() {
|
||||
if (location == null) {
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(getLat());
|
||||
location.setLon(getLon());
|
||||
setLocation(location);
|
||||
}
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
public void setTipContent(int type) {
|
||||
switch (type) {
|
||||
@@ -96,10 +113,6 @@ public class V2XWarningEntity implements Serializable {
|
||||
this.collisionLon = collisionLon;
|
||||
}
|
||||
|
||||
public void setFrom(int from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
@@ -137,9 +150,6 @@ public class V2XWarningEntity implements Serializable {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public int getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return angle;
|
||||
@@ -167,6 +177,30 @@ public class V2XWarningEntity implements Serializable {
|
||||
return tts;
|
||||
}
|
||||
|
||||
public void setStopLineLat(double stopLineLat) {
|
||||
this.stopLineLat = stopLineLat;
|
||||
}
|
||||
|
||||
public void setStopLineLon(double stopLineLon) {
|
||||
this.stopLineLon = stopLineLon;
|
||||
}
|
||||
|
||||
public void setTipContent(String tipContent) {
|
||||
this.tipContent = tipContent;
|
||||
}
|
||||
|
||||
public void setTts(String tts) {
|
||||
this.tts = tts;
|
||||
}
|
||||
|
||||
public double getStopLineLat() {
|
||||
return stopLineLat;
|
||||
}
|
||||
|
||||
public double getStopLineLon() {
|
||||
return stopLineLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XWarningEntity{" +
|
||||
@@ -176,12 +210,14 @@ public class V2XWarningEntity implements Serializable {
|
||||
", distance=" + distance +
|
||||
", collisionLat=" + collisionLat +
|
||||
", collisionLon=" + collisionLon +
|
||||
", from=" + from +
|
||||
", angle=" + angle +
|
||||
", direction=" + direction +
|
||||
", speed=" + speed +
|
||||
", stopLineLat=" + stopLineLat +
|
||||
", stopLineLon=" + stopLineLon +
|
||||
", tipContent='" + tipContent + '\'' +
|
||||
", tts='" + tts + '\'' +
|
||||
", location=" + location +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,4 +140,9 @@ public class V2XConst {
|
||||
*/
|
||||
public static final String V2X_OPTIMAL_SPEED_MARKER = "V2X_OPTIMAL_SPEED_MARKER";
|
||||
|
||||
/*
|
||||
*V2X 车路云前方预警
|
||||
* */
|
||||
public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER";
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.view.ViewGroup;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
@@ -44,6 +45,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
public V2XFrontWarningScenario() {
|
||||
setV2XWindow(new V2XWarningWindow());
|
||||
setV2XMarker(new V2XWarningMarker());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -54,6 +56,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
direction = mMarkerEntity.getDirection();
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
show();
|
||||
drawPOI();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -78,6 +81,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(mMarkerEntity);
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +102,8 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
|
||||
getV2XMarker().drawPOI(mMarkerEntity);
|
||||
Log.d(TAG, "drawPOI");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.mogo.module.v2x.scenario.scene.warning;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.module.common.drawer.marker.IMarkerView;
|
||||
import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XMarker;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/3/30
|
||||
*/
|
||||
public class V2XWarningMarker implements IV2XMarker {
|
||||
private V2XWarningEntity mMarkerEntity;
|
||||
private Context mContext = V2XServiceManager.getContext();
|
||||
|
||||
@Override
|
||||
public void drawPOI(Object entity) {
|
||||
try {
|
||||
mMarkerEntity = (V2XWarningEntity) entity;
|
||||
MarkerLocation location = new MarkerLocation();
|
||||
location.setLat(mMarkerEntity.getLat());
|
||||
location.setLon(mMarkerEntity.getLon());
|
||||
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setMarkerLocation(location);
|
||||
markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER);
|
||||
|
||||
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(markerShowEntity.getMarkerLocation().getLat())
|
||||
.longitude(markerShowEntity.getMarkerLocation().getLon());
|
||||
// V2XServiceManager.getMoGoV2XMarkerManager().drawableMarker(mContext, markerShowEntity, null);
|
||||
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
|
||||
Bitmap bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.v2x_road_front_p_warning);
|
||||
options.icon(bitmap);
|
||||
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
}, 1000);
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.mogo.module.v2x.utils;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
@@ -172,7 +175,6 @@ public class TestOnLineCarUtils {
|
||||
|
||||
// 加载数据源
|
||||
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
|
||||
|
||||
V2XMessageEntity<V2XWarningEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"type":0,
|
||||
"targetType": "1",
|
||||
"lat":39.9760799115428,
|
||||
"lon":116.411360351446,
|
||||
"lat":39.977121,
|
||||
"lon":116.417537,
|
||||
"distance": 2.22,
|
||||
"collisionLat": 39.9760799115429,
|
||||
"collisionLon": 116.411360351446,
|
||||
|
||||
Reference in New Issue
Block a user