[2.13.0-arch-opt] merge
This commit is contained in:
@@ -2,23 +2,50 @@ package com.mogo.eagle.core.function.map
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.map.MogoMapView
|
||||
import mogo.telematics.pad.MessagePad
|
||||
|
||||
class MapBizView(context: Context?) : MogoMapView(context) {
|
||||
class MapBizView(context: Context?) : MogoMapView(context), IMoGoSkinModeChangeListener,
|
||||
IMoGoPlanningRottingListener, IMoGoChassisLocationWGS84Listener, IMoGoChassisLamplightListener {
|
||||
|
||||
override fun onCreate(bundle: Bundle?) {
|
||||
super.onCreate(bundle)
|
||||
map.uiController.showMyLocation(true)
|
||||
// 添加Caller监听
|
||||
// CallerSkinModeListenerManager.addListener(MapFragment.functionName, this)
|
||||
//
|
||||
// CallerChassisLocationWGS84ListenerManager.addListener(MapFragment.functionName, this)
|
||||
// CallerChassisLamplightListenerManager.addListener(MapFragment.functionName, this)
|
||||
|
||||
CallerSkinModeListenerManager.addListener(MapFragment.functionName, this)
|
||||
CallerPlanningRottingListenerManager.addListener(MapFragment.functionName, this)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(MapFragment.functionName, this)
|
||||
CallerChassisLamplightListenerManager.addListener(MapFragment.functionName, this)
|
||||
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MessagePad.GnssInfo?) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
// 先取消注册数据,再onDestroy
|
||||
CallerSkinModeListenerManager.removeListener(MapFragment.functionName)
|
||||
CallerPlanningRottingListenerManager.removeListener(MapFragment.functionName)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(MapFragment.functionName)
|
||||
CallerChassisLamplightListenerManager.removeListener(MapFragment.functionName)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,12 +6,12 @@ import android.view.View
|
||||
import chassis.Chassis
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
|
||||
import com.mogo.eagle.core.data.map.CenterLine
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
import com.mogo.eagle.core.function.business.MapPointCloudSubscriber
|
||||
@@ -20,13 +20,18 @@ import com.mogo.eagle.core.function.business.identify.MapIdentifySubscriber
|
||||
import com.mogo.eagle.core.function.business.routeoverlay.MogoRouteOverlayManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLamplightListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showBrakeLight
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showTurnLight
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager
|
||||
import com.mogo.eagle.core.function.overview.InfStructureManager.savePlanningData
|
||||
import com.mogo.eagle.core.function.overview.obtainViewModel
|
||||
import com.mogo.eagle.core.function.overview.vm.OverViewModel
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.map.IMogoMap
|
||||
@@ -43,11 +48,11 @@ import com.zhidaoauto.map.sdk.open.business.PointCloudHelper
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP)
|
||||
class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
MapView,
|
||||
IMoGoMapFragmentProvider,
|
||||
IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener,
|
||||
IMoGoChassisLamplightListener {
|
||||
MapView,
|
||||
IMoGoMapFragmentProvider,
|
||||
IMoGoSkinModeChangeListener,
|
||||
IMoGoChassisLocationWGS84Listener,
|
||||
IMoGoChassisLamplightListener {
|
||||
|
||||
private var mMogoMapView: MogoMapView? = null
|
||||
private var mMogoMap: IMogoMap? = null
|
||||
@@ -236,7 +241,7 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
}
|
||||
}
|
||||
|
||||
private fun getSightModeAngle(mode: Int): Float {
|
||||
private fun getSightModeAngle(mode: Int): Float { //todo 宏宇
|
||||
var angle = 0.0f
|
||||
when (mode) {
|
||||
SIGHT_MODE_NORMAL -> {
|
||||
@@ -314,66 +319,28 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
|
||||
override val functionName: String
|
||||
get() = functionName
|
||||
|
||||
private var turnLightTimes = 0
|
||||
private var isOnTurnLight = false
|
||||
private var turnLight = 0
|
||||
|
||||
private var isShowTurnLight = false
|
||||
private var brakeLight = -1
|
||||
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
// 更新地图控件
|
||||
// 跟新地图控件
|
||||
mMogoMapView?.setExtraGPSData(gnssInfo)
|
||||
|
||||
if (gnssInfo != null) {
|
||||
//设置刹车信息,小于默认认为是刹车
|
||||
brakeLight = if (gnssInfo.acceleration < SharedPrefsMgr.getInstance(Utils.getApp()).getFloat(MoGoConfig.BRAKE_ACCELERATION_THRESHOLD, -2.5f)) {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
}
|
||||
d(SceneConstant.M_DEVA + "BrakeLight", "---onAutopilotLightSwitchData ---Acceleration = " + gnssInfo.acceleration + "-- brakeLight = " + brakeLight)
|
||||
if (!isShowTurnLight) { //在不展示转向灯的情况下,展示车辆刹车的动效
|
||||
showBrakeLight(brakeLight)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun onAutopilotLightSwitchData(lightSwitch: Chassis.LightSwitch?) {
|
||||
//can数据转发 转向灯状态 0是正常 1是左转 2是右转
|
||||
if (lightSwitch != null) {
|
||||
val state: Int = setTurnLightState(lightSwitch.number) //对转向灯进行转换
|
||||
d(SceneConstant.M_DEVA + "TurnLight", "---onAutopilotLightSwitchData ---state = " + state + "---lightSwitch.getNumber() = " + lightSwitch.number)
|
||||
if (state == 1 || state == 2) {
|
||||
isShowTurnLight = true
|
||||
showBrakeLight(0)
|
||||
} else {
|
||||
isShowTurnLight = false
|
||||
lightSwitch?.let {
|
||||
when (it.number) {
|
||||
1 -> { //左转灯
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(4, 500)
|
||||
}
|
||||
2 -> { //右转灯
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(2, 500)
|
||||
}
|
||||
else -> {
|
||||
CallerMapUIServiceManager.getMapUIController()?.setCarLightsType(3, 500)
|
||||
}
|
||||
}
|
||||
showTurnLight(state)
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTurnLightState(turn_light: Int): Int {
|
||||
if (turn_light == 0) {
|
||||
if (isOnTurnLight) {
|
||||
if (turnLightTimes >= 10) {
|
||||
isOnTurnLight = false
|
||||
turnLight = 0
|
||||
}
|
||||
turnLightTimes++
|
||||
}
|
||||
} else if (turn_light == 1) {
|
||||
turnLightTimes = 0
|
||||
isOnTurnLight = true
|
||||
turnLight = 1
|
||||
} else if (turn_light == 2) {
|
||||
turnLightTimes = 0
|
||||
isOnTurnLight = true
|
||||
turnLight = 2
|
||||
}
|
||||
return turnLight
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user