Merge remote-tracking branch 'origin/demo/shunyi_vr_map' into demo/shunyi_vr_map
This commit is contained in:
@@ -124,23 +124,23 @@ public class V2XAlarmServer {
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" +
|
||||
"\n角度:" + eventAngle + " 度" +
|
||||
"\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
);
|
||||
// Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" +
|
||||
// "\n角度:" + eventAngle + " 度" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了:" +
|
||||
"\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
"\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
);
|
||||
// Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了:" +
|
||||
// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
Logger.w(MODULE_NAME,
|
||||
"V2X预警--车头方向与事件方向角度不一致:" +
|
||||
"\n车头方向: " + currentLocation.getBearing() +
|
||||
"\n事件方向:" + v2XRoadEventEntity.getLocation().getAngle()
|
||||
);
|
||||
// Logger.w(MODULE_NAME,
|
||||
// "V2X预警--车头方向与事件方向角度不一致:" +
|
||||
// "\n车头方向: " + currentLocation.getBearing() +
|
||||
// "\n事件方向:" + v2XRoadEventEntity.getLocation().getAngle()
|
||||
// );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,10 +101,6 @@ public class V2XMessageListener_401003 implements IMogoOnMessageListener<V2XPush
|
||||
showTip(alarmMessage.getTts());
|
||||
ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), alarmMessage);
|
||||
break;
|
||||
//以下为V推送场景
|
||||
case "200006"://对向来车
|
||||
showTip(alarmMessage.getTts());
|
||||
break;
|
||||
default:
|
||||
ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), alarmMessage);
|
||||
break;
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.module.v2x.scenario.scene.livecar.V2XPushLiveCarScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.livecar.V2XVoiceCallLiveScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.pushVR.V2XPushVREventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
@@ -99,6 +100,9 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_VOICE_CALL_FOR_LIVECAR_SHOW:
|
||||
mV2XScenario = V2XVoiceCallLiveScenario.getInstance();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
|
||||
mV2XScenario = V2XPushVREventScenario.getInstance();
|
||||
break;
|
||||
default:
|
||||
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
|
||||
TipToast.tip("当前V2X消息类型未定义");
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
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.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 推送VR场景
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
@Override
|
||||
public void drawPOI(V2XPushMessageEntity entity) {
|
||||
try {
|
||||
// 清除道路事件
|
||||
V2XServiceManager
|
||||
.getMoGoV2XMarkerManager().clearALLPOI();
|
||||
|
||||
// 位置信息
|
||||
MarkerLocation markerLocation = new MarkerLocation();
|
||||
markerLocation.setLon(entity.getLon());
|
||||
markerLocation.setLat(entity.getLat());
|
||||
|
||||
// 进行数据转换,用于Marker展示
|
||||
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
|
||||
v2XRoadEventEntity.setLocation(markerLocation);
|
||||
// 探路目前只有上报拥堵
|
||||
v2XRoadEventEntity.setPoiType(V2XPoiTypeEnum.ALERT_TRAFFIC_EXPRESS);
|
||||
|
||||
MarkerExploreWay markerNoveltyInfo = new MarkerExploreWay();
|
||||
|
||||
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");
|
||||
|
||||
v2XRoadEventEntity.setNoveltyInfo(markerNoveltyInfo);
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
|
||||
V2XServiceManager
|
||||
.getMoGoV2XMarkerManager()
|
||||
.drawableAlarmPOI(V2XServiceManager.getContext(),
|
||||
v2XRoadEventEntity,
|
||||
V2XMarkerClickListener.getInstance());
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
// 移除线
|
||||
V2XServiceManager.getMoGoV2XPolylineManager().clearLine();
|
||||
// 移除事件POI
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().clearAlarmPOI();
|
||||
// 绘制上次的数据
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
package com.mogo.module.v2x.scenario.scene.pushVR;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/5/15 5:37 PM
|
||||
* desc : 推送VR场景控制
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushVREventScenario
|
||||
extends AbsV2XScenario<V2XPushMessageEntity>
|
||||
implements IMogoTopViewStatusListener {
|
||||
private String TAG = "V2XPushVREventWindow";
|
||||
|
||||
private static V2XPushVREventScenario mV2XPushEventScenario;
|
||||
|
||||
private V2XPushVREventScenario() {
|
||||
}
|
||||
|
||||
public static V2XPushVREventScenario getInstance() {
|
||||
if (mV2XPushEventScenario == null) {
|
||||
synchronized (V2XPushVREventScenario.class) {
|
||||
if (mV2XPushEventScenario == null) {
|
||||
mV2XPushEventScenario = new V2XPushVREventScenario();
|
||||
mV2XPushEventScenario.setV2XMarker(new V2XPushVREventMarker());
|
||||
mV2XPushEventScenario.setV2XWindow(new V2XPushVREventWindow());
|
||||
}
|
||||
}
|
||||
}
|
||||
return mV2XPushEventScenario;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR场景:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
|
||||
if (!isSameScenario(v2XMessageEntity)
|
||||
&& V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
} else {
|
||||
closeWindow();
|
||||
setV2XMessageEntity(v2XMessageEntity);
|
||||
show();
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "要处理的场景已经存在,丢弃这次初始化");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
|
||||
speakTTSVoice(getV2XMessageEntity().getContent().getTts(), null);
|
||||
drawPOI();
|
||||
showWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, false);
|
||||
if (getV2XWindow() != null) {
|
||||
getV2XWindow().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
if (getV2XButton() != null) {
|
||||
getV2XButton().close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
if (getV2XMarker() != null) {
|
||||
getV2XMarker().clearPOI();
|
||||
}
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, false);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "展示 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "关闭 Window 动画结束");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "展示 Window 开始");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "关闭 Window 开始");
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, false);
|
||||
// 重置场景提示的消息
|
||||
setV2XMessageEntity(null);
|
||||
clearPOI();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.mogo.module.v2x.scenario.scene.pushVR;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/14 2:37 PM
|
||||
* desc :
|
||||
* TODO 只有VR演示场景使用
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
private String TAG = "V2XPushVREventWindow";
|
||||
|
||||
// 处理道路事件,30秒倒计时
|
||||
private Handler handlerV2XEvent = new Handler();
|
||||
private Runnable runnableV2XEvent;
|
||||
private int mExpireTime = 30000;
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@Override
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=推送消息:展示 Window=\n" + entity);
|
||||
|
||||
V2XServiceManager
|
||||
.getMogoEntranceButtonController()
|
||||
.showLeftNoticeByType(
|
||||
IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED,
|
||||
R.drawable.module_v2x_left_notice_seek_help,
|
||||
entity.getAlarmContent());
|
||||
countDownV2XEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭详情展示框
|
||||
*/
|
||||
@Override
|
||||
public void close() {
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=关闭Window");
|
||||
V2XServiceManager
|
||||
.getMogoEntranceButtonController()
|
||||
.hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED);
|
||||
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 窗体倒计时
|
||||
*/
|
||||
public void countDownV2XEvent() {
|
||||
// 倒计时
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=30秒倒计时结束。。。");
|
||||
// 移出Window详细信息
|
||||
close();
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=推送消息 Window 展示开始倒计时:" + mExpireTime);
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
* 逆向车辆路线预判
|
||||
* */
|
||||
btnTriggerReverseVehicleRoutePrediction.setOnClickListener(v -> {
|
||||
V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> v2XMessageEntity =
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarionVRReverseCarData();
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
@@ -253,7 +253,12 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
*拥堵路线推荐
|
||||
* */
|
||||
btnTriggerCongestedRouteRecommendation.setOnClickListener(v -> {
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarioPushVR();
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
@@ -327,7 +327,7 @@ public class TestOnLineCarUtils {
|
||||
/**
|
||||
* 逆向车辆路线预判
|
||||
*/
|
||||
public static V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> getV2XScenarionVRReverseCarData() {
|
||||
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarionVRReverseCarData() {
|
||||
try {
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
@@ -341,14 +341,46 @@ public class TestOnLineCarUtils {
|
||||
inputStream.close();
|
||||
|
||||
// 加载数据源
|
||||
V2XSpecialCarRes v2xRoadEventEntity =
|
||||
GsonUtil.objectFromJson(baos.toString(), V2XSpecialCarRes.class);
|
||||
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
|
||||
|
||||
V2XMessageEntity<List<V2XSpecialCarRes.V2XMarkerEntity>> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING);
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2xRoadEventEntity.getCoordinates());
|
||||
v2xMessageEntity.setContent(v2xRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
return v2xMessageEntity;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟H5推送场景---推送VR场景信息
|
||||
*/
|
||||
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushVR() {
|
||||
try {
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
.openRawResource(R.raw.scenario_push_vr_event_data_yongdu);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int len = -1;
|
||||
byte[] buffer = new byte[1024];
|
||||
while ((len = inputStream.read(buffer)) != -1) {
|
||||
baos.write(buffer, 0, len);
|
||||
}
|
||||
inputStream.close();
|
||||
|
||||
// 加载数据源
|
||||
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
|
||||
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2xRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
return v2xMessageEntity;
|
||||
|
||||
Reference in New Issue
Block a user