[V2X][Road]增加移除锥筒后超时消失逻辑
This commit is contained in:
@@ -483,6 +483,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb
|
||||
})
|
||||
}
|
||||
|
||||
AiRoadMarker.receive(Marker(this.roadwork?.center?.point?.lat ?: 0.0, this.roadwork?.center?.point?.lon ?: 0.0, this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, null, null, null))
|
||||
}
|
||||
|
||||
// private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map<String, Any>? = null): V2XRoadEventEntity { // 记录道路事件
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad
|
||||
import android.animation.*
|
||||
import android.content.*
|
||||
import android.graphics.*
|
||||
import android.os.*
|
||||
import android.view.animation.*
|
||||
import androidx.core.util.Pair
|
||||
import androidx.lifecycle.*
|
||||
@@ -22,6 +23,7 @@ import com.mogo.map.overlay.*
|
||||
import com.mogo.module.common.entity.*
|
||||
import com.mogo.module.common.utils.*
|
||||
import io.netty.util.internal.*
|
||||
import java.lang.Runnable
|
||||
import java.util.*
|
||||
import java.util.concurrent.*
|
||||
import java.util.concurrent.atomic.*
|
||||
@@ -49,6 +51,17 @@ object AiRoadMarker {
|
||||
private val START_COLOR = Color.parseColor("#002ABAD9")
|
||||
private val END_COLOR = Color.parseColor("#66FF7A30")
|
||||
|
||||
private val handler by lazy {
|
||||
Handler(Looper.getMainLooper())
|
||||
}
|
||||
|
||||
private val checkExpiredTask = Runnable {
|
||||
val marker = this@AiRoadMarker.marker.get()
|
||||
if (marker != null) {
|
||||
unMarker(marker)
|
||||
}
|
||||
}
|
||||
|
||||
private val markers = ConcurrentSet<Marker>()
|
||||
|
||||
private val options by lazy {
|
||||
@@ -189,6 +202,7 @@ object AiRoadMarker {
|
||||
|
||||
fun marker(marker: Marker, drawMarker: Boolean) {
|
||||
val location = carLocation.get() ?: return
|
||||
this.marker.set(marker)
|
||||
//施工中心点前方的自车行驶方向上300米距离
|
||||
val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f)
|
||||
//施工中心点后方的自车行驶方向上300米距离
|
||||
@@ -319,6 +333,25 @@ object AiRoadMarker {
|
||||
return degree < 90
|
||||
}
|
||||
|
||||
fun receive(marker: Marker) {
|
||||
val cur = this.marker.get()
|
||||
if (cur == marker) {
|
||||
val poi = this.marker.get()
|
||||
val car = this.carLocation.get()
|
||||
if (poi != null && car != null) {
|
||||
val distance = DrivingDirectionUtils.distance(car.first, car.second, marker.poi_lon, marker.poi_lat)
|
||||
if (distance < 300) {
|
||||
checkExpired()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkExpired() {
|
||||
handler.removeCallbacks(checkExpiredTask)
|
||||
handler.postDelayed(checkExpiredTask, 5000)
|
||||
}
|
||||
|
||||
data class Marker(
|
||||
val poi_lat: Double,
|
||||
val poi_lon: Double,
|
||||
|
||||
Reference in New Issue
Block a user