[Opt]直接从相关的Caller类中获取缓存的全局路径规划轨迹点

This commit is contained in:
chenfufeng
2023-02-02 16:53:14 +08:00
parent 0a4b0be72a
commit 8851a1ef00
4 changed files with 16 additions and 28 deletions

View File

@@ -11,7 +11,6 @@ import com.mogo.eagle.core.data.constants.MoGoFragmentPaths
import com.mogo.eagle.core.data.enums.DataSourceType
import com.mogo.eagle.core.data.map.CenterLine
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLamplightListener
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
@@ -19,22 +18,16 @@ import com.mogo.eagle.core.function.business.SpeedLimitDataManager
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.CallerPlanningRottingListenerManager
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.map.CallerHDMapManager
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
import com.mogo.eagle.core.function.datacenter.location.IMoGoLocationListener
import com.mogo.eagle.core.function.datacenter.location.MoGoLocationManager
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.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.eagle.core.utilcode.util.Utils
import com.mogo.map.IMogoMap
import com.mogo.map.MogoMapView
@@ -55,7 +48,6 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
IMoGoMapFragmentProvider,
IMoGoSkinModeChangeListener,
IMoGoLocationListener,
IMoGoPlanningRottingListener,
IMoGoChassisLamplightListener {
private var mMogoMapView: MogoMapView? = null
@@ -113,7 +105,6 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
}
// 添加换肤监听
CallerSkinModeListenerManager.addListener(Companion.functionName, this)
CallerPlanningRottingListenerManager.addListener(Companion.functionName, this)
MoGoLocationManager.addListener(Companion.functionName, this)
CallerChassisLamplightListenerManager.addListener(Companion.functionName, this)
}
@@ -200,15 +191,6 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
MogoRouteOverlayManager.getInstance().init()
MapPointCloudSubscriber.instance
SpeedLimitDataManager.getInstance().start()
// TODO GD地图业务需要与高精地图业务拆开 --- 扶风
queryInfStructure()
}
private fun queryInfStructure() {
val viewModel = this.obtainViewModel(OverViewModel::class.java)
viewModel.infStructuresMap.observe(this.viewLifecycleOwner) { t -> InfStructureManager.saveData(t) }
viewModel.fetchInfStructures()
}
override fun getUIController(): IMogoMapUIController {
@@ -217,7 +199,6 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
override fun onDestroyView() {
CallerSkinModeListenerManager.removeListener(Companion.functionName)
CallerPlanningRottingListenerManager.removeListener(Companion.functionName)
MoGoLocationManager.removeListener(Companion.functionName)
CallerChassisLamplightListenerManager.removeListener(Companion.functionName)
@@ -334,11 +315,6 @@ class MapFragment : MvpFragment<MapView?, MapPresenter?>(),
override val functionName: String
get() = functionName
// TODO 全览模式需要自己监听 --- 扶风
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
UiThreadHandler.post { savePlanningData(globalPathResp!!.wayPointsList) }
}
private var turnLightTimes = 0
private var isOnTurnLight = false
private var turnLight = 0

View File

@@ -269,12 +269,14 @@ class OverMapView @JvmOverloads constructor(
* 室内某个bag包自动驾驶启动8s后返回
*/
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
Log.d(TAG, "onAutopilotRotting")
handlePlanningData(globalPathResp!!.wayPointsList)
globalPathResp?.let {
handlePlanningData(it.wayPointsList)
}
}
}
fun handlePlanningData(locationList: List<MessagePad.Location>) {
fun handlePlanningData(locationList: List<MessagePad.Location>?) {
if (locationList.isNullOrEmpty()) return
val list: List<MessagePad.Location> = locationList
// 转成高德坐标系并存储
updateRoutePoints(list, mContext!!)

View File

@@ -224,11 +224,14 @@ public class AMapCustomView
@Override
public void onAutopilotRotting(@org.jetbrains.annotations.Nullable MessagePad.GlobalPathResp globalPathResp) {
Log.d(TAG, "onAutopilotRotting");
handlePlanningData(globalPathResp.getWayPointsList());
if (globalPathResp != null) {
handlePlanningData(globalPathResp.getWayPointsList());
}
}
};
public void handlePlanningData(List<MessagePad.Location> locationList) {
if (locationList == null || locationList.size() == 0) return;
List list = locationList;
// 转成高德坐标系并存储
MarkerDrawerManager.INSTANCE.updateRoutePoints(list, mContext);

View File

@@ -11,12 +11,19 @@ import mogo.telematics.pad.MessagePad
*/
object CallerPlanningRottingListenerManager : CallerBase<IMoGoPlanningRottingListener>() {
private var globalPathResp: MessagePad.GlobalPathResp? = null
override fun doSomeAfterAddListener(tag: String, listener: IMoGoPlanningRottingListener) {
listener.onAutopilotRotting(globalPathResp)
}
/**
* 路径规划 回调
* @param globalPathResp 自动驾驶网约车回调数据
*/
@Synchronized
fun invokeAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
this.globalPathResp = globalPathResp
M_LISTENERS.forEach {
val tag = it.key
val listener = it.value