|
|
|
|
@@ -58,7 +58,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|
|
|
|
private MogoLatLng middleLocationInStopLine;
|
|
|
|
|
private V2XFrontWarningScenario mV2XScenario;
|
|
|
|
|
|
|
|
|
|
private static long showTime = 0;
|
|
|
|
|
private static long showTime = 4000;
|
|
|
|
|
private float bearing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -70,70 +70,69 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
|
|
|
|
|
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
|
|
|
|
mCloundWarningInfo = cloundWarningInfo;
|
|
|
|
|
showTime = mCloundWarningInfo.getShowTime();
|
|
|
|
|
pointsBetween();
|
|
|
|
|
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
|
|
|
|
|
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
|
|
|
|
mCloundWarningInfo = cloundWarningInfo;
|
|
|
|
|
showTime = mCloundWarningInfo.getShowTime();
|
|
|
|
|
pointsBetween();
|
|
|
|
|
bearing = V2XLocationListener.getInstance().getLastCarLocation().getBearing();
|
|
|
|
|
|
|
|
|
|
//顶部弹框
|
|
|
|
|
if (mV2XScenario == null) {
|
|
|
|
|
mV2XScenario = new V2XFrontWarningScenario();
|
|
|
|
|
}
|
|
|
|
|
mV2XScenario.setWarningEntity(cloundWarningInfo);
|
|
|
|
|
mV2XScenario.init(null);
|
|
|
|
|
//预警蒙层
|
|
|
|
|
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
|
|
|
|
isSelfLineClear = false;
|
|
|
|
|
isFirstLocation = false;
|
|
|
|
|
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
|
|
|
|
if (cloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO
|
|
|
|
|
middleLocationInStopLine = getMiddleLocationInStopLine();
|
|
|
|
|
//如果是正前方类型,红色绘制区域从停止线向前绘制50米
|
|
|
|
|
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle());
|
|
|
|
|
//停止线前方画线
|
|
|
|
|
WorkThreadHandler.getInstance().postDelayed(() -> {
|
|
|
|
|
//二轮车和行人的渲染和移动
|
|
|
|
|
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
|
|
|
|
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
|
|
|
|
//绘制识别物与交汇点连线,并且更新连线数据
|
|
|
|
|
drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation);
|
|
|
|
|
//添加停止线marker
|
|
|
|
|
handleStopLine();
|
|
|
|
|
//自车画线
|
|
|
|
|
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
|
|
|
|
}, 500);
|
|
|
|
|
//顶部弹框
|
|
|
|
|
if (mV2XScenario == null) {
|
|
|
|
|
mV2XScenario = new V2XFrontWarningScenario();
|
|
|
|
|
}
|
|
|
|
|
mV2XScenario.setWarningEntity(cloundWarningInfo);
|
|
|
|
|
mV2XScenario.init(null);
|
|
|
|
|
//预警蒙层
|
|
|
|
|
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(cloundWarningInfo.getDirection(), MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
|
|
|
|
isSelfLineClear = false;
|
|
|
|
|
isFirstLocation = false;
|
|
|
|
|
V2XServiceManager.getMarkerManager().removeMarkers(WARNING_ARROWS);
|
|
|
|
|
if (cloundWarningInfo.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) { //前方 TODO
|
|
|
|
|
middleLocationInStopLine = getMiddleLocationInStopLine();
|
|
|
|
|
//如果是正前方类型,红色绘制区域从停止线向前绘制50米
|
|
|
|
|
MogoLatLng warningLocation = Trigonometric.getNewLocation(middleLocationInStopLine, 50, cloundWarningInfo.getAngle());
|
|
|
|
|
//停止线前方画线
|
|
|
|
|
WorkThreadHandler.getInstance().postDelayed(() -> {
|
|
|
|
|
//二轮车和行人的渲染和移动
|
|
|
|
|
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
|
|
|
|
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
|
|
|
|
//绘制识别物与交汇点连线,并且更新连线数据
|
|
|
|
|
drawRedWarningLineFrontOfStopLine(cloundWarningInfo, middleLocationInStopLine, warningLocation);
|
|
|
|
|
//添加停止线marker
|
|
|
|
|
handleStopLine();
|
|
|
|
|
//自车画线
|
|
|
|
|
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
UiThreadHandler.postDelayed(() -> {
|
|
|
|
|
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
|
|
|
|
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
|
|
|
|
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
|
|
|
|
|
isSelfLineClear = true;
|
|
|
|
|
}, showTime);
|
|
|
|
|
UiThreadHandler.postDelayed(() -> {
|
|
|
|
|
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
|
|
|
|
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
|
|
|
|
V2XServiceManager.getMoGoStopPolylineManager().clearLine();
|
|
|
|
|
isSelfLineClear = true;
|
|
|
|
|
}, showTime);
|
|
|
|
|
|
|
|
|
|
} else { //左侧或者右侧
|
|
|
|
|
WorkThreadHandler.getInstance().postDelayed(() -> {
|
|
|
|
|
//绘制识别物与交汇点连线,并且更新连线数据
|
|
|
|
|
drawOtherObjectLine(cloundWarningInfo);
|
|
|
|
|
//二轮车和行人的渲染和移动
|
|
|
|
|
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
|
|
|
|
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
|
|
|
|
} else { //左侧或者右侧
|
|
|
|
|
WorkThreadHandler.getInstance().postDelayed(() -> {
|
|
|
|
|
//绘制识别物与交汇点连线,并且更新连线数据
|
|
|
|
|
drawOtherObjectLine(cloundWarningInfo);
|
|
|
|
|
//二轮车和行人的渲染和移动
|
|
|
|
|
V2XServiceManager.getMarkerManager().removeMarkers(TYPE_MARKER_CLOUD_WARN_DATA);
|
|
|
|
|
V2XWarnDataDrawer.getInstance().renderWarnData(cloundWarningInfo);
|
|
|
|
|
|
|
|
|
|
//车辆静止的时候
|
|
|
|
|
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
|
|
|
|
//车辆静止的时候
|
|
|
|
|
drawSelfCarLine(carLocation.lon, carLocation.lat, bearing);
|
|
|
|
|
|
|
|
|
|
}, 500);
|
|
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
|
//延迟3秒清理线
|
|
|
|
|
UiThreadHandler.postDelayed(() -> {
|
|
|
|
|
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
|
|
|
|
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
|
|
|
|
isSelfLineClear = true;
|
|
|
|
|
}, showTime);
|
|
|
|
|
//延迟3秒清理线
|
|
|
|
|
UiThreadHandler.postDelayed(() -> {
|
|
|
|
|
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
|
|
|
|
|
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
|
|
|
|
isSelfLineClear = true;
|
|
|
|
|
}, showTime);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 自车为起点绘制(根据设计,前方行人/弱势交通参与者预警 getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP自车与停止线之间为蓝色预警;其他侧方预警自车与预碰撞点之间显示红色预警)
|
|
|
|
|
@@ -208,7 +207,8 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|
|
|
|
/**
|
|
|
|
|
* 场景如:车辆行驶正前方绘制红色区域(停止线继续前行的预警区域) TODO 需要实时给行人当前位置
|
|
|
|
|
*/
|
|
|
|
|
private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng startLatLng, MogoLatLng mogoLatLng) {
|
|
|
|
|
private void drawRedWarningLineFrontOfStopLine(V2XWarningEntity info, MogoLatLng
|
|
|
|
|
startLatLng, MogoLatLng mogoLatLng) {
|
|
|
|
|
if (info != null) {
|
|
|
|
|
IMogoPolyline polyLine = V2XServiceManager.getMoGoStopPolylineManager().getMogoStopPolyline();
|
|
|
|
|
MogoLatLng endLatlng = new MogoLatLng(mogoLatLng.lat, mogoLatLng.lon);
|
|
|
|
|
@@ -310,13 +310,13 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
|
|
|
|
|
@Override
|
|
|
|
|
public void onCarLocationChanged2(Location latLng) {
|
|
|
|
|
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 lat = " + latLng.getLatitude() + "--lon =" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
|
|
|
|
|
// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
|
|
|
|
//当行人经纬度交点 开始画线,否则清理
|
|
|
|
|
if (mCloundWarningInfo != null) {
|
|
|
|
|
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
|
|
|
|
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
|
|
|
|
//当行人经纬度交点 开始画线,否则清理
|
|
|
|
|
if (mCloundWarningInfo != null) {
|
|
|
|
|
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
|
|
|
|
|
}
|
|
|
|
|
drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
|
|
|
|
|
}
|
|
|
|
|
drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
|
|
|
|
|
// }
|
|
|
|
|
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|