[V2X]V2X新增道路事件
This commit is contained in:
@@ -64,10 +64,7 @@ import com.mogo.service.statusmanager.StatusDescriptor.SEEK_HELPING
|
||||
import com.mogo.v2x.V2XManager
|
||||
import com.mogo.v2x.callback.IV2XCallback
|
||||
import com.mogo.v2x.config.V2XConfig
|
||||
import com.mogo.v2x.data.V2XAdvanceWarning
|
||||
import com.mogo.v2x.data.V2XMarkerCardResult
|
||||
import com.mogo.v2x.data.V2XOptimalRoute
|
||||
import com.mogo.v2x.data.V2XWarningTarget
|
||||
import com.mogo.v2x.data.*
|
||||
import com.mogo.v2x.event.V2XEvent
|
||||
import com.shuyu.gsyvideoplayer.GSYVideoManager
|
||||
import com.shuyu.gsyvideoplayer.cache.CacheFactory
|
||||
@@ -78,6 +75,7 @@ import com.shuyu.gsyvideoplayer.player.PlayerFactory
|
||||
import com.shuyu.gsyvideoplayer.utils.GSYVideoType
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.android.asCoroutineDispatcher
|
||||
import roadwork.Road.RW_PB
|
||||
import tv.danmaku.ijk.media.player.IjkMediaPlayer
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
@@ -452,9 +450,27 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
is V2XEvent.Warning -> {
|
||||
handleWarningTargetEvent(event.data)
|
||||
}
|
||||
is V2XEvent.RoadAI -> {
|
||||
handleRoadMarkerEvent(event.data.toRoadMarker)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val RW_PB.toRoadMarker: V2XMarkerCardResult
|
||||
get() = V2XMarkerCardResult().also { l1 ->
|
||||
l1.exploreWay = ArrayList<V2XMarkerExploreWay>().also { l2 ->
|
||||
l2.add(V2XMarkerExploreWay().also { l3 ->
|
||||
l3.poiType = this.roadwork?.poiType?.toString()
|
||||
l3.generateTime = this.roadwork?.detectTime ?: 0L
|
||||
l3.location = V2XMarkerLocation().also { l4 ->
|
||||
l4.lat = this.roadwork?.center?.point?.lat ?: 0.0
|
||||
l4.lon = this.roadwork?.center?.point?.lon ?: 0.0
|
||||
l4.angle = -1.0
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleWarningTargetEvent(data: V2XWarningTarget) {
|
||||
val v2xMessageEntity = V2XMessageEntity<V2XWarningTarget>()
|
||||
v2xMessageEntity.type = V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS
|
||||
|
||||
@@ -48,7 +48,8 @@ public class V2XAlarmServer {
|
||||
// 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告
|
||||
for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) {
|
||||
// 0、道路事件必须有朝向,角度>=0;
|
||||
if (v2XRoadEventEntity.getLocation().getAngle() >= 0) {
|
||||
boolean ignoreAngle = v2XRoadEventEntity.getLocation().getAngle() < 0;
|
||||
if (v2XRoadEventEntity.getLocation().getAngle() >= 0 || ignoreAngle) {
|
||||
// 计算车辆距离指定气泡的距离
|
||||
MarkerLocation eventLocation = v2XRoadEventEntity.getLocation();
|
||||
// 1、判断是否到达了触发距离,20 ~ 500,
|
||||
@@ -63,7 +64,7 @@ public class V2XAlarmServer {
|
||||
double carBearing = currentLocation.getBearing();
|
||||
double eventBearing = eventLocation.getAngle();
|
||||
double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing);
|
||||
if (diffAngle < 20) {
|
||||
if (ignoreAngle || diffAngle < 20) {
|
||||
// 3、计算当前车辆行驶方向与事件位置之间夹角《20度,保证道路事件在车辆前方
|
||||
double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi(
|
||||
currentLocation.getLongitude(),
|
||||
@@ -72,7 +73,7 @@ public class V2XAlarmServer {
|
||||
eventLocation.getLat(),
|
||||
(int) currentLocation.getBearing()
|
||||
);
|
||||
if (0 <= eventAngle && eventAngle <= 20) {
|
||||
if (ignoreAngle || 0 <= eventAngle && eventAngle <= 20) {
|
||||
// 判断是否已经提示过道路事件
|
||||
boolean isAlreadyAlert = false;
|
||||
String lastTime = mAlertRoadEventList.get(v2XRoadEventEntity);
|
||||
|
||||
Reference in New Issue
Block a user