Merge branch 'dev_robotaxi-d-app-module_2120_221017_2.12.0' into dev_robotaxi-d-app-module_2120_yyk_2.12.0
# Conflicts: # OCH/mogo-och-bus/src/main/java/com/mogo/och/bus/model/BusOrderModel.java
This commit is contained in:
@@ -329,69 +329,42 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private fun refreshCarState(location: MogoLocation) {
|
||||
V2XStatusManager.getInstance().location = location
|
||||
// V2XAiRoadEventMarker.onLocationChanged(location)
|
||||
// 只有车速大于 5 的时候进行计算
|
||||
if (location.speed < 5) return
|
||||
val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline
|
||||
val isRoadEventPOIShow = BridgeApi.v2xStatus()?.isRoadEventPOIShow ?: false
|
||||
val isOtherSeekHelpPOIShow = BridgeApi.v2xStatus()?.isOtherSeekHelpPOIShow ?: false
|
||||
val v2xStatusManager = V2XStatusManager.getInstance()
|
||||
if (v2xPolyline != null && (isRoadEventPOIShow or isOtherSeekHelpPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点
|
||||
if (v2xPolyline != null && (isRoadEventPOIShow) && v2xStatusManager.targetMoGoLatLng != null) { // 取出原有的绘制线的经纬度点
|
||||
// 取出原有的绘制线的经纬度点
|
||||
val pointsOdl: MutableList<MogoLatLng> = v2xPolyline.points // 重新设置第一个坐标,也就是当前车辆位置
|
||||
// 重新设置第一个坐标,也就是当前车辆位置
|
||||
pointsOdl[0] = MogoLatLng(location.latitude, location.longitude)
|
||||
v2xPolyline.points = pointsOdl
|
||||
|
||||
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
||||
val zoomLevel: Float = CallerMapUIServiceManager.getMapUIController()?.zoomLevel ?: 0.0f
|
||||
//CallerLogger.d("$M_V2X$TAG", "当前地图的缩放比例为:" + zoomLevel);
|
||||
if (zoomLevel > 0 && zoomLevel <= 17 && BridgeApi.v2xStatus()?.isRoadEventWindowShow == false) { // 缩放地图
|
||||
if (zoomLevel > 0 && zoomLevel <= 17) { // 缩放地图
|
||||
val context: Context = context()
|
||||
MapUtils.zoomMap(v2xStatusManager.targetMoGoLatLng, context)
|
||||
}
|
||||
}
|
||||
|
||||
// if (DebugConfig.isMapBased()) { // 只有自研车机才有疲劳驾驶检测
|
||||
// // 只有自研车机才有疲劳驾驶检测
|
||||
// if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
|
||||
// V2XAlarmServer.getFatigueDrivingShow(location) { drivingShowEntity ->
|
||||
// CallerLogger.i("$M_V2X$TAG", "疲劳驾驶POI查询结果为: " + GsonUtil.jsonFromObject(drivingShowEntity))
|
||||
// val style = if (V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) "1" else "2"
|
||||
// com.mogo.module.v2x.listener.V2XLocationListener.trackWithType(ALERT_FATIGUE_DRIVING.poiType, drivingShowEntity.getLon(), drivingShowEntity.getLat(), style)
|
||||
// val v2XMessageEntity = V2XMessageEntity<V2XPushMessageEntity>()
|
||||
// v2XMessageEntity.type = V2XTypeEnum.ALERT_FATIGUE_DRIVING
|
||||
// v2XMessageEntity.setContent(drivingShowEntity)
|
||||
// v2XMessageEntity.isShowState = drivingShowEntity.isShowWindow() // 广播给ADAS Launcher
|
||||
// ADASUtils.broadcastToADAS(context(), drivingShowEntity)
|
||||
// V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// 巡航处理
|
||||
val v2XRoadEventEntity = V2XAlarmServer.getDriveFrontAlarmEvent(
|
||||
BridgeApi.v2xMarker()?.v2XRoadEventEntityList,
|
||||
V2XStatusManager.getInstance().location
|
||||
) // 距离是否大于10米 && 消息是否不为空
|
||||
// 距离是否大于10米 && 消息是否不为空
|
||||
if (v2XRoadEventEntity != null && v2XRoadEventEntity.distance >= 5) { // CallerLogger.w("$M_V2X$TAG",
|
||||
// //"\nV2X预警--当前导航状态:" + V2XServiceManager.getNavi().isNaviing() +
|
||||
// //"\nV2X预警--roadEventIsNullCount:" + roadEventIsNullCount +
|
||||
// "\nV2X预警--当前预警事件:" + v2XRoadEventEntity
|
||||
// );
|
||||
// CallerLogger.w("$M_V2X$TAG", "V2X预警--前方数据距离:" + v2XRoadEventEntity.getDistance());
|
||||
// 触发展示操作
|
||||
TrackUtils.trackV2xRoadProduceEvent(1)
|
||||
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
|
||||
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
|
||||
v2XMessageEntity.content = v2XRoadEventEntity
|
||||
v2XMessageEntity.isShowState = true
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
|
||||
|
||||
// 存储本地,出行动态作展示
|
||||
saveLocalStory(V2XTypeEnum.ALERT_ROAD_WARNING, v2XRoadEventEntity.noveltyInfo)
|
||||
|
||||
)
|
||||
if (v2XRoadEventEntity != null) { // CallerLogger.w("$M_V2X$TAG",
|
||||
val distance = v2XRoadEventEntity.distance
|
||||
val min = if (EventTypeEnum.AI_ROAD_WORK.poiType == v2XRoadEventEntity.poiType) 0 else 5
|
||||
Logger.d(TAG, "--- trigger show before ---:data=>[${location.longitude}, ${location.latitude}, ${location.speed}], distance: $distance, minDistance: $min, poiType: ${v2XRoadEventEntity.poiType}")
|
||||
if (distance >= min) {
|
||||
Logger.d(TAG, "--- trigger show ---:poiType:" + v2XRoadEventEntity.poiType)
|
||||
TrackUtils.trackV2xRoadProduceEvent(1)
|
||||
val v2XMessageEntity = V2XMessageEntity<V2XRoadEventEntity>()
|
||||
v2XMessageEntity.type = V2XTypeEnum.ALERT_ROAD_WARNING
|
||||
v2XMessageEntity.content = v2XRoadEventEntity
|
||||
v2XMessageEntity.isShowState = true
|
||||
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,11 +480,6 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
|
||||
private fun handleRoadMarkerEvent(data: V2XMarkerCardResult) {
|
||||
try {
|
||||
BridgeApi.v2xStatus()?.let {
|
||||
if (it.isRoadEventWindowShow) {
|
||||
return
|
||||
}
|
||||
}
|
||||
scope.launch(Dispatchers.Default) {
|
||||
BridgeApi.v2xMarker()?.analysisV2XRoadEvent(data)
|
||||
}
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.alarm;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.constant.TimeConstants;
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import io.netty.util.internal.ConcurrentSet;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -29,11 +24,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
public class V2XAlarmServer {
|
||||
|
||||
// 记录道路播报的事件
|
||||
public static ConcurrentHashMap<V2XRoadEventEntity, String> mAlertRoadEventList = new ConcurrentHashMap<>();
|
||||
|
||||
// 记录违章停车播报事件
|
||||
private static final HashMap<MarkerExploreWay, String> mAlertIllegalParkEventList = new HashMap<>();
|
||||
|
||||
private static ConcurrentSet<V2XRoadEventEntity> showedEvents = new ConcurrentSet<>();
|
||||
/**
|
||||
* 获取当前车辆前方距离最近的道路事件
|
||||
*/
|
||||
@@ -41,9 +32,22 @@ public class V2XAlarmServer {
|
||||
CopyOnWriteArrayList<V2XRoadEventEntity> v2XRoadEventEntityList,
|
||||
MogoLocation currentLocation) {
|
||||
try {
|
||||
// 检测道路事件是否需UGC问答
|
||||
V2XEarlyWarningServer.roadEventUgcCheck(currentLocation);
|
||||
// 60(km/h)
|
||||
if (!showedEvents.isEmpty()) {
|
||||
Iterator<V2XRoadEventEntity> iterator = showedEvents.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
V2XRoadEventEntity next = iterator.next();
|
||||
if (next == null) {
|
||||
continue;
|
||||
}
|
||||
MarkerLocation poiLocation = next.getLocation();
|
||||
if (poiLocation == null) {
|
||||
continue;
|
||||
}
|
||||
if (isOutOfRange(poiLocation.getLon(), poiLocation.getLat(), currentLocation.getLongitude(), currentLocation.getLatitude(), currentLocation.getBearing())) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (currentLocation != null && v2XRoadEventEntityList != null) {
|
||||
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
|
||||
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
|
||||
@@ -73,71 +77,14 @@ public class V2XAlarmServer {
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
if (0 <= eventAngle && eventAngle <= 20) {
|
||||
// 判断是否已经提示过道路事件
|
||||
boolean isAlreadyAlert = false;
|
||||
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
|
||||
if (!TextUtils.isEmpty(lastTime)) {
|
||||
long timeSpan = Math.abs(TimeUtils.getTimeSpanByNow(lastTime, TimeConstants.MIN));
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer",
|
||||
// "V2X预警--事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n上一次预警时间:" + lastTime +
|
||||
// "\n距离当前时间:" + timeSpan);
|
||||
// 5分钟内不重复提醒
|
||||
if (timeSpan < 5) {
|
||||
isAlreadyAlert = true;
|
||||
}
|
||||
if (showedEvents.contains(v2XRoadEventEntity)) {
|
||||
return null;
|
||||
}
|
||||
// 进行提醒
|
||||
if (!isAlreadyAlert) {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆与事件信息:" +
|
||||
// "\n事件详情ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo()) +
|
||||
// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
|
||||
// "\n是否已经提醒:" + isAlreadyAlert +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
|
||||
// "\n当前车辆-角度:" + currentLocation.getBearing() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLon() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLat() +
|
||||
// "\n道路事件-角度:" + eventLocation.getAngle() +
|
||||
// "\n夹角角度:" + eventAngle + " 度"
|
||||
// );
|
||||
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
|
||||
return v2XRoadEventEntity;
|
||||
}
|
||||
return null;
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--事件与车头角度夹角过大:" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLongitude() +
|
||||
// "\n当前车辆-经度:" + currentLocation.getLatitude() +
|
||||
// "\n当前车辆-角度:" + currentLocation.getBearing() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLon() +
|
||||
// "\n道路事件-经度:" + eventLocation.getLat() +
|
||||
// "\n道路事件-角度:" + eventLocation.getAngle() +
|
||||
// "\n夹角角度:" + eventAngle + " 度"
|
||||
// );
|
||||
showedEvents.add(v2XRoadEventEntity);
|
||||
return v2XRoadEventEntity;
|
||||
}
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer",
|
||||
// "V2X预警--车头方向与事件方向角度不一致:" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n车头方向: " + carBearing +
|
||||
// "\n事件方向:" + eventBearing +
|
||||
// "\n角度差值:" + diffAngle
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + "V2XAlarmServer", "V2X预警--车辆距离事件距离大于500米了:" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
|
||||
// "\n距离:" + v2XRoadEventEntity.getDistance() + "米"
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
// CallerLogger.INSTANCE.e(M_V2X + "V2XAlarmServer",
|
||||
// "V2X预警--道路事件没有角度信息" +
|
||||
// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
|
||||
// );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,4 +94,14 @@ public class V2XAlarmServer {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private static boolean isOutOfRange(double poi_lon, double poi_lat, double car_lon, double car_lat, double car_angle) {
|
||||
return !isFrontOfCar(poi_lon, poi_lat, car_lon, car_lat, car_angle);
|
||||
}
|
||||
|
||||
private static boolean isFrontOfCar(double poi_lon, double poi_lat, double car_lon, double car_lat, double car_angle) {
|
||||
double degree = DrivingDirectionUtils.getDegreeOfCar2Poi(car_lon, car_lat, poi_lon, poi_lat, (int)car_angle);
|
||||
return degree <= 90;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.alarm;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
|
||||
import com.mogo.eagle.core.function.v2x.events.utils.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.Utils;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.enums.EventTypeEnum;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
/**
|
||||
* V2X 道路预警服务
|
||||
*/
|
||||
public class V2XEarlyWarningServer {
|
||||
private static final String TAG = "V2XEarlyWarningServer";
|
||||
|
||||
private static ArrayList<String> alertMessageId = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 对提醒过的道路事件进行UGC检测
|
||||
*
|
||||
* @param currentLocation 当前车辆位置
|
||||
*/
|
||||
public static void roadEventUgcCheck(MogoLocation currentLocation) {
|
||||
|
||||
try {
|
||||
if (currentLocation != null) {
|
||||
// 循环已经播报的道路事件,将刚行驶过的道路事件进行弹窗交互,进行UGC问答,
|
||||
Set<V2XRoadEventEntity> keySet = V2XAlarmServer.mAlertRoadEventList.keySet();
|
||||
for (V2XRoadEventEntity v2XRoadEventEntity : keySet) {
|
||||
// 计算车辆距离指定气泡的距离
|
||||
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
|
||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.getLongitude(),
|
||||
currentLocation.getLatitude(),
|
||||
eventLocation.getLon(),
|
||||
eventLocation.getLat(),
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
|
||||
double carBearing = currentLocation.getBearing();
|
||||
String roadInfoId = v2XRoadEventEntity.getNoveltyInfo().getInfoId();
|
||||
|
||||
// 封路、施工、拥堵、拥堵 才会有UGC提示
|
||||
if (EventTypeEnum.isNeedRoadEventUgc(v2XRoadEventEntity.getPoiType())) {
|
||||
// CallerLogger.INSTANCE.d(M_V2X + TAG,
|
||||
// "V2X预警--UGC检测:" +
|
||||
// "\n事件详情:" + roadInfoId +
|
||||
// "\n事件详情:" + EventTypeUtils.getPoiTypeStr(v2XRoadEventEntity.getPoiType()) +
|
||||
// "\n车头方向: " + carBearing +
|
||||
// "\n车与事件夹角:" + eventAngle +
|
||||
// "\n已经UGC的事件:" + GsonUtil.jsonFromObject(alertMessageId)
|
||||
// );
|
||||
// 判断是否预警过了
|
||||
if (!alertMessageId.contains(roadInfoId)) {
|
||||
// 判断车辆行驶角度是否与事件相反,相反的话表示已经行驶过去了
|
||||
if (80 <= eventAngle) {
|
||||
// CallerLogger.INSTANCE.d(M_V2X + TAG, "V2X预警UGC--事件与车头角度夹角过大:" +
|
||||
// "\n角度:" + eventAngle + " 度" +
|
||||
// "\n事件详情:" + roadInfoId +
|
||||
// "\n库存事件:" + V2XAlarmServer.mAlertRoadEventList.size()
|
||||
// );
|
||||
|
||||
// 记录已经 UGC 提醒过的数据
|
||||
alertMessageId.add(roadInfoId);
|
||||
|
||||
// 加载数据源
|
||||
V2XMessageEntity<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_EVENT_UGC_WARNING);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
// 弹出UGC
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
|
||||
LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent);
|
||||
|
||||
}
|
||||
// 移出已经预警的事件列表
|
||||
//V2XAlarmServer.mAlertRoadEventList.remove(v2XRoadEventEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,26 +15,6 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isRoadEventPOIShow();
|
||||
|
||||
/**
|
||||
* 按钮区 V2X道路预警 是否在展示
|
||||
*/
|
||||
boolean isRoadEventButtonShow();
|
||||
|
||||
/**
|
||||
* 头部 V2X道路预警 UI 是否在展示
|
||||
*/
|
||||
boolean isRoadEventWindowShow();
|
||||
|
||||
/**
|
||||
* 头部 他人车辆故障求助 UI 是否在展示
|
||||
*/
|
||||
boolean isOtherSeekHelpWindowShow();
|
||||
|
||||
/**
|
||||
* 地图区域 他人车辆故障求助POI 是否在展示
|
||||
*/
|
||||
boolean isOtherSeekHelpPOIShow();
|
||||
|
||||
/**
|
||||
* 设置 V2X道路预警POI 是否在展示
|
||||
*
|
||||
@@ -43,67 +23,6 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
void setRoadEventPOIShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 V2X道路预警 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setRoadEventButtonShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 右侧2/3 头部 V2X道路预警 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setRoadEventWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 右侧2/3 头部 V2X的道路直播 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setRoadLiveCarWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 他人车辆故障求助 UI 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setOtherSeekHelpWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 右侧2/3 全屏 V2X 场景动画 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setV2XAnimationWindowShow(String tag, boolean show);
|
||||
|
||||
/*
|
||||
* 道路事件图片/视频资源 全屏
|
||||
* */
|
||||
void setV2XRoadVideoWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 设置 模拟直播车机 UI 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setLiveCarWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 推送弹窗的状态
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setPushWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 地图区域 推送的 POI 是否在展示
|
||||
*
|
||||
@@ -112,11 +31,4 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
void setPushPOIShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 地图区域 疲劳驾驶 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setFatigueDrivingWindowShow(String tag, boolean show);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
private static final CopyOnWriteArraySet<V2XRoadEventEntity> mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>();
|
||||
// 上次的道路事件的预警Marker
|
||||
private static IMogoMarker mAlarmInfoMarker;
|
||||
private static IMogoMarker m3DMarker;
|
||||
|
||||
@Override
|
||||
public void drawableLastAllPOI() {
|
||||
@@ -81,7 +80,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
CopyOnWriteArrayList<V2XRoadEventEntity> roadEventEntities = new CopyOnWriteArrayList<>();
|
||||
// 当前车辆数据
|
||||
MogoLocation currentLocation = V2XStatusManager.getInstance().getLocation();
|
||||
|
||||
if (currentLocation != null) {
|
||||
// 重新计算距离
|
||||
for (V2XRoadEventEntity v2XRoadEventEntity : mV2XRoadEventEntityArrayList) {
|
||||
@@ -96,7 +94,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
}
|
||||
roadEventEntities.add(v2XRoadEventEntity);
|
||||
}
|
||||
|
||||
// 按照与当前车辆距离排序
|
||||
for (int i = 0; i < roadEventEntities.size(); i++) {
|
||||
for (int j = i; j > 0; j--) {
|
||||
@@ -107,37 +104,17 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
//输出日志查看结果
|
||||
// for (int i = 0; i < roadEventEntities.size(); i++) {
|
||||
// CallerLogger.INSTANCE.w(M_V2X + TAG, "V2X===" +
|
||||
// "事件名称:" + roadEventEntities.get(i).getNoveltyInfo() +
|
||||
// "\t 事件距离:" + roadEventEntities.get(i).getDistance());
|
||||
// }
|
||||
}
|
||||
|
||||
return roadEventEntities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void analysisV2XRoadEvent(V2XMarkerCardResult markerCardResult) {
|
||||
boolean isShowEventWindow = false;
|
||||
boolean isShowEventButton = false;
|
||||
boolean isOtherSeekHelpWindowShow = false;
|
||||
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
|
||||
if (v2xStatus != null) {
|
||||
//预警Window状态
|
||||
isShowEventWindow = v2xStatus.isRoadEventWindowShow();
|
||||
//预警按钮状态
|
||||
isShowEventButton = v2xStatus.isRoadEventButtonShow();
|
||||
//道路求助的window
|
||||
isOtherSeekHelpWindowShow = v2xStatus.isOtherSeekHelpWindowShow();
|
||||
}
|
||||
try {
|
||||
//当没有预警提示的时候重新绘制地图POI点
|
||||
if (markerCardResult != null && !isShowEventWindow && !isShowEventButton && !isOtherSeekHelpWindowShow) {
|
||||
if (markerCardResult != null) {
|
||||
// 清除上次的道路事件, 这里注意,道路事件的触发和这里是异步操作会触发异常
|
||||
mV2XRoadEventEntityArrayList.clear();
|
||||
|
||||
// 获取探路以及新鲜事儿
|
||||
List<V2XMarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
|
||||
if (exploreWayList != null) {
|
||||
@@ -149,7 +126,6 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
|
||||
v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation));
|
||||
// 探路目前只有上报拥堵
|
||||
String poi = markerExploreWay.getPoiType();
|
||||
|
||||
v2XRoadEventEntity.setPoiType(poi);
|
||||
v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay,markerCardResult.getExtras()));
|
||||
v2XRoadEventEntity.setExpireTime(20000);
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -53,26 +52,6 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
|
||||
return get_bool_val(V2XStatusDescriptor.RoadEventPOI_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRoadEventButtonShow() {
|
||||
return get_bool_val(V2XStatusDescriptor.RoadEventButton_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRoadEventWindowShow() {
|
||||
return get_bool_val(V2XStatusDescriptor.RoadEventWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOtherSeekHelpWindowShow() {
|
||||
return get_bool_val(V2XStatusDescriptor.OtherSeekHelpWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOtherSeekHelpPOIShow() {
|
||||
return get_bool_val(V2XStatusDescriptor.OtherSeekHelpPOI_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRoadEventPOIShow(String tag, boolean show) {
|
||||
IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
|
||||
@@ -84,62 +63,6 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventPOI_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRoadEventButtonShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.RoadEventButton_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.RoadEventButton_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventButton_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRoadEventWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.RoadEventWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.RoadEventWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRoadLiveCarWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.RoadLiveCarWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.RoadLiveCarWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.RoadLiveCarWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOtherSeekHelpWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.OtherSeekHelpWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.OtherSeekHelpWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.OtherSeekHelpWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setV2XAnimationWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.V2XAnimationWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setV2XRoadVideoWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.V2XAnimationWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.V2XRoadVideo_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.V2XRoadVideo_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLiveCarWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.LiveCarWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.LiveCarWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.LiveCarWindow_UI);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPushWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.PushWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.PushWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.PushWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPushPOIShow(String tag, boolean show) {
|
||||
@@ -148,14 +71,7 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.PushWindowPOI_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFatigueDrivingWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.FatigueDrivingWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.FatigueDrivingWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.FatigueDrivingWindow_UI);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 调用所有存储的监听
|
||||
*
|
||||
* @param descriptor
|
||||
|
||||
@@ -58,10 +58,10 @@ object AiRoadMarker {
|
||||
}
|
||||
|
||||
private val checkExpiredTask = Runnable {
|
||||
val marker = this@AiRoadMarker.marker.get()
|
||||
if (marker != null) {
|
||||
unMarker(marker)
|
||||
}
|
||||
// val marker = this@AiRoadMarker.marker.get()
|
||||
// if (marker != null) {
|
||||
// unMarker(marker)
|
||||
// }
|
||||
}
|
||||
|
||||
private val onClearAllMarker = object : OnClearAllMarker {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road
|
||||
|
||||
import android.graphics.*
|
||||
import android.util.*
|
||||
import com.mogo.cloud.commons.utils.*
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
@@ -14,6 +15,7 @@ import com.mogo.module.common.utils.*
|
||||
import java.util.*
|
||||
import java.util.concurrent.atomic.*
|
||||
import kotlin.Pair
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
object V2XAiRoadEventMarker {
|
||||
|
||||
@@ -29,6 +31,8 @@ object V2XAiRoadEventMarker {
|
||||
|
||||
private val distance = AtomicInteger(0)
|
||||
|
||||
private val overlayManager by lazy { MogoOverlayManager.getInstance() }
|
||||
|
||||
fun drawMarkers(entity: V2XRoadEventEntity): Pair<IMogoPolyline?, List<IMogoMarker>?>? {
|
||||
removeMarkers(current.get())
|
||||
timerTask.get()?.cancel()
|
||||
@@ -69,7 +73,32 @@ object V2XAiRoadEventMarker {
|
||||
v2xMarker()?.drawableAlarmPOI(context(), entity, null)
|
||||
val l2 = entity.noveltyInfo?.location ?: return null
|
||||
v2xLocation.set(MogoLocation().also { it.longitude = l2.lon; it.latitude = l2.lat; it.bearing = l2.angle.toFloat() })
|
||||
current.set(Pair(null, markers))
|
||||
|
||||
val options = MogoPolylineOptions()
|
||||
val colors = ArrayList<Int>()
|
||||
colors.add(Color.argb(204, 237, 172, 21))
|
||||
colors.add(Color.argb(0, 255, 255, 255))
|
||||
options.colorValues(colors)
|
||||
val points = ArrayList<MogoLatLng>()
|
||||
|
||||
for (p in polygons) {
|
||||
points.add(MogoLatLng(p.second, p.first))
|
||||
}
|
||||
if (points.size > 2) {
|
||||
points.add(points[0])
|
||||
}
|
||||
options.points(points);
|
||||
options.useGradient(true)
|
||||
options.useFacade(true)
|
||||
options.setGps(false)
|
||||
options.width(5f)
|
||||
options.zIndex(75000f)
|
||||
options.maxIndex(800000f)
|
||||
val line = overlayManager.addPolyline(options)
|
||||
current.set(Pair(line, markers))
|
||||
if (line != null) {
|
||||
line.isVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user