[6.5.0]feat: 通用事件弹框,增加支持 文本/图片/直播拉流 三种形式展示;

refactor: 优化 通过公交站点 计算逻辑;
feat: 通过公交站点,增加调式面板按钮 动态控制是否展示 计算范围边界点在高精地图绘制;
feat: 增加定义 事件类型 通过公交站点 他车逆行;
This commit is contained in:
aibingbing
2024-07-02 16:27:30 +08:00
parent 9b5a965fc2
commit 1df3e6637e
16 changed files with 299 additions and 69 deletions

View File

@@ -2,8 +2,8 @@ package com.mogo.eagle.function.biz.v2x.busstation
import android.os.Handler
import android.os.HandlerThread
import com.mogo.commons.debug.DebugConfig
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.config.HmiBuildConfig
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
@@ -14,6 +14,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.eagle.core.utilcode.util.UriUtils
import com.mogo.map.MogoData
import com.mogo.map.entities.BusStation
import com.mogo.map.overlay.core.Level
@@ -47,9 +48,11 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
// 查询出来的符合条件的公交站点集合
private val busStationNearByQueue = LinkedList<List<BusStation>>()
// 需要提醒的公交站点
// 需要提醒的公交站点(待提醒,已提醒)
private val busStationListNeedNotified = HashMap<String, BusStation>()
private val isNotifyRunnableRunning = AtomicBoolean(false)
private val isDriverScreen by lazy {
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)
}
@@ -94,12 +97,12 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
val currentLocation =
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
busStationListNeedNotified.values.forEach {
val distance = CoordinateUtils.calculateLineDistance(
currentLocation.longitude,
currentLocation.latitude,
it.getBusStationPoint().longitude,
it.getBusStationPoint().latitude,
).toInt()
// val distance = CoordinateUtils.calculateLineDistance(
// currentLocation.longitude,
// currentLocation.latitude,
// it.getBusStationPoint().longitude,
// it.getBusStationPoint().latitude,
// ).toInt()
val angle = DrivingDirectionUtils.getDegreeOfCar2Poi(
currentLocation.longitude,
currentLocation.latitude,
@@ -107,7 +110,7 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
it.getBusStationPoint().latitude,
currentLocation.heading.toInt()
)
if (distance<=5 && angle >= 90) {
if (angle >= 90) {
CallerRoadV2NEventWindowListenerManager.dismiss(it.getBusStationId())
busStationListNeedNotified.remove(it.getBusStationId())
Logger.d(
@@ -119,36 +122,43 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
}
// 开始提醒
if (busStationListNeedNotified.isNotEmpty()) {
if (busStationListNeedNotified.isNotEmpty() && !isNotifyRunnableRunning.get()) {
handler.removeCallbacks(notificationCheckRunnable)
handler.post(notificationCheckRunnable)
}
} catch (e: Exception) {
e.printStackTrace()
} finally {
handler?.postDelayed(this, 1000L)
handler?.postDelayed(this, 800L)
}
}
}
private val notificationCheckRunnable = object : Runnable {
override fun run() {
isNotifyRunnableRunning.set(true)
if (busStationListNeedNotified.isNotEmpty()) {
val list = busStationListNeedNotified.values.toList()
.filter { it.notifyTime <= 0 && it.notifyDistance > 0 }
.sortedBy { it.notifyDistance }
if (list.isNotEmpty()) {
list.first().also {
//TODO 调整调用方式
it.notifyTime = System.currentTimeMillis()
CallerRoadV2NEventWindowListenerManager.show(
CallerRoadV2NEventWindowListenerManager.showImage(
it.getBusStationId(),
it.notifyTime,
EventTypeEnumNew.getUpdateIconRes(""),
"前方${it.notifyDistance}米有公交站,蘑菇提醒您小心右侧行人及来车",
EventTypeEnumNew.getUpdateIconRes(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
String.format(
EventTypeEnumNew.getAlarmContent(EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType),
it.notifyDistance
),
isDriverScreen,
"192.168.1.1",
0.0, 0.0
UriUtils.res2Uri(
EventTypeEnumNew.getPoiTypeBg(
EventTypeEnumNew.TYPE_USECASE_ROAD_BUS_STATION.poiType,
false
).toString()
).toString()
)
Logger.d(
TAG,
@@ -156,10 +166,13 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
)
}
if (list.size >= 2) {
isNotifyRunnableRunning.set(true)
handler.postDelayed(this, 4000L)
return
}
}
}
isNotifyRunnableRunning.set(false)
}
}
@@ -215,11 +228,7 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
newPoint?.also {
farthestLocationList.add(LonLatPoint(it.first, it.second))
}
if (DebugConfig.isDebug()) {
farthestLocationList.last().also {
showHDMarker(it.longitude, it.latitude)
}
}
busStationHDMarkerStrategy()
}
MogoData.mogoMapData.get()?.also { iMogoData ->
val busStationList = iMogoData.getBusStation(farthestLocationList)
@@ -250,6 +259,21 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
}
}
private var hasShownBorderPointHDMarker = false
private fun busStationHDMarkerStrategy() {
if (HmiBuildConfig.isShowBusStationStrategyBorderPoint) {
farthestLocationList.last().also {
showHDMarker(it.longitude, it.latitude)
}
hasShownBorderPointHDMarker = true
} else {
if (hasShownBorderPointHDMarker) {
removeHDMarker()
hasShownBorderPointHDMarker = false
}
}
}
private fun showHDMarker(lon: Double, lat: Double) {
val builder = Point.Options.Builder(
"TYPE_MARKER_BUS_STATION", Level.MAP_MARKER
@@ -265,4 +289,9 @@ object BusStationEventManager : IMoGoChassisLocationWGS84Listener {
overlayManager?.showOrUpdatePoint(builder.build())
}
private fun removeHDMarker() {
val overlayManager = CallerMapUIServiceManager.getOverlayManager()
overlayManager?.removeAllPointsInOwner("TYPE_MARKER_BUS_STATION")
}
}

View File

@@ -199,7 +199,7 @@ internal object V2NIdentifyDrawer {
}
}
val alert = sb.toString()
CallerRoadV2NEventWindowListenerManager.show("${itx.longitude}-${itx.latitude}", itx.systemTime.toLong(), EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude)
CallerRoadV2NEventWindowListenerManager.showLiveVideo("${itx.longitude}-${itx.latitude}", itx.systemTime.toLong(), EventTypeEnumNew.getUpdateIconRes(poiType), alert, isDriver, itx.cameraIp, itx.longitude, itx.latitude)
}
}
//消息埋点