[add] 前方预警弹框数据结构
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 预警目标物数据模型
|
||||
* @since: 2021/3/26
|
||||
*/
|
||||
public class V2XWarningEntity implements Serializable {
|
||||
|
||||
//事件类型 碰撞预警/盲区变道预警...
|
||||
private String type;
|
||||
//目标物类型
|
||||
private String targetType;
|
||||
//目标物位置
|
||||
private double lat;
|
||||
private double lon;
|
||||
//距离
|
||||
private double distance;
|
||||
//预测碰撞点位置
|
||||
private double collisionLat;
|
||||
private double collisionLon;
|
||||
//来源 ADAS/云端
|
||||
private int from;
|
||||
//朝向 角度
|
||||
private double angle;
|
||||
//方位 前 后 左 右
|
||||
private int direction;
|
||||
//速度
|
||||
private float speed;
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setTargetType(String targetType) {
|
||||
this.targetType = targetType;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setCollisionLat(double collisionLat) {
|
||||
this.collisionLat = collisionLat;
|
||||
}
|
||||
|
||||
public void setCollisionLon(double collisionLon) {
|
||||
this.collisionLon = collisionLon;
|
||||
}
|
||||
|
||||
public void setFrom(int from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public void setDirection(int direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public String getTargetType() {
|
||||
return targetType;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getCollisionLat() {
|
||||
return collisionLat;
|
||||
}
|
||||
|
||||
public double getCollisionLon() {
|
||||
return collisionLon;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
|
||||
public int getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XWarningEntity{" +
|
||||
"type='" + type + '\'' +
|
||||
", targetType='" + targetType + '\'' +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", distance=" + distance +
|
||||
", collisionLat=" + collisionLat +
|
||||
", collisionLon=" + collisionLon +
|
||||
", from='" + from + '\'' +
|
||||
", angle='" + angle + '\'' +
|
||||
", direction='" + direction + '\'' +
|
||||
", speed=" + speed +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
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.V2XServiceManager;
|
||||
@@ -220,7 +221,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
|
||||
//车路云—场景预警-V1.0 碰撞预警
|
||||
mBtnTriggerWarningEvent.setOnClickListener(v->{
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
|
||||
V2XMessageEntity<V2XWarningEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData();
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
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.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.MogoServices;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
@@ -39,9 +40,7 @@ import java.util.List;
|
||||
*/
|
||||
public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener {
|
||||
private int type;
|
||||
private IV2XListener mIV2XListener;
|
||||
private List<V2XSpecialCarRes.V2XMarkerEntity> mMarkerEntity;
|
||||
private V2XPushMessageEntity mV2XPushMessageEntity;
|
||||
private V2XWarningEntity mMarkerEntity;
|
||||
|
||||
public V2XFrontWarningScenario() {
|
||||
setV2XWindow(new V2XWarningWindow());
|
||||
@@ -52,16 +51,13 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
type = v2XMessageEntity.getType();
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithType(type, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
try {
|
||||
if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
|
||||
if (getV2XMessageEntity() != null &&
|
||||
!V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
|
||||
show();
|
||||
}
|
||||
if (v2XMessageEntity != null && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
|
||||
mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent();
|
||||
show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
show();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,7 +67,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
// if (getV2XWindow() != null && mMarkerEntity != null) {
|
||||
if (getV2XWindow() != null && mMarkerEntity != null) {
|
||||
View view = getV2XWindow().getView();
|
||||
//Logger.d(MODULE_NAME, "添加window= " + view);
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
@@ -81,8 +77,8 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopV
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(mV2XPushMessageEntity);
|
||||
// }
|
||||
getV2XWindow().show(mMarkerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
@@ -25,6 +26,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
|
||||
private ImageView typeImage;
|
||||
private TextView warningTextView;
|
||||
private TextView distance;
|
||||
private V2XWarningEntity mV2XWarningEntity;
|
||||
|
||||
//倒计时3s弹框取消
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
@@ -56,7 +58,8 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
|
||||
@Override
|
||||
public void show(Object entity) {
|
||||
if (entity != null) {
|
||||
|
||||
mV2XWarningEntity = (V2XWarningEntity) entity;
|
||||
distance.setText(String.valueOf(mV2XWarningEntity.getDistance())+"米");
|
||||
}
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.mogo.module.common.entity.MarkerResponse;
|
||||
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.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -156,7 +157,7 @@ public class TestOnLineCarUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushFrontWarningEventData() {
|
||||
public static V2XMessageEntity<V2XWarningEntity> getV2XScenarioPushFrontWarningEventData() {
|
||||
try {
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
@@ -170,13 +171,13 @@ public class TestOnLineCarUtils {
|
||||
inputStream.close();
|
||||
|
||||
// 加载数据源
|
||||
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
|
||||
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
|
||||
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
V2XMessageEntity<V2XWarningEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2xRoadEventEntity);
|
||||
v2xMessageEntity.setContent(warningEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
return v2xMessageEntity;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:layout_toRightOf="@+id/warning_type_image"
|
||||
android:text="前车碰撞预警"
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_32" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -1,12 +1,14 @@
|
||||
{
|
||||
"systemTime":1615529739389,
|
||||
"satelliteTime":1615529739389,
|
||||
"lon":116.411360351446,
|
||||
"lat":39.9760799115428,
|
||||
"alt":34.4648361206054,
|
||||
"heading":359.939618623258,
|
||||
"speed":11.108121,
|
||||
"type":3,
|
||||
"uuid":"2_1",
|
||||
"direction": "0"
|
||||
"targetType": "1",
|
||||
"lat":39.9760799115428,
|
||||
"lon":116.411360351446,
|
||||
"distance": 2.22,
|
||||
"collisionLat": 39.9760799115429,
|
||||
"collisionLon": 116.411360351446,
|
||||
"from": 1,
|
||||
"angle": 120,
|
||||
"direction": 1,
|
||||
"speed":11.108121
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user