From 8851a1ef0064014c050fac5bdbfa0fe0bde10be1 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Thu, 2 Feb 2023 16:53:14 +0800 Subject: [PATCH] =?UTF-8?q?[Opt]=E7=9B=B4=E6=8E=A5=E4=BB=8E=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E7=9A=84Caller=E7=B1=BB=E4=B8=AD=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E7=9A=84=E5=85=A8=E5=B1=80=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E8=A7=84=E5=88=92=E8=BD=A8=E8=BF=B9=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../eagle/core/function/map/MapFragment.kt | 24 ------------------- .../function/overview/view/OverMapView.kt | 8 ++++--- .../core/function/smp/AMapCustomView.java | 5 +++- .../CallerPlanningRottingListenerManager.kt | 7 ++++++ 4 files changed, 16 insertions(+), 28 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt index 403a8d640c..7a0be511e0 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/map/MapFragment.kt @@ -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(), IMoGoMapFragmentProvider, IMoGoSkinModeChangeListener, IMoGoLocationListener, - IMoGoPlanningRottingListener, IMoGoChassisLamplightListener { private var mMogoMapView: MogoMapView? = null @@ -113,7 +105,6 @@ class MapFragment : MvpFragment(), } // 添加换肤监听 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(), 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(), 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(), 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 diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt index ddc6423415..4e4783b492 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/overview/view/OverMapView.kt @@ -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) { + fun handlePlanningData(locationList: List?) { + if (locationList.isNullOrEmpty()) return val list: List = locationList // 转成高德坐标系并存储 updateRoutePoints(list, mContext!!) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java index c8f97d3f25..d1147ce765 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/AMapCustomView.java @@ -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 locationList) { + if (locationList == null || locationList.size() == 0) return; List list = locationList; // 转成高德坐标系并存储 MarkerDrawerManager.INSTANCE.updateRoutePoints(list, mContext); diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerPlanningRottingListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerPlanningRottingListenerManager.kt index b3c1d7d43f..157e6c5825 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerPlanningRottingListenerManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerPlanningRottingListenerManager.kt @@ -11,12 +11,19 @@ import mogo.telematics.pad.MessagePad */ object CallerPlanningRottingListenerManager : CallerBase() { + 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