[2.13.0]修正十字路口视角切换后未恢复到默认视角
This commit is contained in:
@@ -9,6 +9,7 @@ import androidx.lifecycle.Lifecycle.Event.ON_DESTROY
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.*
|
||||
import com.mogo.eagle.core.data.map.MapRoadInfo.StopLine
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager.OnRoadListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager.Scene.*
|
||||
@@ -24,6 +25,8 @@ import kotlinx.coroutines.internal.synchronized
|
||||
import java.util.*
|
||||
import java.util.concurrent.TimeUnit
|
||||
import java.util.concurrent.TimeUnit.SECONDS
|
||||
import java.util.concurrent.atomic.*
|
||||
import kotlin.math.*
|
||||
|
||||
/**
|
||||
* 高精地图视角管理类
|
||||
@@ -59,6 +62,9 @@ object CallerVisualAngleManager {
|
||||
val displayThreshold: Long //最大展示时长 > 0; 表示最长展示多长时间, -1 表示,一直展示,直到触发默认视角, 0: 默认视角专用值,
|
||||
}
|
||||
|
||||
private val beginLocation = AtomicReference<MogoLocation>()
|
||||
|
||||
|
||||
private val listener = object : OnRoadListener {
|
||||
private var roadId = ""
|
||||
override fun onRoadIdInfo(roadId: String) {
|
||||
@@ -68,13 +74,24 @@ object CallerVisualAngleManager {
|
||||
hasCrossRoad = false
|
||||
changeVisualAngle(CrossRoad(false))
|
||||
}
|
||||
} else {
|
||||
if (hasCrossRoad) {
|
||||
val beginLoc = beginLocation.get()
|
||||
val endLoc = CallerMapLocationListenerManager.getCurrentLocation()
|
||||
if (beginLoc != null && endLoc != null && abs(beginLoc.bearing - endLoc.bearing) >= 170) {
|
||||
hasCrossRoad = false
|
||||
changeVisualAngle(CrossRoad(false))
|
||||
}
|
||||
}
|
||||
}
|
||||
this.roadId = roadId
|
||||
}
|
||||
|
||||
|
||||
override fun onStopLineInfo(info: StopLine) {
|
||||
if (!hasCrossRoad && info.distanceOfCarToStopLine <= 30.0) {
|
||||
hasCrossRoad = true
|
||||
beginLocation.set(CallerMapLocationListenerManager.getCurrentLocation())
|
||||
changeVisualAngle(CrossRoad(true))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user