测试了设置V2X预警车辆颜色的修改
This commit is contained in:
@@ -5,14 +5,12 @@ import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.obu.mogo.map.ObuRecognizedResultDrawer
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.adas.entity.ADASRecognizedResult
|
||||
import com.mogo.service.warning.IMoGoWaringProvider
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.support.obu.MogoObuManager
|
||||
import com.zhidao.support.obu.OnMogoObuListener
|
||||
import com.zhidao.support.obu.constants.ObuConstants
|
||||
import com.zhidao.support.obu.model.*
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* @description
|
||||
@@ -27,7 +25,6 @@ class MogoPrivateObuManager private constructor() {
|
||||
}
|
||||
}
|
||||
|
||||
private var resultList: MutableList<ADASRecognizedResult>? = null
|
||||
private var mMogoServiceApis: IMogoServiceApis? = null
|
||||
private var mIMoGoWaringProvider: IMoGoWaringProvider? = null
|
||||
val icw_data =
|
||||
@@ -118,29 +115,36 @@ class MogoPrivateObuManager private constructor() {
|
||||
|
||||
//TODO 他车是否一直出现
|
||||
override fun onCvxV2vThreatIndInfo(info: CvxV2vThreatIndInfo) {
|
||||
Logger.e(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info")
|
||||
//预警信息,预警类型 threat_level 3
|
||||
if (info != null) {
|
||||
Logger.e(MogoObuConst.TAG_MOGO_OBU, "onCvxV2vThreatIndInfo ------> $info")
|
||||
if (info.threat_info != null) {
|
||||
if (info.threat_info.threat_level == 2 ||
|
||||
info.threat_info.threat_level == 3) {
|
||||
//预警方位
|
||||
val direction = info.ext_info.target_classification
|
||||
if (info.threat_info != null) {
|
||||
if (info.threat_info.threat_level == 3) {
|
||||
//预警方位
|
||||
val direction = info.ext_info.target_classification
|
||||
|
||||
//显示警告弹框
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(getMessage(direction), "ACTION_V2X_FRONT_WARNING")
|
||||
//显示警告弹框
|
||||
mMogoServiceApis!!.v2XListenerManager.warningChangedForListenerWithDirection(
|
||||
getMessage(direction),
|
||||
"ACTION_V2X_FRONT_WARNING"
|
||||
)
|
||||
|
||||
//处理预警类型
|
||||
val appId = info.threat_info.app_id
|
||||
Logger.d(MogoObuConst.TAG_MOGO_OBU, "direction = " + direction + "----" + getMessage(direction) + "--appId = " + appId)
|
||||
handleSdkObu(getEventType(appId), info.threat_info.threat_level)
|
||||
}
|
||||
|
||||
//预警数据的组装,车辆实时移动和变色 TODO 这里需要obu提供他车列表 暂时不做
|
||||
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult(getResultList(info));
|
||||
} else {
|
||||
Logger.e(MogoObuConst.TAG_MOGO_OBU, "info == null ")
|
||||
//处理预警类型
|
||||
val appId = info.threat_info.app_id
|
||||
Logger.d(
|
||||
MogoObuConst.TAG_MOGO_OBU,
|
||||
"direction = " + direction + "----" + getMessage(direction) + "--appId = " + appId
|
||||
)
|
||||
handleSdkObu(getEventType(appId), info.threat_info.threat_level)
|
||||
}
|
||||
|
||||
//更新周边车辆进行预警颜色变换,车辆实时移动和变色
|
||||
mObuRecognizedResultDrawer?.updateCvxRvInfoIndInfo(
|
||||
info.threat_info.threat_level,
|
||||
info.vehicle_id,
|
||||
info.basic_info
|
||||
)
|
||||
} else {
|
||||
Logger.e(MogoObuConst.TAG_MOGO_OBU, "info == null ")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -196,26 +200,6 @@ class MogoPrivateObuManager private constructor() {
|
||||
return 0
|
||||
}
|
||||
|
||||
private fun getResultList(info: CvxV2vThreatIndInfo): List<ADASRecognizedResult?>? {
|
||||
if (resultList == null) {
|
||||
resultList = ArrayList<ADASRecognizedResult>()
|
||||
}
|
||||
val adasRecognizedResult = ADASRecognizedResult()
|
||||
adasRecognizedResult.uuid = info.vehicle_id
|
||||
if (info.basic_info != null && info.basic_info.position != null) {
|
||||
adasRecognizedResult.lat = info.basic_info.position.latitude
|
||||
adasRecognizedResult.lon = info.basic_info.position.longitude
|
||||
}
|
||||
adasRecognizedResult.type = 3 //小轿车
|
||||
adasRecognizedResult.heading = info.basic_info.heading
|
||||
adasRecognizedResult.speed = info.basic_info.speed
|
||||
|
||||
resultList!!.add(adasRecognizedResult)
|
||||
|
||||
return resultList
|
||||
}
|
||||
|
||||
|
||||
fun release() {
|
||||
MogoObuManager.getInstance().unregisterListener()
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.common.R
|
||||
import com.mogo.module.common.constants.DataTypes
|
||||
import com.mogo.utils.WorkThreadHandler
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.support.obu.model.CvxRvInfoIndInfo
|
||||
import com.zhidao.support.obu.model.advance.MovingObjectInfo
|
||||
import com.zhidao.support.obu.model.advance.Position
|
||||
@@ -51,20 +50,23 @@ class ObuRecognizedResultDrawer() {
|
||||
|
||||
/*// TODO 测试数据
|
||||
mCvxRvInfoIndInfoMap.forEach {
|
||||
|
||||
var latitude = ((it.value.basic_info.position.latitude * 10000000.0).toLong())
|
||||
var longitude = (it.value.basic_info.position.longitude * 10000000.0).toLong()
|
||||
|
||||
latitude += 10
|
||||
latitude += 5
|
||||
//longitude += 100
|
||||
|
||||
it.value.basic_info.position.setValue(
|
||||
0,
|
||||
latitude,
|
||||
longitude,
|
||||
30
|
||||
)
|
||||
addCvxRvInfoIndInfo(it.value)
|
||||
val result = latitude.toInt() % 2
|
||||
if (result == 0) {
|
||||
updateCvxRvInfoIndInfo(0, it.key, it.value.basic_info)
|
||||
} else {
|
||||
updateCvxRvInfoIndInfo(3, it.key, it.value.basic_info)
|
||||
}
|
||||
//addCvxRvInfoIndInfo(it.value)
|
||||
}*/
|
||||
|
||||
|
||||
@@ -91,7 +93,33 @@ class ObuRecognizedResultDrawer() {
|
||||
* 添加识别的数据
|
||||
*/
|
||||
fun addCvxRvInfoIndInfo(value: CvxRvInfoIndInfo) {
|
||||
mCvxRvInfoIndInfoMap[value.vehicle_id] = value;
|
||||
mCvxRvInfoIndInfoMap[value.vehicle_id] = value
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新识别数据,V2V预警的时候需要修改车辆颜色
|
||||
*/
|
||||
fun updateCvxRvInfoIndInfo(threatLevel: Int, key: String, movingObjectInfo: MovingObjectInfo) {
|
||||
val value = mCvxRvInfoIndInfoMap[key]
|
||||
value?.let {
|
||||
value.basic_info = movingObjectInfo
|
||||
// 修改颜色
|
||||
when (threatLevel) {
|
||||
1 -> {
|
||||
mMarkersCaches[key]?.setAnchorColor("#D8D8D8FF")
|
||||
}
|
||||
2 -> {
|
||||
mMarkersCaches[key]?.setAnchorColor("#FFD53EFF")
|
||||
}
|
||||
3 -> {
|
||||
mMarkersCaches[key]?.setAnchorColor("#FF3C45FF")
|
||||
}
|
||||
else -> {
|
||||
mMarkersCaches[key]?.setAnchorColor("#D8D8D8FF")
|
||||
}
|
||||
}
|
||||
mCvxRvInfoIndInfoMap[key] = value
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user