Merge branch 'dev_arch_opt_3.0' into dev_robobus-m1-p-app-module_1.0.0_230112_1.0.0

This commit is contained in:
yangyakun
2023-02-13 18:54:18 +08:00
55 changed files with 2091 additions and 1309 deletions

View File

@@ -26,7 +26,7 @@ class FuncBizProvider : IMoGoFuncBizProvider {
noticeSocketManager.init(context)
dispatchAutoPilotManager.init(context)
cronTaskManager.startCronTask()
OverviewDb.getDb(context)
MogoTrafficLightManager.INSTANCE.initServer(context)
VipCarManager.INSTANCE.initServer(context)
// RedLightWarningManager.INSTANCE.listenTrafficLight()
@@ -75,10 +75,6 @@ class FuncBizProvider : IMoGoFuncBizProvider {
OverViewDataManager.getAllV2XEventsByLineId(MoGoAiCloudClientConfig.getInstance().sn)
}
override fun initOverViewDb(context: Context) {
OverviewDb.getDb(context)
}
override fun onDestroy() {
noticeSocketManager.release()
dispatchAutoPilotManager.release()

View File

@@ -55,20 +55,18 @@ dependencies {
implementation rootProject.ext.dependencies.androidxroomktx
implementation rootProject.ext.dependencies.mogoaicloudtelematic
implementation rootProject.ext.dependencies.mogoobu
implementation rootProject.ext.dependencies.amapnavi3dmap
implementation project(':libraries:mogo-obu')
implementation project(':libraries:mogo-adas')
implementation project(':libraries:mogo-adas-data')
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils
implementation rootProject.ext.dependencies.mogo_core_function_call
implementation project(':libraries:mogo-adas')
implementation rootProject.ext.dependencies.mogocommons
} else {
implementation project(':core:mogo-core-utils')
implementation project(':core:mogo-core-function-call')
implementation project(':libraries:mogo-adas')
implementation project(':foudations:mogo-commons')
}
}

View File

@@ -47,11 +47,11 @@ class ObuTestNewObuReceiver : BroadcastReceiver() {
val warningList = listOf(warningData1)
warningMsg.warningData = warningList
val cvxHvInfoIndInfo = MogoObuRvWarningData(0, vehBasicsMsg, warningMsg)
// val cvxHvInfoIndInfo = MogoRvWarningData(0, vehBasicsMsg, warningMsg)
MogoPrivateObuNewManager.INSTANCE
.getMogoObuListener()
.onMogoObuRvWarning(cvxHvInfoIndInfo)
// MogoPrivateObuNewManager.INSTANCE
// .getMogoObuListener()
// .onGnssInfo(cvxHvInfoIndInfo)
}

View File

@@ -41,11 +41,11 @@ class ObuTestNewObuRsiReceiver : BroadcastReceiver() {
val rsiWarningList = listOf(rsiWarning) //TODO
val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList)
MogoPrivateObuNewManager.INSTANCE
.getMogoObuListener()
.onMogoObuRsiWarning(cvxObuRsiInfo)
// val cvxObuRsiInfo = MogoObuRsiWarningData(obuStatus, 1, rsiWarningList)
//
// MogoPrivateObuNewManager.INSTANCE
// .getMogoObuListener()
// .onObuRsiWarning(cvxObuRsiInfo)
}

View File

@@ -4,6 +4,8 @@ import com.mogo.eagle.core.data.enums.TrafficTypeEnum
import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OBU
import com.mogo.support.obu.ObuBase
import com.mogo.support.obu.ObuScene
import com.mogo.support.obu.model.MogoObuRsiWarningData
import com.mogo.support.obu.model.MogoObuRsmWarningData
import com.mogo.support.obu.model.MogoObuRvWarningData
@@ -20,18 +22,18 @@ object TrafficDataConvertUtilsNew {
/**
* OBU 远车 转换交通元素数据,是否需要
*/
fun cvxRvInfoIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? {
if (info.vehBasicsMsg == null) {
fun cvxRvInfoIndInfo2TrafficData(info: ObuBase.VehicleBasics): TrafficData? {
if (info == null) {
CallerLogger.e("$M_OBU$TAG", "cvxRvInfoIndInfo2TrafficData 数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE
trafficData.uuid = info.vehBasicsMsg.id
trafficData.lat = info.vehBasicsMsg.latitude
trafficData.lon = info.vehBasicsMsg.longitude
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
trafficData.uuid = info.id
trafficData.lat = info.latitude
trafficData.lon = info.longitude
trafficData.heading = info.heading
trafficData.speed = info.speed
return trafficData
}
@@ -39,25 +41,25 @@ object TrafficDataConvertUtilsNew {
/**
* OBU RSU道路事件预警信息 转换交通元素数据 标牌 为何要显示level
*/
fun cvxRtiThreatIndInfo2TrafficData(info: MogoObuRsiWarningData): TrafficData? {
if (info.warningMsg == null || info.warningMsg.size < 1 || info.warningMsg[0].position == null) {
fun cvxRtiThreatIndInfo2TrafficData(info: ObuScene.RsiWarningData): TrafficData? {
if (info.warningMsgList == null || info.warningMsgList.size < 1 || info.warningMsgList[0].position == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
val trafficData = TrafficData()
trafficData.type = TrafficTypeEnum.TYPE_TRAFFIC_ID_DAO_LU_SHI_GONG
trafficData.uuid = info.warningMsg[0].signSerialNum.toString()
trafficData.lat = info.warningMsg[0].position.latitude
trafficData.lon = info.warningMsg[0].position.longitude
trafficData.threatLevel = info.warningMsg[0].warningLevel
trafficData.uuid = info.warningMsgList[0].signSerialNum.toString()
trafficData.lat = info.warningMsgList[0].position.position.positionLatLon.latitude
trafficData.lon = info.warningMsgList[0].position.position.positionLatLon.longitude
trafficData.threatLevel = info.warningMsgList[0].warningLevel
return trafficData
}
/**
* OBU 预警事件 转换交通元素数据 他车预警
*/
fun cvxV2vThreatIndInfo2TrafficData(info: MogoObuRvWarningData): TrafficData? {
if (info == null || info.vehBasicsMsg == null || info.warningMsg == null) {
fun cvxV2vThreatIndInfo2TrafficData(info: ObuScene.RvWarningData): TrafficData? {
if (info?.vehBasicsMsg == null || info.warningMsg == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
}
@@ -68,8 +70,8 @@ object TrafficDataConvertUtilsNew {
trafficData.heading = info.vehBasicsMsg.heading
trafficData.speed = info.vehBasicsMsg.speed
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg.warningData != null) {
trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel
if (info.warningMsg.warningDataList != null) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1
}
@@ -81,7 +83,7 @@ object TrafficDataConvertUtilsNew {
/**
* OBU 弱势交通参与者信息 转换交通元素数据
*/
fun cvxPtcThreatIndInfo2TrafficData(info: MogoObuRsmWarningData): TrafficData? {
fun cvxPtcThreatIndInfo2TrafficData(info: ObuScene.RsmWarningData): TrafficData? {
if (info.participant == null) {
CallerLogger.e("$M_OBU$TAG", "数据转换异常,请检查参数是否齐全")
return null
@@ -121,8 +123,8 @@ object TrafficDataConvertUtilsNew {
}
// 判断车辆V2X预警级别调整车辆颜色
if (info.warningMsg != null && info.warningMsg.warningData != null) {
trafficData.threatLevel = info.warningMsg.warningData[0].warningLevel
if (info.warningMsg != null && info.warningMsg.warningDataList != null) {
trafficData.threatLevel = info.warningMsg.warningDataList[0].warningLevel
} else {
trafficData.threatLevel = 1
}

View File

@@ -136,7 +136,7 @@ class TrafficLightDispatcher : IMoGoAutopilotIdentifyListener, IMoGoTrafficLight
super.onTrafficLightPlusSource(light, remain, lightSource)
if (lightSource == DataSourceType.OBU) {
hasObuLightStatus = true //todo 会存在优先级高的数据没有回调,导致没有数据出现
hasObuLightStatus = true
}
CallerTrafficLightListenerManager.showTrafficLight(light, lightSource)

View File

@@ -84,6 +84,8 @@ dependencies {
implementation rootProject.ext.dependencies.androidxrecyclerview
implementation rootProject.ext.dependencies.flexbox
implementation rootProject.ext.dependencies.androidautoSize
implementation rootProject.ext.dependencies.koomnative
implementation rootProject.ext.dependencies.koomxhook
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
implementation rootProject.ext.dependencies.mogo_core_utils

View File

@@ -5,6 +5,8 @@ import android.content.Context
import android.view.View
import android.view.ViewGroup
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.EnvConfig
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo
import com.mogo.eagle.core.data.constants.MogoServicePaths
@@ -16,10 +18,11 @@ import com.mogo.eagle.core.function.api.devatools.IDevaToolsProvider
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.zhjt.mogo_core_function_devatools.badcase.BadCaseManager
import com.zhjt.mogo_core_function_devatools.badcase.consts.BadCaseConfig
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.binding.BindingCarManager.Companion.bindingCarManager
import com.zhjt.mogo_core_function_devatools.env.EnvChangeManager
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigCenter.Companion.bizConfigCenter
import com.zhjt.mogo_core_function_devatools.funcconfig.FuncConfigImpl
import com.zhjt.mogo_core_function_devatools.koom.KoomInitTask
import com.zhjt.mogo_core_function_devatools.logcatch.MogoLogCatchManager
import com.zhjt.mogo_core_function_devatools.mofang.MoFangManager.Companion.moFangManager
import com.zhjt.mogo_core_function_devatools.monitor.MonitorManager
@@ -46,6 +49,9 @@ class DevaToolsProvider : IDevaToolsProvider {
}
override fun initBiz() {
if (DebugConfig.isDebug()) {
KoomInitTask.init(AbsMogoApplication.getApp())
}
ttsManager.initTts(mContext!!) //todo
//链路相关
traceManager.init(mContext!!)

View File

@@ -1,4 +1,4 @@
package com.mogo.eagle.core.function.main
package com.zhjt.mogo_core_function_devatools.koom
import android.app.Application
import android.os.Build

View File

@@ -68,8 +68,7 @@ dependencies {
// debugImplementation rootProject.ext.dependencies.debugleakcanary
// releaseImplementation rootProject.ext.dependencies.releaseleakcanary
implementation rootProject.ext.dependencies.mogoobu
implementation project(':libraries:mogo-obu')
implementation rootProject.ext.dependencies.arouter
kapt rootProject.ext.dependencies.aroutercompiler

View File

@@ -11,8 +11,8 @@ import android.view.animation.Animation
import android.widget.ImageView
import androidx.constraintlayout.widget.ConstraintLayout
import chassis.Chassis
import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Turning
import com.mogo.eagle.core.function.hmi.R
import kotlinx.android.synthetic.main.view_turn_light_status.view.*
import kotlinx.coroutines.Dispatchers
@@ -55,7 +55,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
//根据左右进行显示和隐藏,实际要判断每个来的时间和频度
when (directionLight) {
Chassis.LightSwitch.LIGHT_LEFT -> { //左转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
CallerVisualAngleManager.changeAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.VISIBLE
right_select_image.visibility = View.GONE
@@ -63,7 +63,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
setAnimation(left_select_image)
}
Chassis.LightSwitch.LIGHT_RIGHT -> { //右转向
CallerVisualAngleManager.changeVisualAngle(Turning(true))
CallerVisualAngleManager.changeAngle(Turning(true))
showNormalAnimation()
left_select_image.visibility = View.GONE
right_select_image.visibility = View.VISIBLE
@@ -71,7 +71,7 @@ class TurnLightViewStatus @JvmOverloads constructor(
setAnimation(right_select_image)
}
else -> { //消失
CallerVisualAngleManager.changeVisualAngle(Turning(false))
CallerVisualAngleManager.changeAngle(Turning(false))
animationDisappear()
}
}

View File

@@ -3,35 +3,23 @@ package com.mogo.eagle.core.function.main;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_HMI;
import android.annotation.SuppressLint;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Process;
import androidx.annotation.Nullable;
import androidx.core.app.NotificationCompat;
import com.bytedance.boost_multidex.BoostMultiDex;
import com.elegant.utils.UiThreadHandler;
import com.mogo.cloud.socket.SocketBuildConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.module.MogoModule;
import com.mogo.commons.module.MogoModulePaths;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
import com.mogo.eagle.core.function.api.devatools.IMogoDevaToolsUpgradeListener;
import com.mogo.eagle.core.function.call.biz.CallerFuncBizManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsUpgradeListenerManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager;
import com.mogo.eagle.core.function.msgbox.db.MsgBoxDb;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.AppLaunchTimeUtils;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.ProcessUtils;
import com.mogo.eagle.core.utilcode.util.SPUtils;
@@ -41,7 +29,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 默认初始化一些基础服务配置 todo 分离 overView业务 和 msgBox去自模块中 --- 扶风
* 默认初始化一些基础服务配置 todo 分离 msgBox去自己的模块中 --- 扶风
*/
public abstract class MainMoGoApplication extends AbsMogoApplication {
@@ -61,10 +49,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
initTipToast();
initModules();
if (ProcessUtils.isMainProcess(this)) {
initOverviewDb();
if (DebugConfig.isDebug()) {
initKoom();
}
clearMessageBoxTable();
CallerMsgBoxManager.INSTANCE.queryAllMessages(this);
}
@@ -109,10 +93,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
}).start();
}
private void initKoom() {
KoomInitTask.INSTANCE.init(this);
}
/**
* 初始化异常采集配置
*/
@@ -135,10 +115,6 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
CallerDevaToolsManager.INSTANCE.init();
}
private void initOverviewDb() {
CallerFuncBizManager.getBizProvider().initOverViewDb(this);
}
private void initModules() {
CallerLogger.INSTANCE.d(M_HMI + TAG, "initModules");
// OBU 模块

View File

@@ -2,7 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_100">
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvHmiPncActions"

View File

@@ -0,0 +1,306 @@
package com.mogo.eagle.core.function.angle
import android.content.*
import android.os.*
import android.util.*
import androidx.lifecycle.*
import androidx.lifecycle.Lifecycle.Event
import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.data.config.*
import com.mogo.eagle.core.data.constants.MogoServicePaths
import com.mogo.eagle.core.data.map.*
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.api.map.angle.Scene
import com.mogo.eagle.core.function.call.autopilot.*
import com.mogo.eagle.core.function.call.map.*
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.mogo.*
import com.mogo.eagle.core.utilcode.mogo.logger.*
import com.zhidaoauto.map.sdk.open.tools.*
import kotlinx.coroutines.*
import kotlinx.coroutines.android.*
import java.util.*
import java.util.concurrent.atomic.*
@Route(path = MogoServicePaths.PATH_VISUAL_ANGLE)
class MoGoVisualAngleChangeProvider: IMoGoVisualAngleChangeProvider {
override val functionName: String
get() = "VisualAngleChange"
companion object {
const val TAG = "VisualAngleChange"
}
private val triggerLocation = AtomicReference<MogoLocation>()
private val distanceOfCarToStopLine = AtomicReference(0.0)
private val travelled by lazy { AtomicReference(0.0) }
/**
* 业务实体,不对外暴露
* @param target: 目标场景
* @param isDisplay: 是否正在展示
* @param triggerTime: 触发时间
*/
private data class Record(val target: Scene, var isDisplay: Boolean = false, var triggerTime: Long): Comparable<Record> {
override fun compareTo(other: Record): Int {
//如果时间一样,优先级越高,越靠近堆顶
return other.target.priority - target.priority
}
}
private val queue by lazy {
PriorityQueue<Record>()
}
private val listener = object : OnRoadListener {
private val roadId = AtomicReference<String>()
private val triggerRoadId = AtomicReference<String>()
override fun onRoadIdInfo(roadId: String) {
this.roadId.set(roadId)
Log.d(TAG, "-- onRoadIdInfo --: prev: ${this.triggerRoadId.get()} -> curr: $roadId")
val loc = CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02()
var triggerClose = false
val distance = distanceOfCarToStopLine.get() + 5
if (hasCrossRoad && distance > 0) {
val prev = triggerLocation.get()
if (prev != null && loc != null) {
travelled.set(MapTools.distance(loc.longitude, loc.latitude, prev.longitude, prev.latitude) + travelled.get())
triggerLocation.set(loc)
}
val oldRoadId = triggerRoadId.get()
Log.d(TAG, "-- onRoadIdInfo --: travelled --: ${travelled.get()}")
if ((travelled.get() > distance) && oldRoadId != null && oldRoadId != roadId) {
distanceOfCarToStopLine.set(0.0)
hasCrossRoad = false
triggerRoadId.set(null)
travelled.set(0.0)
triggerLocation.set(null)
Log.d(TAG, "-- onRoadIdInfo --: trigger close --")
triggerClose = true
}
}
if (triggerClose) {
changeAngle(CrossRoad(false))
}
}
override fun onStopLineInfo(info: StopLine) {
Log.d(TAG, "-- onStopLineInfo --: ${info.distanceOfCarToStopLine}")
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
hasCrossRoad = true
triggerRoadId.set(this.roadId.get())
distanceOfCarToStopLine.set(info.distanceOfCarToStopLine)
triggerLocation.set(CallerChassisLocationGCJ02ListenerManager.getChassisLocationGCJ02())
changeAngle(CrossRoad(true))
}
}
}
override fun init(context: Context?) {
if (Thread.currentThread() != Looper.getMainLooper().thread) {
scope.launch {
initListen(context)
}
} else {
initListen(context)
}
}
private fun initListen(ctx: Context?) {
ctx ?: return
ctx.lifeCycleOwner.lifecycle.addObserver(object : LifecycleEventObserver {
override fun onStateChanged(source: LifecycleOwner, event: Event) {
if (event == ON_DESTROY) {
CallerMapRoadListenerManager.unRegisterRoadListener("VisualAngleChange")
}
}
})
CallerMapRoadListenerManager.registerRoadListener("VisualAngleChange", listener)
}
@Volatile
private var hasCrossRoad = false
private var scope: CoroutineScope = acquireScope()
@Synchronized
get() {
if (field.isActive) {
return field
}
val scope = acquireScope()
field = scope
return field
}
private var defaultDelayJob: Job? = null
private fun acquireScope(): CoroutineScope {
return CoroutineScope(Handler(Looper.getMainLooper()).asCoroutineDispatcher("change-visual-angle") + SupervisorJob())
}
override fun onDestroy() {
CallerMapRoadListenerManager.unRegisterRoadListener("VisualAngleChange")
}
@Volatile
private var mLevel:Boolean = false
override fun updateLongSightLevel(level:Boolean){
mLevel = level
}
override fun changeAngle(scene: Scene) {
val appIdentityMode = FunctionBuildConfig.appIdentityMode
if (AppIdentityModeUtils.isBus(appIdentityMode) && AppIdentityModeUtils.isPassenger(appIdentityMode)) {
return
}
if(mLevel){
return
}
val triggerTime = SystemClock.elapsedRealtime()
scope.launch {
Log.d(TAG, "--- 1 ---")
val displayed = getDisplayed()
if (displayed == null) {
Log.d(TAG, "--- 2 ---")
if (scene is Turning) {
if (!scene.open) {
changeAngle(Default())
return@launch
}
}
if (scene is CrossRoad) {
if (!scene.open) {
changeAngle(Default())
return@launch
}
}
doRealVisualAngleChange(triggerTime, scene, null)
} else {
val prev = displayed.target
Log.d(TAG, "--- 3 --- old: $prev -> cur: $scene")
val prevTriggerTime = displayed.triggerTime
if (scene !is Default && prev.priority > scene.priority && (prev is RoadEvent || prev is TooClose)) {
val displayDuration = triggerTime - prevTriggerTime
Log.d(TAG, "--- 4 ---:场景[$prev], 已展示时长: duration: $displayDuration")
if (displayDuration < prev.displayThreshold) {
Log.d(TAG, "--- 5 --- 场景[$prev]:仍在保护展示时长内直接return")
return@launch
} else {
Log.d(TAG, "--- 6 --- 场景[$prev]:已过保护展示时长,从展示的队列中移除,显示默认视角")
queue -= displayed
changeAngle(Default())
return@launch
}
}
if (prev is Turning && scene is Turning) {
val isOpen = scene.open
if (!isOpen) {
Log.d(TAG, "--- 7 --- 场景[$scene], 收到关闭通知")
queue -= displayed
changeAngle(Default())
return@launch
}
}
if (prev is CrossRoad && scene is CrossRoad) {
val isOpen = scene.open
if (!isOpen) {
Log.d(TAG, "--- 8 --- old: $prev -> cur: $scene")
queue -= displayed
changeAngle(Default())
return@launch
}
}
if (prev.priority == scene.priority) {
Log.d(TAG, "--- 9 --- 场景[$prev]正在展示尚未收到关闭优先级一致直接return")
return@launch
}
if (prev.priority > scene.priority && prev.displayThreshold < 0) {
Log.d(TAG, "--- 10 --- 场景[$prev]正在展示尚未收到关闭场景依然展示当前场景直接return")
return@launch
}
doRealVisualAngleChange(triggerTime, scene, displayed)
}
}
}
private fun CoroutineScope.doRealVisualAngleChange(triggerTime: Long, target: Scene, displayed: Record? = null) {
if (target is Default) {
Log.d(TAG, "--- doRealVisualAngleChange --- 1 ---")
displayed?.also {
queue -= it
}
defaultDelayJob?.safeCancel()
launch {
val delay = target.unit.toMillis(target.delay)
Log.d(TAG, "--- doRealVisualAngleChange --- 2 ---")
delay(delay)
Log.d(TAG, "--- doRealVisualAngleChange --- 3 ---")
doChangeAngle(Record(target, triggerTime = triggerTime))
}.also { itx ->
itx.invokeOnCompletion {
if (it is CancellationException) {
Log.d(TAG, "--- doRealVisualAngleChange --- 4 ---")
}
}
defaultDelayJob = itx
}
} else {
Log.d(TAG, "--- doRealVisualAngleChange --- 5 ---")
defaultDelayJob?.safeCancel()
if (displayed == null || displayed.target.priority <= target.priority) {
Log.d(TAG, "--- doRealVisualAngleChange --- 6 ---")
displayed?.also {
queue -= it
}
if (target is Turning) {
if (!target.open) {
Log.d(TAG, "--- doRealVisualAngleChange --- 7 ---")
changeAngle(Default())
return
}
}
if (target is CrossRoad) {
if (!target.open) {
Log.d(TAG, "--- doRealVisualAngleChange --- 8 ---")
changeAngle(Default())
return
}
}
Log.d(TAG, "--- doRealVisualAngleChange --- 10 ---")
doChangeAngle(Record(target, triggerTime = triggerTime))
}
}
}
@OptIn(InternalCoroutinesApi::class)
private fun doChangeAngle(record: Record) {
val angle = record.target.angle
CallerMapUIServiceManager.getMapUIController()?.also {
Log.d(TAG, "--- doChangeAngle --- ${record.target}")
if (record.target !is Default) {
record.isDisplay = true
kotlinx.coroutines.internal.synchronized(queue) {
queue += record
}
}
it.changeMapVisualAngle(angle, null)
}
}
/**
* 是否有正在展示的
*/
@Synchronized
private fun getDisplayed() = queue.firstOrNull()
}

View File

@@ -52,6 +52,5 @@ public class MogoMapService implements IMogoMapService {
@Override
public void init(Context context) {
CallerVisualAngleManager.INSTANCE.init(context);
}
}

View File

@@ -52,7 +52,8 @@ class OverMapView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener {
) : RelativeLayout(context, attrs, defStyleAttr), IMoGoChassisLocationGCJ02Listener,
IMoGoPlanningRottingListener {
// =============自定义属性相关=============
private var mapStylePath: String? = null
@@ -166,7 +167,7 @@ class OverMapView @JvmOverloads constructor(
overLayerView?.background = resources.getDrawable(if (resetDrawable != -1) resetDrawable else R.drawable.amap_reset)
arrivedBitmap = BitmapDescriptorFactory.fromResource(if (arrivedDrawable != -1) arrivedDrawable else R.drawable.taxi_map_arrow_arrived)
unArrivedBitmap = BitmapDescriptorFactory.fromResource(if (unArrivedDrawable != -1) unArrivedDrawable else R.drawable.taxi_map_arrow_un_arrive)
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
CallerPlanningRottingListenerManager.addListener(TAG, this)
initAMapView(context)
// 注册定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, this)
@@ -262,20 +263,6 @@ class OverMapView @JvmOverloads constructor(
)
}
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
object : IMoGoPlanningRottingListener {
/**
* 根据全路径获取起始点和经停点进行导航路线绘制
* 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测
* 室内某个bag包自动驾驶启动8s后返回
*/
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
globalPathResp?.let {
handlePlanningData(it.wayPointsList)
}
}
}
fun handlePlanningData(locationList: List<MessagePad.Location>?) {
if (locationList.isNullOrEmpty()) return
val list: List<MessagePad.Location> = locationList
@@ -600,4 +587,15 @@ class OverMapView @JvmOverloads constructor(
}
}
/**
* 根据全路径获取起始点和经停点进行导航路线绘制
* 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测
* 室内某个bag包自动驾驶启动8s后返回
*/
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
globalPathResp?.let {
handlePlanningData(it.wayPointsList)
}
}
}

View File

@@ -111,6 +111,9 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
clientConfig.isUseOriginSocket = true
// 设置是否输出网络日志
clientConfig.isShowNetDebugLog = false
// clientConfig.passportUrl //todo yakun
// clientConfig.socketBaseUrl
// clientConfig.socketTechUrl
// 设置是否是直播推流的主播
clientConfig.isAnchor = true
when (DebugConfig.getCarMachineType()) {
@@ -132,7 +135,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
} else {
clientConfig.thirdPartyDeviceId = Utils.getDevicesId()
}
//设置长链接的secretKey //todo 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
//设置长链接的secretKey 通过SHA1和包名找中台服务生成后续包名分渠道,需要做对应操作
clientConfig.secretKey = "YMj2VFDFxJ3Q4gNoZceJ"
clientConfig.iHttpDnsCurrentLocation = object : IHttpDnsCurrentLocation {

View File

@@ -31,6 +31,7 @@ import com.mogo.eagle.core.data.traffic.TrafficData
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
import com.mogo.eagle.core.function.api.map.angle.*
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
@@ -38,8 +39,6 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.Default
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.TooClose
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
import com.mogo.eagle.core.function.v2x.events.alarm.V2XAlarmServer
import com.mogo.eagle.core.function.v2x.events.bridge.BridgeApi
@@ -52,13 +51,12 @@ import com.mogo.eagle.core.function.v2x.events.utils.toV2XRoadEventEntity
import com.mogo.eagle.core.function.v2x.internal.V2XManager
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.V2XWarningTarget
import com.mogo.eagle.core.function.v2x.internal.data.*
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.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_V2X
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
@@ -209,6 +207,13 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
}
handleRoadMarkerEvent(event.data.toRoadMarker())
}
is V2XEvent.RoadEventX -> {
handleRoadMarkerEvent(event.data.toRoadMarker())
}
else -> {
Logger.e(TAG, "onAck other event: $event")
}
}
}
@@ -367,13 +372,13 @@ object V2XEventManager : IMoGoChassisLocationGCJ02Listener, IMoGoTokenCallback,
val change = changeVisualAngle
override fun onShow() {
if (change) {
CallerVisualAngleManager.changeVisualAngle(TooClose)
CallerVisualAngleManager.changeAngle(TooClose)
}
}
override fun onDismiss() {
if (change) {
CallerVisualAngleManager.changeVisualAngle(Default())
CallerVisualAngleManager.changeAngle(Default())
}
}
}

View File

@@ -90,18 +90,18 @@ public class MoGoV2XMarkerManager implements IMoGoV2XMarkerManager {
// 清除上次的道路事件, 这里注意,道路事件的触发和这里是异步操作会触发异常
mV2XRoadEventEntityArrayList.clear();
// 获取探路以及新鲜事儿
List<V2XMarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
List<MarkerExploreWay> exploreWayList = markerCardResult.getExploreWay();
if (exploreWayList != null) {
for (V2XMarkerExploreWay markerExploreWay : exploreWayList) {
for (MarkerExploreWay markerExploreWay : exploreWayList) {
if (EventTypeEnumNew.isRoadEvent(markerExploreWay.getPoiType())) {
V2XMarkerLocation markerLocation = markerExploreWay.getLocation();
MarkerLocation markerLocation = markerExploreWay.getLocation();
// 记录道路事件
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
v2XRoadEventEntity.setLocation(EntityUtilsKt.toMarkerLocation(markerLocation));
v2XRoadEventEntity.setLocation(markerLocation);
// 探路目前只有上报拥堵
String poi = markerExploreWay.getPoiType();
v2XRoadEventEntity.setPoiType(poi);
v2XRoadEventEntity.setNoveltyInfo(EntityUtilsKt.toMarkExploreWay(markerExploreWay, markerCardResult.getExtras()));
v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
v2XRoadEventEntity.setExpireTime(20000);
mV2XRoadEventEntityArrayList.add(v2XRoadEventEntity);
}

View File

@@ -7,7 +7,6 @@ import android.os.Looper
import android.view.animation.DecelerateInterpolator
import androidx.core.util.Pair
import com.mogo.cloud.commons.utils.*
import com.mogo.commons.AbsMogoApplication
import com.mogo.eagle.core.data.map.MogoLatLng
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.call.autopilot.*

View File

@@ -18,63 +18,39 @@ class V2XAiRoadEventMarker {
private val current = AtomicReference<Pair<IMogoPolyline?, List<IMogoMarker>?>>()
private val v2xLocation = AtomicReference<MogoLocation>()
private val overlayManager by lazy { CallerMapUIServiceManager.getOverlayManager() }
fun drawMarkers(entity: V2XRoadEventEntity, wrapper: MarkerWrapper) {
val extra = entity.noveltyInfo.extras["polygon"]
val polygon = entity.noveltyInfo.polygon
v2xMarker()?.drawableAlarmPOI(context(), entity, null)?.also {
wrapper.addMarker(it)
}
if (extra is List<*> && entity.poiType != EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.poiType) {
if (extra.size > 0) {
val polygons: MutableList<androidx.core.util.Pair<Double, Double>> = ArrayList()
for (i in extra.indices) {
val o = extra[i]!! as? androidx.core.util.Pair<*, *> ?: continue
val first = o.first
val second = o.second
if (first == null || second == null) {
continue
}
if (first !is Double || second !is Double) {
continue
}
polygons.add(androidx.core.util.Pair.create(second, first))
}
if (polygons.size > 0) {
val l2 = entity.noveltyInfo?.location ?: return
v2xLocation.set(MogoLocation().also {
it.longitude = l2.lon; it.latitude = l2.lat; it.heading = l2.angle
})
if (polygon != null && polygon.isNotEmpty() && entity.poiType != EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.poiType) {
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>()
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.first, p.second))
}
if (points.size > 2) {
points.add(points[0])
}
options.points(points)
options.useGradient(true)
options.useFacade(true)
options.setGps(true)
options.width(5f)
options.zIndex(75000f)
options.maxIndex(800000f)
val line = overlayManager?.addPolyline(options)
line?.let {
current.set(Pair(line, wrapper.markers))
line.isVisible = true
wrapper.addLine(line)
}
}
for (p in polygon) {
points.add(MogoLatLng(p.first, p.second))
}
if (points.size > 2) {
points.add(points[0])
}
options.points(points)
options.useGradient(true)
options.useFacade(true)
options.setGps(true)
options.width(5f)
options.zIndex(75000f)
options.maxIndex(800000f)
val line = overlayManager?.addPolyline(options)
line?.let {
current.set(Pair(line, wrapper.markers))
line.isVisible = true
wrapper.addLine(line)
}
}
}

View File

@@ -1,9 +1,7 @@
package com.mogo.eagle.core.function.v2x.events.scenario.scene.road;
import android.util.Log;
import androidx.core.util.Pair;
import com.mogo.eagle.core.data.enums.EventTypeEnumNew;
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay;
import com.mogo.eagle.core.data.map.entity.MarkerLocation;
@@ -15,7 +13,6 @@ 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;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@@ -34,10 +31,21 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
if (marker != null) {
if (entity != null) {
Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType());
if (!Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType())
&& !Objects.equals(entity.getPoiType(), EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType())
&& !Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType())
&& !Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType())) {
if (isAiRoadEvent(entity.getPoiType())) {
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
Log.d("RWJ", "V2XRoadEventMarker -> noveltyInfo:" + noveltyInfo);
if (noveltyInfo != null) {
Pair<Double, Double> gpsLocation = noveltyInfo.getGpsLocation();
List<Pair<Double, Double>> polygons = noveltyInfo.getPolygon();
if (gpsLocation != null && polygons != null) {
MarkerLocation location = noveltyInfo.getLocation();
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
AiRoadMarker aiMarker = new AiRoadMarker();
aiMarker.marker(m, true, isDrawRoadLine(m.getPoiType()));
AiRoadMarker.aiMakers.put(noveltyInfo.getInfoId(), aiMarker);
}
}
} else {
IMogoMarker iMarker = marker.drawableAlarmPOI(BridgeApi.INSTANCE.context(), entity, null);
if (iMarker != null) {
Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType() + "--- add Marker");
@@ -48,48 +56,6 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
} else {
Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType() + "--- return empty marker");
}
} else {
MarkerExploreWay noveltyInfo = entity.getNoveltyInfo();
Log.d("RWJ", "V2XRoadEventMarker -> noveltyInfo:" + noveltyInfo);
if (noveltyInfo != null && noveltyInfo.extras != null) {
List<Pair<Double, Double>> polygons = new ArrayList<>();
Pair<Double, Double> gpsLocation = null;
if (noveltyInfo.extras.containsKey("polygon")) {
Object extra = noveltyInfo.extras.get("polygon");
if (extra instanceof List) {
List l = (List) extra;
if (l.size() > 0) {
for (int i = 0; i < l.size(); i++) {
Object o = l.get(i);
if (!(o instanceof Pair)) {
continue;
}
Pair p = (Pair) o;
Object first = p.first;
Object second = p.second;
if (first == null || second == null) {
continue;
}
if (!(first instanceof Double) || !(second instanceof Double)) {
continue;
}
polygons.add(Pair.create((Double) first, (Double) second));
}
}
}
}
if (noveltyInfo.extras.containsKey("gps_location")) {
gpsLocation = (Pair<Double, Double>) ((List)(noveltyInfo.extras.get("gps_location"))).get(0);
}
if (!polygons.isEmpty() && gpsLocation != null) {
MarkerLocation location = noveltyInfo.getLocation();
AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity);
AiRoadMarker aiMarker = new AiRoadMarker();
aiMarker.marker(m, true, isDrawRoadLine(m.getPoiType()));
AiRoadMarker.aiMakers.put(noveltyInfo.getInfoId(), aiMarker);
}
}
}
}
}
@@ -98,6 +64,13 @@ public class V2XRoadEventMarker implements IV2XMarker<V2XRoadEventEntity> {
}
}
private boolean isAiRoadEvent(String poiType) {
return Objects.equals(poiType, EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType())
&& Objects.equals(poiType, EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType())
&& Objects.equals(poiType, EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType())
&& Objects.equals(poiType, EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType());
}
private boolean isDrawRoadLine(String poiType) {
return EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType().equals(poiType);
}

View File

@@ -11,6 +11,8 @@ 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.api.map.angle.Default;
import com.mogo.eagle.core.function.api.map.angle.RoadEvent;
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
@@ -151,7 +153,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void onShow() {
if (isNeedChangeAngle()) {
CallerVisualAngleManager.INSTANCE.changeVisualAngle(CallerVisualAngleManager.Scene.RoadEvent.INSTANCE);
CallerVisualAngleManager.INSTANCE.changeAngle(RoadEvent.INSTANCE);
}
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
if (entity != null) {
@@ -177,7 +179,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
public void onDismiss() {
CallerHmiManager.INSTANCE.dismissWarning(WarningDirectionEnum.ALERT_WARNING_TOP);
if (isNeedChangeAngle()) {
CallerVisualAngleManager.INSTANCE.changeVisualAngle(new CallerVisualAngleManager.Scene.Default(3, TimeUnit.SECONDS));
CallerVisualAngleManager.INSTANCE.changeAngle(new Default(3, TimeUnit.SECONDS));
}
release();
}

View File

@@ -4,7 +4,6 @@ import androidx.core.util.Pair
import com.mogo.eagle.core.data.enums.EventTypeEnumNew.Companion.isRoadEvent
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.MarkerUserInfo
import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity
import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker
import com.mogo.eagle.core.function.v2x.internal.data.*
@@ -13,85 +12,24 @@ import mogo.telematics.pad.MessagePad
import roadwork.Road
fun V2XMarkerLocation?.toMarkerLocation(): MarkerLocation? =
if (this == null) null else MarkerLocation().also {
it.lon = this.lon
it.lat = this.lat
it.address = this.address
it.angle = this.angle
}
fun MarkerExploreWayItem?.toMarkerExploreWayItem(): com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem? =
if (this == null) null else com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem().also {
it.illegalCount = this.illegalCount
it.content = this.content
it.url = this.url
it.thumbnail = this.thumbnail
}
fun V2XMarkerUserInfo?.toMarkerUserInfo(): MarkerUserInfo? =
if (this == null) null else MarkerUserInfo().also {
it.safeLabelType = this.safeLabelType
it.safeLabel = this.safeLabel
it.lastActiveweekAvgscore = this.lastActiveweekAvgscore
it.gender = this.gender
it.userHead = this.userHead
it.userName = this.userName
it.setAge(this.age)
}
fun V2XMarkerExploreWay.toMarkExploreWay(extras: Map<String, Any>? = null): MarkerExploreWay =
MarkerExploreWay().also {
it.items = this.items?.map { itx -> itx.toMarkerExploreWayItem() }
it.userInfo = this.userInfo?.toMarkerUserInfo()
it.distance = this.distance
it.cityName = this.cityName
it.setGenerateTime(this.generateTime)
it.infoId = this.infoId
it.setFileType(this.fileType)
it.setDirection(this.direction)
it.location = this.location?.toMarkerLocation()
it.sn = this.sn
it.canLive = this.canLive != "0"
it.poiType = this.poiType
it.type = this.type
it.infoCheckNode = this.infoCheckNode
it.isFabulous = this.isFabulous
it.uploadType = this.uploadType
it.isCanLive = this.canLive != "0"
it.extras = extras
}
fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult =
V2XMarkerCardResult().also { l1 ->
this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d ->
Pair(d.lon, d.lat)
}
extra["gps_location"] = listOf(
Pair(
this.roadwork?.center?.point?.lon ?: 0.0,
this.roadwork?.center?.point?.lat ?: 0.0
)
)
}
}
val centerX = this.roadwork?.center?.point?.lon ?: 0.0
val centerY = this.roadwork?.center?.point?.lat ?: 0.0
val id = "${centerX}_${centerY}"
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l1.exploreWay = ArrayList<MarkerExploreWay>().also { l2 ->
l2.add(MarkerExploreWay().also { l3 ->
l3.poiType = this.roadwork?.poiType?.toString()
l3.generateTime = this.roadwork?.detectTime ?: 0L
l3.location = V2XMarkerLocation().also { l4 ->
l3.setGenerateTime(this.roadwork?.detectTime ?: 0L)
l3.location = MarkerLocation().also { l4 ->
val p = CoordinateTransform.WGS84ToGCJ02(this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.point?.lat ?: 0.0)
l4.lon = p[0]
l4.lat = p[1]
l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0
}
l3.infoId = id
l3.gpsLocation = Pair(this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.point?.lat ?: 0.0)
l3.polygon = this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.map { Pair(it.lon, it.lat) }
})
}
AiRoadMarker.aiMakers[id]?.receive()
@@ -99,52 +37,41 @@ fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult =
fun V2XRoadXData.toRoadMarker(): V2XMarkerCardResult =
V2XMarkerCardResult().also { l1 ->
this.polygon?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d ->
Pair(d.lon, d.lat)
}
extra["gps_location"] = listOf(Pair(this.center?.lon ?: 0.0, this.center?.lat ?: 0.0))
}
}
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l1.exploreWay = ArrayList<MarkerExploreWay>().also { l2 ->
l2.add(MarkerExploreWay().also { l3 ->
l3.poiType = this.poiType
l3.generateTime = this.detectTime ?: 0L
l3.location = V2XMarkerLocation().also { l4 ->
l3.setGenerateTime(this.detectTime ?: 0L)
l3.location = MarkerLocation().also { l4 ->
val p = CoordinateTransform.WGS84ToGCJ02(this.center?.lon ?: 0.0, this.center?.lat ?: 0.0)
l4.lon = p[0]
l4.lat = p[1]
l4.angle = this.centerRoad?.bearing ?: 0.0
}
l3.infoId = this.index
l3.gpsLocation = Pair(this.center?.lon ?: 0.0, this.center?.lat ?: 0.0)
l3.polygon = this.polygon?.takeIf { it.isNotEmpty() }?.map { Pair(it.lon, it.lat) }
})
}
AiRoadMarker.aiMakers[this.index]?.receive()
}
fun MessagePad.TrackedObject.toRoadMarker(poiType: String): V2XMarkerCardResult =
V2XMarkerCardResult().also { l1 ->
this.polygonList?.takeIf { it.isNotEmpty() }?.also { old ->
l1.extras = HashMap<String, List<Pair<Double, Double>>>().also { extra ->
extra["polygon"] = old.map { d -> Pair(d.longitude, d.latitude) }
extra["gps_location"] = listOf(Pair(this.longitude, this.latitude))
}
}
val id = "${this.longitude}_${this.latitude}"
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
l2.add(V2XMarkerExploreWay().also { l3 ->
l1.exploreWay = ArrayList<MarkerExploreWay>().also { l2 ->
l2.add(MarkerExploreWay().also { l3 ->
l3.poiType = poiType
l3.generateTime = 0L
l3.location = V2XMarkerLocation().also { l4 ->
l3.setGenerateTime(0L)
l3.location = MarkerLocation().also { l4 ->
val p = CoordinateTransform.WGS84ToGCJ02(this.longitude, this.latitude)
l4.lon = p[0]
l4.lat = p[1]
l4.angle = this.heading
}
l3.infoId = id
l3.gpsLocation = Pair(this.longitude, this.latitude)
l3.polygon = this.polygonList?.takeIf { it.isNotEmpty() }?.map { Pair(it.longitude, it.latitude) }
})
}
AiRoadMarker.aiMakers[id]?.receive()
@@ -152,14 +79,14 @@ fun MessagePad.TrackedObject.toRoadMarker(poiType: String): V2XMarkerCardResult
fun V2XMarkerCardResult.toV2XRoadEventEntity(): V2XRoadEventEntity =
V2XRoadEventEntity().also { l1 ->
val exploreWayList: List<V2XMarkerExploreWay>? = this.exploreWay
val exploreWayList: List<MarkerExploreWay>? = this.exploreWay
if (!exploreWayList.isNullOrEmpty() && exploreWayList.isNotEmpty()) {
for (markerExploreWay in exploreWayList) {
if (isRoadEvent(markerExploreWay.poiType)) {
val markerLocation = markerExploreWay.location
l1.location = markerLocation.toMarkerLocation()
l1.location = markerLocation
l1.poiType = markerExploreWay.poiType
l1.noveltyInfo = markerExploreWay.toMarkExploreWay(this.extras)
l1.noveltyInfo = markerExploreWay
l1.expireTime = 20000
}
}

View File

@@ -1,6 +1,8 @@
package com.mogo.eagle.core.function.v2x.internal.data
import androidx.annotation.Keep
import com.mogo.eagle.core.data.map.entity.MarkerExploreWay
import com.mogo.eagle.core.data.map.entity.MarkerLocation
import java.io.Serializable
@Keep
@@ -41,20 +43,15 @@ class V2XMarkerCardResult: V2XBaseData(), Serializable {
/**
* 探路数据集合
*/
var exploreWay: List<V2XMarkerExploreWay>? = null
var exploreWay: List<MarkerExploreWay>? = null
/**
* 服务端下发消息时间
*/
var messageTime: Long = 0
/**
* 额外信息
*/
var extras: Map<String, Any>? = null
override fun toString(): String {
return "MarkerCardResult(dataType=$dataType, carChat=$carChat, shareMusic=$shareMusic, noveltyInfo=$noveltyInfo, onlineCar=$onlineCar, exploreWay=$exploreWay, messageTime=$messageTime, extras=$extras)"
return "MarkerCardResult(dataType=$dataType, carChat=$carChat, shareMusic=$shareMusic, noveltyInfo=$noveltyInfo, onlineCar=$onlineCar, exploreWay=$exploreWay, messageTime=$messageTime)"
}
}
@@ -369,7 +366,7 @@ class V2XMarkerExploreWay: Serializable {
/**
* 位置信息
*/
var location: V2XMarkerLocation? = null
var location: MarkerLocation? = null
/**
* 车辆方位