[dev_arch_opt_3.0][v2x]v2x代码重构

This commit is contained in:
renwj
2023-01-31 12:20:42 +08:00
parent 6bc41b01fa
commit e01716f30a
31 changed files with 42 additions and 1038 deletions

View File

@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mogo.eagle.core.function.v2x">
<application>
<receiver android:name=".events.receiver.TestPanelBroadcastReceiver">
<receiver android:name=".events.test.TestV2XReceiver">
<intent-filter>
<action android:name="com.v2x.test_panel_control" />
<category android:name="android.intent.category.DEFAULT" />

View File

@@ -36,10 +36,8 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.v2x.events.alarm.*
import com.mogo.eagle.core.function.v2x.events.bridge.*
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
import com.mogo.eagle.core.function.v2x.events.consts.*
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst.*
import com.mogo.eagle.core.function.v2x.events.manager.*
import com.mogo.eagle.core.function.v2x.events.observer.*
import com.mogo.eagle.core.function.v2x.events.receiver.*
import com.mogo.eagle.core.function.v2x.events.scenario.impl.*
import com.mogo.eagle.core.function.v2x.events.utils.*
@@ -49,12 +47,10 @@ import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback
import com.mogo.eagle.core.function.v2x.internal.config.V2XConfig
import com.mogo.eagle.core.function.v2x.internal.data.V2XAdvanceWarning
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult
import com.mogo.eagle.core.function.v2x.internal.data.V2XOptimalRoute
import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget
import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent
import com.mogo.eagle.core.function.v2x.road.V2XEventServiceApi
import com.mogo.eagle.core.network.MoGoRetrofitFactory
import com.mogo.eagle.core.network.utils.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.util.*
@@ -132,7 +128,6 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
private fun unRegisterListener() {
V2XManager.removeCallback(this)
CallerChassisLocationGCJ20ListenerManager.removeListener(TAG)
mogoMarkersHandler.unregisterMarkerClickListener(CARD_TYPE_ROAD_CONDITION)
}
@@ -161,8 +156,8 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
v2XMessageEntity.isOnlyShow = true
v2XMessageEntity.isNeedAddLine = false
v2XMessageEntity.content = roadEventEntity
val intent = Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION)
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity)
val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION)
intent.putExtra(BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity)
LocalBroadcastManager.getInstance(context()).sendBroadcast(intent)
//埋点
TrackUtils.trackV2XMarkerClick(2)
@@ -193,18 +188,6 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
return null
}
/**
* 刷新自车求助状态
*
* @param isTrue
*/
private fun refreshMeSeekHelp(isTrue: Boolean) {
val entity = V2XMessageEntity<Boolean>()
entity.type = V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP
entity.content = isTrue
V2XScenarioManager.getInstance().handlerMessage(entity)
}
override fun onChassisLocationGCJ02(gnssInfo: GnssInfo?) {
val location = CallerMapLocationListenerManager.getCurrentLocation() ?: return
BridgeApi.location.set(location)
@@ -214,34 +197,12 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
latitude = location.latitude
)
}
V2XOptimalRouteObserver.getInstance().update(location)
refreshCarState(location)
}
private fun refreshCarState(location: MogoLocation) {
V2XStatusManager.getInstance().location = location
val v2xPolyline = BridgeApi.v2xPolyline()?.mogoPolyline
val isRoadEventPOIShow = BridgeApi.v2xStatus()?.isRoadEventPOIShow ?: false
val v2xStatusManager = V2XStatusManager.getInstance()
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) { // 缩放地图
val context: Context = context()
MapUtils.zoomMap(v2xStatusManager.targetMoGoLatLng, context)
}
}
// 巡航处理
val v2XRoadEventEntity = V2XAlarmServer.getDriveFrontAlarmEvent(
BridgeApi.v2xMarker()?.v2XRoadEventEntityList,
V2XStatusManager.getInstance().location
)
BridgeApi.v2xMarker()?.v2XRoadEventEntityList, location)
if (v2XRoadEventEntity != null) {
val distance = v2XRoadEventEntity.distance
val min = if (EventTypeEnumNew.isCloudSocketEvent(v2XRoadEventEntity.poiType)) 0 else 5
@@ -287,9 +248,6 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
is V2XEvent.ForwardsWarning -> {
handleAdvanceWarningEvent(event)
}
is V2XEvent.OptimalRoute -> {
handleOptimalRouteEvent(event)
}
is V2XEvent.Marker -> {
event.data.result?.let {
handleRoadMarkerEvent(it)
@@ -313,6 +271,9 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
is V2XEvent.RoadEventX -> {
handleRoadMarkerEvent(event.data.toRoadMarker())
}
else -> {
Logger.d(TAG, "other event: $event")
}
}
}
private fun handleWarningTargetEvent(data: V2XWarningTarget) {
@@ -335,17 +296,6 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
}
}
private fun handleOptimalRouteEvent(event: V2XEvent.OptimalRoute) {
val v2xMessageEntity: V2XMessageEntity<V2XOptimalRoute> =
V2XMessageEntity<V2XOptimalRoute>() // 控制类型
v2xMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW // 设置数据
v2xMessageEntity.content = event.data // 控制展示状态
v2xMessageEntity.isShowState = true
val intent = Intent(BROADCAST_SCENE_HANDLER_ACTION)
intent.putExtra(BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity)
LocalBroadcastManager.getInstance(Utils.getApp()).sendBroadcast(intent)
}
private fun handleAdvanceWarningEvent(event: V2XEvent.ForwardsWarning) {
scope.launch {
val message = event.data
@@ -375,12 +325,10 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
}
1003 -> {
// 交叉路口碰撞预警
/*
TODO xiaopeng 先注掉,编译通过
changeVisualAngle = true
tempAppId = EventTypeEnumNew.TYPE_USECASE_ID_ICW.poiType.toInt()
tempTts = EventTypeEnumNew.TYPE_USECASE_ID_ICW.tts
tempContent = EventTypeEnumNew.TYPE_USECASE_ID_ICW.content*/
tempContent = EventTypeEnumNew.TYPE_USECASE_ID_ICW.content
}
1004 -> {
// 交叉路口碰撞预警
@@ -422,7 +370,7 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
}
}
// 不显示弹框,其它保留
if (tempContent.isNullOrEmpty() || tempTts.isNullOrEmpty()) {
if (tempContent.isEmpty() || tempTts.isEmpty()) {
Log.d("MsgBox-V2XEventManager", "alertContent或ttsContent为空!")
}
CallerMsgBoxManager.saveMsgBox(

View File

@@ -6,6 +6,7 @@ import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
import java.util.Iterator;
@@ -27,6 +28,8 @@ import io.netty.util.internal.ConcurrentSet;
*/
public class V2XAlarmServer {
private static final String TAG = "V2XAlarmServer";
// 记录道路播报的事件
private static final ConcurrentSet<V2XRoadEventEntity> showedEvents = new ConcurrentSet<>();
/**
@@ -36,7 +39,7 @@ public class V2XAlarmServer {
CopyOnWriteArrayList<V2XRoadEventEntity> v2XRoadEventEntityList,
MogoLocation currentLocation) {
try {
Log.d("RWJ", "getDriveFrontAlarmEvent --- 1 ---" + currentLocation );
Logger.d(TAG, "getDriveFrontAlarmEvent --- 1 ---" + currentLocation );
if (!showedEvents.isEmpty()) {
Iterator<V2XRoadEventEntity> iterator = showedEvents.iterator();
while (iterator.hasNext()) {
@@ -53,18 +56,18 @@ public class V2XAlarmServer {
}
}
}
Log.d("RWJ", "getDriveFrontAlarmEvent --- 2 ---" + currentLocation);
Logger.d(TAG, "getDriveFrontAlarmEvent --- 2 ---" + currentLocation);
if (currentLocation != null && v2XRoadEventEntityList != null) {
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
// 0、道路事件必须有朝向角度>=0;
Log.d("RWJ", "entity:" + v2XRoadEventEntity.getLocation());
Logger.d(TAG, "entity:" + v2XRoadEventEntity.getLocation());
if (v2XRoadEventEntity.getLocation().getAngle() >= 0) {
// 计算车辆距离指定气泡的距离
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
// 1、判断是否到达了触发距离,20 ~ 500,
double distance = v2XRoadEventEntity.getDistance();
Log.d("RWJ", "distance:" + distance);
Logger.d(TAG, "distance:" + distance);
if (distance <= 500) {
if (EventTypeEnumNew.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) {
if (distance > 25) {
@@ -75,7 +78,7 @@ public class V2XAlarmServer {
double carBearing = currentLocation.getBearing();
double eventBearing = eventLocation.getAngle();
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
Log.d("RWJ", "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle);
Logger.d(TAG, "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle);
if (diffAngle <= 20) {
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度保证道路事件在车辆前方
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
@@ -86,12 +89,12 @@ public class V2XAlarmServer {
(int) currentLocation.getBearing()
);
Log.d("RWJ", "eventAngle:" + eventAngle);
Logger.d(TAG, "eventAngle:" + eventAngle);
if (0 <= eventAngle && eventAngle <= 20) {
if (showedEvents.contains(v2XRoadEventEntity)) {
return null;
}
Log.d("RWJ", "showed---");
Logger.d(TAG, "showed---");
showedEvents.add(v2XRoadEventEntity);
return v2XRoadEventEntity;
}
@@ -102,7 +105,7 @@ public class V2XAlarmServer {
}
} catch (Exception e) {
e.printStackTrace();
Log.w("RWJ", "error: " + e.getMessage());
Logger.w(TAG, "error: " + e.getMessage());
}
return null;
}

View File

@@ -23,10 +23,6 @@ internal object BridgeApi {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context()) as? IMoGoV2XMarkerManager
}
private val v2xPolyline by lazy {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context()) as? IMoGoV2XPolylineManager
}
private val v2xWarnPolyline by lazy {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context()) as? IMoGoWarnPolylineManager
}
@@ -39,10 +35,6 @@ internal object BridgeApi {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STOP_POLYLINE_MANAGER).navigation(context()) as? IMoGoStopPolylineManager
}
private val v2xStatus by lazy {
ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context()) as? IMoGoV2XStatusManager
}
fun init(context: Context) {
this.context.set(WeakReference(context))
}
@@ -51,14 +43,9 @@ internal object BridgeApi {
fun v2xMarker() = v2xMarker
fun v2xPolyline() = v2xPolyline
fun v2xWarnPolyline() = v2xWarnPolyline
fun v2xPersonWarnPolyline() = v2xPersonWarnPolyline
fun v2xStopPolyline() = v2xStopPolyline
fun v2xStatus() = v2xStatus
}

View File

@@ -19,11 +19,6 @@ import java.util.concurrent.CopyOnWriteArrayList;
*/
public interface IMoGoV2XMarkerManager extends IProvider {
/**
* 重新绘制最后一次的POI点
*/
void drawableLastAllPOI();
/**
* 获取所有的道路事件点,探路事件,返回结果是按照距离当前车辆从近到远排列好的
*
@@ -43,20 +38,4 @@ public interface IMoGoV2XMarkerManager extends IProvider {
* @return
*/
IMogoMarker drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener);
/**
* 清除 道路事件 POI
*/
void clearAlarmPOI();
/**
* 清除 所有的 POI
*/
void clearALLPOI();
/**
* 强制清除道路事件POI
*/
void forceClearAlarmPOI();
}

View File

@@ -1,31 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.map.overlay.IMogoPolyline;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 9:49 PM
* desc : 当前车辆与道路事件的连接线
* version: 1.0
*/
public interface IMoGoV2XPolylineManager extends IProvider {
/**
* 绘制连接线,目标车,与当前车辆间连线
*
* @param context
* @param roadEventEntity
*/
void drawablePolyline(Context context, V2XRoadEventEntity roadEventEntity);
/**
* 移除连接线
*/
void clearLine();
IMogoPolyline getMogoPolyline();
}

View File

@@ -1,19 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 7:44 PM
* desc : 状态控制器监听
* version: 1.0
*/
public interface IMoGoV2XStatusChangedListener extends IProvider {
/**
* @param descriptor 状态类型
* @param isTrue true - v2x ui show
*/
void onStatusChanged(V2XStatusDescriptor descriptor, boolean isTrue);
}

View File

@@ -1,34 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
import com.alibaba.android.arouter.facade.template.IProvider;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 7:20 PM
* desc : V2X 状态管理
* version: 1.0
*/
public interface IMoGoV2XStatusManager extends IProvider {
/**
* 地图区域 V2X道路预警POI 是否在展示
*/
boolean isRoadEventPOIShow();
/**
* 设置 V2X道路预警POI 是否在展示
*
* @param tag
* @param show
*/
void setRoadEventPOIShow(String tag, boolean show);
/**
* 地图区域 推送的 POI 是否在展示
*
* @param tag
* @param show
*/
void setPushPOIShow(String tag, boolean show);
}

View File

@@ -1,70 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
/**
* @author congtaowang
* @since 2020-01-04
* <p>
* 状态描述
*/
public enum V2XStatusDescriptor {
/**
* 地图 V2X道路预警POI
*/
RoadEventPOI_UI,
/**
* 按钮 V2X道路预警
*/
RoadEventButton_UI,
/**
* 头部 V2X道路预警 UI
*/
RoadEventWindow_UI,
/**
* 头部 V2X的道路直播 UI
*/
RoadLiveCarWindow_UI,
/**
* 地图 他人车辆故障求助POI
*/
OtherSeekHelpPOI_UI,
/**
* 头部 他人车辆故障求助 UI 是否在展示
*/
OtherSeekHelpWindow_UI,
/**
* 右侧2/3 V2X 场景动画 UI 是否在展示
*/
V2XAnimationWindow_UI,
/**
* 右侧2/3 左下角 模拟直播车机 UI 是否在展示
*/
LiveCarWindow_UI,
/**
* 右侧2/3 左下角 模拟直播车机 UI 是否在展示
*/
V2XRoadVideo_UI,
/**
* 推送的POI
*/
PushWindowPOI_UI,
/**
* 推送的弹窗
*/
PushWindow_UI,
/**
* 疲劳驾驶弹窗
*/
FatigueDrivingWindow_UI
}

View File

@@ -1,61 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/3 2:34 PM
* desc : V2X状态管理
* version: 1.0
*/
public class V2XStatusManager {
private static V2XStatusManager mV2XStatusManager;
// 正在进行的告警事件详情
private V2XRoadEventEntity mAlarmInfo;
private MogoLocation mLocation;
private V2XStatusManager() {
}
/**
* 获取操作实体
*/
public static synchronized V2XStatusManager getInstance() {
synchronized (V2XStatusManager.class) {
if (mV2XStatusManager == null) {
mV2XStatusManager = new V2XStatusManager();
}
}
return mV2XStatusManager;
}
public void setAlarmInfo(V2XRoadEventEntity eventEntity) {
this.mAlarmInfo = eventEntity;
}
// 获取目标事件经纬度
public MogoLatLng getTargetMoGoLatLng() {
if (mAlarmInfo != null) {
return new MogoLatLng(
mAlarmInfo.getLocation().getLat(),
mAlarmInfo.getLocation().getLon()
);
}
return null;
}
public MogoLocation getLocation() {
if (mLocation == null) {
mLocation = new MogoLocation();
}
return mLocation;
}
public void setLocation(MogoLocation mLocation) {
this.mLocation = mLocation;
}
}

View File

@@ -1,15 +1,10 @@
package com.mogo.eagle.core.function.v2x.events.manager.impl;
import static com.mogo.commons.module.ServiceConst.CARD_TYPE_NOVELTY;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_EVENT_ALARM_POI;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -17,26 +12,20 @@ import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.MarkerShowEntity;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.marker.V2XMarkerAdapter;
import com.mogo.eagle.core.function.v2x.events.utils.EntityUtilsKt;
import com.mogo.eagle.core.function.v2x.events.utils.MapUtils;
import com.mogo.eagle.core.function.v2x.internal.V2XManager;
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult;
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerExploreWay;
import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.marker.IMogoMarkerManager;
import com.mogo.map.marker.MogoMarkerOptions;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArrayList;
@@ -54,25 +43,16 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
private static final String TAG = "MoGoV2XMarkerManager";
// 记录所有的:新鲜事儿的道路事件点、探路事件
private static final CopyOnWriteArraySet<V2XRoadEventEntity> mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>();
private final CopyOnWriteArraySet<V2XRoadEventEntity> mV2XRoadEventEntityArrayList = new CopyOnWriteArraySet<>();
@Override
public void drawableLastAllPOI() {
// 清除连接线
IMoGoV2XPolylineManager polylineManager = BridgeApi.INSTANCE.v2xPolyline();
if (polylineManager != null) {
polylineManager.clearLine();
}
clearAlarmPOI();
V2XManager.INSTANCE.forceRefresh();
}
public void init(Context context) {}
@Override
public CopyOnWriteArrayList<V2XRoadEventEntity> getV2XRoadEventEntityList() {
CopyOnWriteArrayList<V2XRoadEventEntity> roadEventEntities = new CopyOnWriteArrayList<>();
// 当前车辆数据
MogoLocation currentLocation = V2XStatusManager.getInstance().getLocation();
MogoLocation currentLocation = CallerMapLocationListenerManager.INSTANCE.getCurrentLocation();
if (currentLocation != null) {
// 重新计算距离
for (V2XRoadEventEntity v2XRoadEventEntity : mV2XRoadEventEntityArrayList) {
@@ -133,12 +113,7 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
@Override
public IMogoMarker drawableAlarmPOI(Context context, V2XRoadEventEntity roadEventEntity, IMogoMarkerClickListener clickListener) {
try {
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
v2xStatus.setRoadEventPOIShow(TAG, true);
}
// 清除原来的大而全的新鲜事儿
clearAlarmPOI();
if (roadEventEntity.getLocation() != null) {
// 道路事件,或者水波纹扩散效果
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
@@ -155,25 +130,11 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
markerShowEntity.setMarkerType(CARD_TYPE_NOVELTY);
optionsRipple.icons(V2XMarkerAdapter.getV2XRoadEventViewGif(context, roadEventEntity));
optionsRipple.period(1);
IMogoMarker ret = null;
if (MogoStatusManager.getInstance().isVrMode()) {
ret = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).drawMarker(markerShowEntity);
} else {
optionsRipple.icon(V2XMarkerAdapter.getV2XRoadEventViewPng(context, roadEventEntity));
IMogoMarkerManager marker = CallerMapUIServiceManager.INSTANCE.getMarkerManager(context);
if (marker != null) {
ret = marker.addMarker(V2X_EVENT_ALARM_POI, optionsRipple);
}
}
IMogoMarker ret = Objects.requireNonNull(CallerMapUIServiceManager.INSTANCE.getMarkerService()).drawMarker(markerShowEntity);
// 当前Marker设置为最上面
if (ret != null) {
ret.setToTop();
}
// 绘制连接线
IMoGoV2XPolylineManager polylineManager = BridgeApi.INSTANCE.v2xPolyline();
if (polylineManager != null) {
polylineManager.drawablePolyline(context, roadEventEntity);
}
// 缩放地图
MapUtils.zoomMap(
new MogoLatLng(roadEventEntity.getLocation().getLat(),
@@ -189,43 +150,4 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
}
return null;
}
@Override
public void clearAlarmPOI() {
// boolean isRoadEventPOIShow = false;
// IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
// if (v2xStatus != null) {
// isRoadEventPOIShow = v2xStatus.isRoadEventPOIShow();
// }
// if (isRoadEventPOIShow) {
// v2xStatus.setRoadEventPOIShow(TAG, false);
// if (mAlarmInfoMarker != null) {
// mAlarmInfoMarker.remove();
// }
// }
}
@Override
public void clearALLPOI() {
try {
IMogoMarkerManager markerManager = CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp());
if (markerManager != null) {
markerManager.removeMarkers();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void forceClearAlarmPOI() {
// if (mAlarmInfoMarker != null) {
// mAlarmInfoMarker.remove();
// }
}
@Override
public void init(Context context) {
}
}

View File

@@ -1,114 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager.impl;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
import com.mogo.map.overlay.IMogoPolyline;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 10:00 PM
* desc : 当前车辆与道路事件的连接线
* version: 1.0
*/
@Route(path = MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER)
public class MoGoV2XPolylineManager implements IMoGoV2XPolylineManager {
private static final String TAG = "MoGoV2XPolylineManager";
private static IMogoPolyline mMogoPolyline;
@Override
public void drawablePolyline(Context context, V2XRoadEventEntity roadEventEntity) {
// try {
// if (mMogoPolyline != null) {
// mMogoPolyline.remove();
// }
// boolean isRoadEventPOIShow = false;
// boolean isOtherSeekHelpPOIShow = false;
// IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
// if (v2xStatus != null) {
// isRoadEventPOIShow = v2xStatus.isRoadEventPOIShow();
// isOtherSeekHelpPOIShow = v2xStatus.isOtherSeekHelpPOIShow();
// }
// boolean isVrMode = false;
// IMogoStatusManager statusManager = BridgeApi.INSTANCE.statusManager();
// if (statusManager != null) {
// isVrMode = statusManager.isVrMode();
// }
// if ((isRoadEventPOIShow
// || isOtherSeekHelpPOIShow)
// && V2XStatusManager.getInstance().getTargetMoGoLatLng() != null
// && !isVrMode
// ) {
// // 连接线参数
// MogoPolylineOptions options = new MogoPolylineOptions().setGps(true);
//
// // 渐变色
// List<Integer> colors = new ArrayList<>();
//
// if (EventTypeEnum.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(roadEventEntity.getPoiType())
// || EventTypeEnum.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(roadEventEntity.getPoiType())
// || EventTypeEnum.FOURS_BLOCK_UP.getPoiType().equals(roadEventEntity.getPoiType())
// || EventTypeEnum.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(roadEventEntity.getPoiType())) {
// colors.add(0xFFFFA31A);
// colors.add(0xFFFFA31A);
// } else {
// colors.add(0xFFE32F46);
// colors.add(0xFFE32F46);
// }
// // 线条粗细,渐变,渐变色值
// options.width(10).useGradient(true).colorValues(colors);
//
// // 当前车辆位置
// MogoLatLng carLocation = new MogoLatLng(
// CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lat(),
// CallerAutoPilotStatusListenerManager.INSTANCE.getCurWgs84Lon()
// );
//
// if (carLocation != null) {
// options.add(carLocation);
// } else {
// options.add(V2XStatusManager.getInstance().getLocation());
// }
// // 目标车辆、道路事件位置
// options.add(V2XStatusManager.getInstance().getTargetMoGoLatLng());
//
// // 绘制线的对象
// IMogoOverlayManager overlay = MogoOverlayManager.getInstance();
// if (overlay != null) {
// mMogoPolyline = overlay.addPolyline(options);
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
}
@Override
public void clearLine() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
mMogoPolyline = null;
V2XStatusManager.getInstance().setAlarmInfo(null);
}
}
@Override
public void init(Context context) {
}
/**
* @return 绘制连接线的对象
*/
@Override
public IMogoPolyline getMogoPolyline() {
return mMogoPolyline;
}
}

View File

@@ -1,100 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.manager.impl;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.eagle.core.function.v2x.events.consts.MoGoV2XServicePaths;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusChangedListener;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusDescriptor;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/17 7:34 PM
* desc :
* version: 1.0
*/
@Route(path = MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER)
public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
private static final String TAG = "MoGoV2XStatusManager";
/**
* 状态记录
*/
private static final Map<V2XStatusDescriptor, Boolean> mStatus = new ConcurrentHashMap<>();
/**
* 回调集合
*/
private static final Map<V2XStatusDescriptor, List<IMoGoV2XStatusChangedListener>> mListeners = new ConcurrentHashMap<>();
/**
* 状态类型修改记录
*/
private static final Map<V2XStatusDescriptor, String> mModifier = new ConcurrentHashMap<>();
// 查询状态存储情况
private boolean get_bool_val(V2XStatusDescriptor descriptor) {
Boolean val = mStatus.get(descriptor);
return val == null ? false : val;
}
@Override
public boolean isRoadEventPOIShow() {
return get_bool_val(V2XStatusDescriptor.RoadEventPOI_UI);
}
@Override
public void setRoadEventPOIShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.RoadEventPOI_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.RoadEventPOI_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.RoadEventPOI_UI);
}
@Override
public void setPushPOIShow(String tag, boolean show) {
mStatus.put(V2XStatusDescriptor.PushWindowPOI_UI, show);
invokeStatusChangedListener(V2XStatusDescriptor.PushWindowPOI_UI, show);
recordStatusModifier(tag, V2XStatusDescriptor.PushWindowPOI_UI);
}
/**
* 调用所有存储的监听
*
* @param descriptor
* @param status
*/
private void invokeStatusChangedListener(V2XStatusDescriptor descriptor, boolean status) {
if (mListeners.containsKey(descriptor)) {
List<IMoGoV2XStatusChangedListener> listeners = mListeners.get(descriptor);
if (listeners != null) {
for (IMoGoV2XStatusChangedListener listener : listeners) {
if (listener != null) {
listener.onStatusChanged(descriptor, status);
}
}
}
}
}
/**
* 记录状态
*
* @param tag
* @param descriptor
*/
private void recordStatusModifier(String tag, V2XStatusDescriptor descriptor) {
mModifier.put(descriptor, tag);
}
@Override
public void init(Context context) {
}
}

View File

@@ -2,12 +2,10 @@ package com.mogo.eagle.core.function.v2x.events.marker;
import android.content.Context;
import android.graphics.Bitmap;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.v2x.R;
import com.mogo.eagle.core.function.v2x.events.view.V2XMarkerRoadEventView;
import java.util.ArrayList;
/**
@@ -26,28 +24,6 @@ public class V2XMarkerAdapter {
return new V2XMarkerRoadEventView(context, alarmInfo).setBackground(imageRes).getView();
}
/**
* 返回道路事件静态的图,因为车机性能不行,会卡顿
*/
public static Bitmap getV2XRoadEventViewPng(Context context, V2XRoadEventEntity alarmInfo) {
Bitmap bitmap;
if (EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_SUGGEST.getPoiType().equals(alarmInfo.getPoiType())
|| EventTypeEnumNew.ALERT_TRAFFIC_LIGHT_WARNING.getPoiType().equals(alarmInfo.getPoiType())
|| EventTypeEnumNew.FOURS_BLOCK_UP.getPoiType().equals(alarmInfo.getPoiType())
|| EventTypeEnumNew.ALERT_CAR_TROUBLE_WARNING.getPoiType().equals(alarmInfo.getPoiType())) {
bitmap = getV2XRoadEventMarkerView(
context,
alarmInfo,
R.drawable.v_to_x_warning_circle_orange_00040);
} else {
bitmap = getV2XRoadEventMarkerView(
context,
alarmInfo,
R.drawable.v_to_x_warning_circle_red_00040);
}
return bitmap;
}
/**
* 返回道路事件gif序列图集合
*/

View File

@@ -1,13 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.observer;
import com.mogo.eagle.core.data.map.MogoLocation;
/**
* @author donghongyu
* @date 4/9/21 2:14 PM
* 当前车辆位置观察者接口
*/
public abstract class CarLocationObserver {
// 更新状态
public abstract void update(MogoLocation carLocation);
}

View File

@@ -1,50 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.observer;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.v2x.events.overlay.V2XOptimalRouteOverlay;
import java.util.List;
/**
* @author donghongyu
* @date 4/9/21 2:38 PM
* 最优路线推荐
*/
public class V2XOptimalRouteObserver extends CarLocationObserver {
public static String TYPE = "V2XOptimalRouteObserver";
private static V2XOptimalRouteObserver v2XOptimalRouteObserver;
//最优路线覆盖物绘制
private V2XOptimalRouteOverlay mV2XOptimalRouteOverlay;
// 要绘制的数据
private List<MogoLatLng> polylinePoint;
public static V2XOptimalRouteObserver getInstance() {
if (v2XOptimalRouteObserver == null) {
synchronized (V2XOptimalRouteObserver.class) {
if (v2XOptimalRouteObserver == null) {
v2XOptimalRouteObserver = new V2XOptimalRouteObserver();
}
}
}
return v2XOptimalRouteObserver;
}
private V2XOptimalRouteObserver() {
mV2XOptimalRouteOverlay = new V2XOptimalRouteOverlay();
}
/**
* 设置推荐路线
*
* @param polylinePoint 推荐的路线
*/
public void setPolylinePoint(List<MogoLatLng> polylinePoint) {
this.polylinePoint = polylinePoint;
}
@Override
public void update(MogoLocation carLocation) {
mV2XOptimalRouteOverlay.draw(carLocation, polylinePoint);
}
}

View File

@@ -1,77 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.overlay;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.commons.utils.LocationUtils;
import com.mogo.eagle.core.utilcode.util.ColorUtils;
import com.mogo.map.overlay.IMogoOverlayManager;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import java.util.ArrayList;
import java.util.List;
/**
* 最优路线推荐的图覆盖物
*
* @author donghongyu
* @date 4/8/21 6:06 PM
*/
public class V2XOptimalRouteOverlay {
private IMogoPolyline mMoGoPolyline;
// 连接线参数
private MogoPolylineOptions mPolylineOptions;
// 线路径集合
private List<MogoLatLng> mPolylinePointList;
// 渐变色
private List<Integer> mPolylineColors;
public V2XOptimalRouteOverlay() {
mPolylineOptions = new MogoPolylineOptions();
// 绘制路径集合
mPolylinePointList = new ArrayList<>();
// 引导线颜色
mPolylineColors = new ArrayList<>();
}
/**
* 绘制最优路线
*
* @param polylinePoint 要绘制的经纬度度集合
*/
public IMogoPolyline draw(MogoLocation carLocal, List<MogoLatLng> polylinePoint) {
if (mMoGoPolyline != null) {
mMoGoPolyline.remove();
mPolylinePointList.clear();
mPolylineColors.clear();
}
if (polylinePoint != null) {
// 将当前车辆位置放进去
mPolylinePointList.add(new MogoLatLng(carLocal.getLatitude(), carLocal.getLongitude()));
// 过滤后台推送的推荐路线集合
for (MogoLatLng polyline : polylinePoint) {
//需要剔除已经行驶过的经纬度,这里需要比对推荐路线集合中的点是否在当前车辆行驶方向前面如果不在则抛弃
if (LocationUtils.isPointOnCarFront(carLocal, polyline)) {
mPolylinePointList.add(polyline);
}
}
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size()));
// 替换路径集合
mPolylineOptions.points(mPolylinePointList);
// 线条粗细,渐变,渐变色值
mPolylineOptions.width(25).useGradient(true).colorValues(mPolylineColors);
// 绘制线
IMogoOverlayManager overlay = CallerMapUIServiceManager.INSTANCE.getOverlayManager(AbsMogoApplication.getApp());
if (overlay != null) {
mMoGoPolyline = overlay.addPolyline(mPolylineOptions);
}
}
return mMoGoPolyline;
}
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.v2x.events.marker
package com.mogo.eagle.core.function.v2x.events.remove
import android.os.Handler
import android.os.HandlerThread
@@ -52,7 +52,7 @@ data class MarkerWrapper(val id: String, val lon: Double, val lat: Double, val c
}
}
object MarkerManager {
object MarkerRemoveManager {
private const val TAG = "MarkerManager"

View File

@@ -13,7 +13,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenarioManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.route.V2XOptimalRouteVREventScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.warning.V2XFrontWarningScenario;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
@@ -21,7 +20,6 @@ import com.mogo.eagle.core.utilcode.util.Utils;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.VisualAngleMode;
import java.util.concurrent.atomic.AtomicReference;
/**
* author : donghongyu
@@ -68,10 +66,6 @@ public class V2XScenarioManager implements IV2XScenarioManager {
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
mV2XScenario = new V2XRoadEventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
sceneChange();
mV2XScenario = new V2XOptimalRouteVREventScenario();
break;
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS:
if (HmiBuildConfig.isShowCloudWeaknessTrafficView) { //默认关闭云端弱势交通
sceneChange();

View File

@@ -18,14 +18,11 @@ import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.map.MogoMap
import com.mogo.map.overlay.IMogoPolyline
import com.mogo.map.overlay.MogoPolylineOptions
import mogo.telematics.pad.MessagePad
import java.util.*
import java.util.concurrent.Executors
import java.util.concurrent.LinkedBlockingQueue
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.ConcurrentHashMap
import com.mogo.eagle.core.function.v2x.events.marker.MarkerManager
import com.mogo.eagle.core.function.v2x.events.marker.MarkerWrapper
import com.mogo.eagle.core.function.v2x.events.remove.MarkerRemoveManager
import com.mogo.eagle.core.function.v2x.events.remove.MarkerWrapper
/**
* Ai云道路施工事件道路颜色标记类
@@ -156,7 +153,7 @@ class AiRoadMarker {
wrapper.addLine(line)
}
}
MarkerManager.addMarker(wrapper)
MarkerRemoveManager.addMarker(wrapper)
}
private fun removeLine() {

View File

@@ -6,7 +6,7 @@ import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.context
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi.v2xMarker
import com.mogo.eagle.core.function.v2x.events.marker.MarkerWrapper
import com.mogo.eagle.core.function.v2x.events.remove.MarkerWrapper
import com.mogo.map.*
import com.mogo.map.marker.*
import com.mogo.map.overlay.*

View File

@@ -10,8 +10,8 @@ import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
import com.mogo.eagle.core.function.v2x.events.marker.MarkerWrapper;
import com.mogo.eagle.core.function.v2x.events.marker.MarkerManager;
import com.mogo.eagle.core.function.v2x.events.remove.MarkerWrapper;
import com.mogo.eagle.core.function.v2x.events.remove.MarkerRemoveManager;
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.map.marker.IMogoMarker;
@@ -44,7 +44,7 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
ArrayList<IMogoMarker> markers = new ArrayList<>();
markers.add(iMarker);
String id = entity.getLocation().getLon() + "_" + entity.getLocation().getLat();
MarkerManager.INSTANCE.addMarker(new MarkerWrapper(id, entity.getLocation().getLon(), entity.getLocation().getLat(), 0, markers, null));
MarkerRemoveManager.INSTANCE.addMarker(new MarkerWrapper(id, entity.getLocation().getLon(), entity.getLocation().getLat(), 0, markers, null));
} else {
Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType() + "--- return empty marker");
}
@@ -101,20 +101,4 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
private boolean isDrawRoadLine(String poiType) {
return EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType().equals(poiType);
}
@Override
public void clearPOI() {
// 移除线
// IMoGoV2XPolylineManager polyLineManager = BridgeApi.INSTANCE.v2xPolyline();
// if (polyLineManager != null) {
// polyLineManager.clearLine();
// }
// IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
// if (v2xMarker != null) {
// // 移除事件POI
// v2xMarker.clearAlarmPOI();
// // 绘制上次的数据
// v2xMarker.drawableLastAllPOI();
// }
}
}

View File

@@ -1,14 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
import android.util.Log;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
@@ -17,23 +10,16 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxBean;
import com.mogo.eagle.core.data.msgbox.MsgBoxType;
import com.mogo.eagle.core.data.msgbox.V2XMsg;
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ20ListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.eagle.core.network.utils.GsonUtil;
import java.util.HashMap;
import java.util.Map;
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import mogo.telematics.pad.MessagePad;
/**
* author : donghongyu
@@ -52,7 +38,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void init(V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
try {
Log.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
if (v2XRoadEventEntity != null) {
if (v2XMessageEntity.isShowState()) {
@@ -91,18 +77,6 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
}
}
showWindow();
String poiType = entity.getContent().getPoiType();
String lat = String.valueOf(entity.getContent().getLocation().getLat());
String lon = String.valueOf(entity.getContent().getLocation().getLon());
String infoId = entity.getContent().getNoveltyInfo().getInfoId();
String style = "1";
Map<String, Object> properties = new HashMap<>();
properties.put("dbid", infoId);
properties.put("type", poiType);
properties.put("lng", lon);
properties.put("lat", lat);
properties.put("style", style);
AnalyticsUtils.track(V2XConst.V2X_ROAD_SHOW, properties);
}
} catch (Exception e) {
e.printStackTrace();
@@ -118,7 +92,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
String ttsText = content.getTts();
if (alarmText == null || alarmText.isEmpty()
|| ttsText == null || ttsText.isEmpty()) {
Log.d("MsgBox-V2XRoadScenario", "alertContent或ttsContent为空!");
Logger.d("MsgBox-V2XRoadScenario", "alertContent或ttsContent为空!");
}
String poiType = content.getPoiType();
if (EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType().equals(poiType) ||
@@ -155,7 +129,6 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
IV2XMarker marker = getV2XMarker();
if (marker != null) {
// 重置告警信息
V2XStatusManager.getInstance().setAlarmInfo(getV2XMessageEntity().getContent());
marker.drawPOI(getV2XMessageEntity().getContent());
}
}

View File

@@ -1,54 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.route;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.data.v2x.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager;
import com.mogo.eagle.core.function.v2x.events.observer.V2XOptimalRouteObserver;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/5/15 5:37 PM
* desc : 推送VR场景
* version: 1.0
*/
public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XOptimalRouteDataRes> {
private final String TAG = "V2XPushVREventMarker";
@Override
public void drawPOI(V2XOptimalRouteDataRes entity) {
CallerLogger.INSTANCE.d(M_V2X + TAG, "drawPOI 绘制VR Marker");
try {
// 清除道路事件
IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
if (v2xMarker != null) {
v2xMarker.clearAlarmPOI();
}
// 绘制引导线
V2XOptimalRouteObserver.getInstance()
.setPolylinePoint(entity.getGd_locus_list());
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearPOI() {
// // 移除线
// clearLine();
// // 绘制上次的数据
// IMoGoV2XMarkerManager v2xMarker = BridgeApi.INSTANCE.v2xMarker();
// if (v2xMarker != null) {
// v2xMarker.drawableLastAllPOI();
// }
}
public void clearLine() {
V2XOptimalRouteObserver.getInstance().setPolylinePoint(null);
}
}

View File

@@ -1,106 +0,0 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.route;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.msgbox.MsgBoxBean;
import com.mogo.eagle.core.data.msgbox.MsgBoxType;
import com.mogo.eagle.core.data.msgbox.V2XMsg;
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi;
import com.mogo.eagle.core.data.v2x.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XStatusManager;
import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario;
import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.eagle.core.network.utils.GsonUtil;
import java.util.concurrent.TimeUnit;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/5/15 5:37 PM
* desc : 最优车道选择
* version: 1.0
* wiki : http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799
*/
public class V2XOptimalRouteVREventScenario
extends AbsV2XScenario<V2XOptimalRouteDataRes>
implements IMoGoWarningStatusListener {
private String TAG = "V2XPushVREventWindow";
public V2XOptimalRouteVREventScenario() {
setV2XMarker(new V2XOptimalRouteVREventMarker());
}
@Override
public void init(@Nullable V2XMessageEntity<V2XOptimalRouteDataRes> v2XMessageEntity) {
CallerLogger.INSTANCE.w(M_V2X + TAG, "处理推送VR" + GsonUtil.jsonFromObject(v2XMessageEntity));
if (!isSameScenario(v2XMessageEntity)) {
setV2XMessageEntity(v2XMessageEntity);
show();
} else {
setV2XMessageEntity(v2XMessageEntity);
show();
CallerLogger.INSTANCE.w(M_V2X + TAG, "要处理的场景已经存在,丢弃这次初始化");
}
}
@Override
public void show() {
V2XMessageEntity<V2XOptimalRouteDataRes> entity = getV2XMessageEntity();
if (entity != null) {
V2XOptimalRouteDataRes content = entity.getContent();
if (content != null) {
CallerMsgBoxManager.INSTANCE.saveMsgBox(
new MsgBoxBean(
MsgBoxType.V2X,
new V2XMsg(entity.getType() + "",
"为您推荐最优路线",
"已为您选择最优路线")
)
);
CallerHmiManager.INSTANCE.warningV2X(entity.getType() + "",
"为您推荐最优路线", "已为您选择最优路线", TAG,
this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(30));
}
}
}
@Override
public void drawPOI() {
IV2XMarker marker = getV2XMarker();
if (marker != null) {
marker.drawPOI(getV2XMessageEntity().getContent());
IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
if (v2xStatus != null) {
v2xStatus.setPushPOIShow(TAG, true);
}
}
}
@Override
public void clearPOI() {
// if (getV2XMarker() != null) {
// getV2XMarker().clearPOI();
// }
// IMoGoV2XStatusManager v2xStatus = BridgeApi.INSTANCE.v2xStatus();
// if (v2xStatus != null) {
// v2xStatus.setPushPOIShow(TAG, false);
// }
}
@Override
public void onShow() {
drawPOI();
}
@Override
public void onDismiss() {
}
}

View File

@@ -7,9 +7,7 @@ import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.enums.WarningDirectionEnum;
import com.mogo.eagle.core.data.map.entity.V2XMessageEntity;
import com.mogo.eagle.core.data.msgbox.MsgBoxBean;

View File

@@ -2,9 +2,7 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.warning;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_STOP_LINE_DATA;
import static com.mogo.eagle.core.data.constants.DataTypes.TYPE_MARKER_CLOUD_WARN_DATA;
import static com.mogo.eagle.core.function.v2x.events.consts.V2XConst.V2X_FRONT_WARNING_MARKER;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X;
import com.mogo.cloud.commons.utils.CoordinateUtils;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.MogoStatusManager;
@@ -26,12 +24,10 @@ import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.commons.utils.Trigonometric;
import com.mogo.eagle.core.function.v2x.internal.data.V2XLocation;
import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import mogo.telematics.pad.MessagePad;
/**
@@ -446,19 +442,4 @@ public class V2XWarningMarker implements IV2XMarker {
}
CallerLogger.INSTANCE.d(M_V2X + TAG, "车辆行驶轨迹" + latLng.getLongitude() + "," + latLng.getLatitude());
}
@Override
public void clearPOI() {
IMogoMarkerManager marker = CallerMapUIServiceManager.INSTANCE.getMarkerManager(AbsMogoApplication.getApp());
if (marker != null) {
marker.removeMarkers(V2X_FRONT_WARNING_MARKER);
}
}
public void clearLine() {
IMoGoWarnPolylineManager warnPolylineManager = BridgeApi.INSTANCE.v2xWarnPolyline();
if (warnPolylineManager != null) {
warnPolylineManager.clearLine();
}
}
}

View File

@@ -10,7 +10,4 @@ package com.mogo.eagle.core.function.v2x.events.scenario.view;
public interface IV2XMarker<T> {
void drawPOI(T entity);
void clearPOI();
}

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.v2x.events.utils;
package com.mogo.eagle.core.function.v2x.events.test;
import static com.mogo.eagle.core.data.map.entity.V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING;

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.v2x.events.receiver;
package com.mogo.eagle.core.function.v2x.events.test;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -12,7 +12,6 @@ import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity;
import com.mogo.eagle.core.data.v2x.V2XOptimalRouteDataRes;
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.utils.TestOnLineCarUtils;
import java.util.List;
@@ -21,8 +20,8 @@ import java.util.List;
*
* @author donghongyu
*/
public class TestPanelBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = V2XConst.MODULE_NAME + "_TestPanelBroadcastReceiver";
public class TestV2XReceiver extends BroadcastReceiver {
private static final String TAG = "TestV2XReceiver";
private Context mContext;
@@ -74,11 +73,7 @@ public class TestPanelBroadcastReceiver extends BroadcastReceiver {
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, messageEntity);
LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
} /*else if (sceneType == 16) {//触发基于目的地预测的线路推荐
V2XRefreshModel model = BridgeApi.INSTANCE.refreshModel();
model.
V2XServiceManager.getV2XRefreshModel().queryRoadData("F803EB2046PZD00149");
} */ else if (sceneType == 17) {//最优路线推荐
} else if (sceneType == 17) {//最优路线推荐
V2XMessageEntity<V2XOptimalRouteDataRes> v2XMessageEntity =
TestOnLineCarUtils.getV2XOptimalRoute();

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.v2x.events.utils;
import com.mogo.commons.analytics.AnalyticsUtils;
import com.mogo.eagle.core.function.v2x.events.consts.V2XConst;
import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager;
import java.util.HashMap;
import java.util.Map;