[8.2.0][opt]高德、高精地图切换改为依赖底盘给的车速
This commit is contained in:
@@ -3,9 +3,11 @@ package com.mogo.och.shuttle.weaknet.passenger.presenter
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.bridge.autopilot.location.OchLocationManager
|
||||
import com.mogo.och.common.module.biz.birdge.BridgeListener
|
||||
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
@@ -20,11 +22,12 @@ import com.mogo.och.shuttle.weaknet.passenger.ui.map.PM2HPMapFragment
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.AIMessageManager
|
||||
import com.mogo.och.shuttle.weaknet.passenger.ui.mind.bean.AIMessage
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlin.math.abs
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
||||
Presenter<PM2HPMapFragment?>(view), ADASCallback, ICommonCallback, BridgeListener,
|
||||
AIMessageManager.AIMessageListener {
|
||||
AIMessageManager.AIMessageListener, IMoGoChassisLocationGCJ02Listener {
|
||||
|
||||
private val TAG = "PM2ADASPresenter"
|
||||
|
||||
@@ -69,6 +72,9 @@ class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
||||
|
||||
private var lastAIMessageCountDown: Disposable? = null
|
||||
|
||||
@Volatile
|
||||
private var isSpeedGreaterThan5 = false
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
PM2ADASModel.INSTANCE.init(context)
|
||||
@@ -80,6 +86,7 @@ class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
||||
CommonModel.setRouteLineInfoCallback(TAG, this)
|
||||
BridgeManager.addBridgeListener(TAG,this)
|
||||
AIMessageManager.registerListener(this)
|
||||
OchLocationManager.addGCJ02Listener(TAG, 3, this)
|
||||
}
|
||||
|
||||
private fun removeListener() {
|
||||
@@ -88,6 +95,7 @@ class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
||||
CommonModel.releaseListeners()
|
||||
BridgeManager.removeBridgeListener(TAG)
|
||||
AIMessageManager.unregisterListener(this)
|
||||
OchLocationManager.removeGCJ02Listener(TAG)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
@@ -183,7 +191,7 @@ class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
||||
BizLoopManager.runInMainThread{
|
||||
// 是否有订单
|
||||
if(haveLine){// 有订单
|
||||
if(arrived){//展示高德地图
|
||||
if(!isSpeedGreaterThan5){//展示高德地图
|
||||
if(aiMessageShowmagic){
|
||||
updateMapFlag(false)
|
||||
// 展示高德地图+展示mogomind
|
||||
@@ -239,4 +247,13 @@ class PM2ADASPresenter(view: PM2HPMapFragment?) :
|
||||
// FunctionBuildConfig.isDrawPreIdentifyData = false
|
||||
// }
|
||||
}
|
||||
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (mogoLocation != null) {
|
||||
val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt()
|
||||
isSpeedGreaterThan5 = speedKM > 5
|
||||
} else {
|
||||
isSpeedGreaterThan5 = false
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user