diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/travelreality/TravelRealityModel.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/travelreality/TravelRealityModel.kt index 3144c5c464..caf5622334 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/travelreality/TravelRealityModel.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/travelreality/TravelRealityModel.kt @@ -236,8 +236,9 @@ class TravelRealityModel private constructor() { fun downloadImage( context: Context, url: String?, latLng: LatLng, - onSuccess: ((Bitmap, LatLng) -> Unit), - onFailed: ((LatLng) -> Unit) + lineId: Long, + onSuccess: ((Bitmap, LatLng, Long) -> Unit), + onFailed: ((LatLng, Long) -> Unit) ) { if (url.isNullOrEmpty()) return val radiusPx = AutoSizeUtils.dp2px(context, 24f).toFloat() @@ -249,14 +250,14 @@ class TravelRealityModel private constructor() { .load(url) .into(object : CustomTarget() { override fun onResourceReady(resource: Bitmap, transition: Transition?) { - onSuccess(resource, latLng) + onSuccess(resource, latLng, lineId) } override fun onLoadCleared(placeholder: Drawable?) {} override fun onLoadFailed(errorDrawable: Drawable?) { super.onLoadFailed(errorDrawable) - onFailed(latLng) + onFailed(latLng, lineId) } }) } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt index 33f90264fe..248ea0162e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/view/TravelRealityView.kt @@ -40,6 +40,7 @@ import com.mogo.eagle.core.function.business.travelreality.Point import com.mogo.eagle.core.function.business.travelreality.TravelRealityModel.Companion.travelNetWorkModel import com.mogo.eagle.core.function.business.travelreality.view.EventVideoView import com.mogo.eagle.core.function.business.travelreality.view.VideoMarkerEntity +import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager @@ -725,15 +726,29 @@ class TravelRealityView @JvmOverloads constructor( */ private fun downloadImage(url: String, latLng: LatLng?, title: String?, orientation: Int = 0) { if (latLng == null || url.isEmpty()) return - travelNetWorkModel.downloadImage(context, url, latLng, onSuccess = { bitmap, latLng -> - val view = EventVideoView(context, title = title, orientation = orientation) - view.setBitmap(bitmap) - updateVideoMarker(view, latLng) - }, onFailed = { - val view = EventVideoView(context, title = title, orientation = orientation) - view.setPlaceHolder() - updateVideoMarker(view, latLng) - }) + travelNetWorkModel.downloadImage( + context, + url, + latLng, + CallerAutoPilotStatusListenerManager.getLineId(), + onSuccess = { bitmap, latLng, lineId -> + if (lineId == CallerAutoPilotStatusListenerManager.getLineId()) { + val view = EventVideoView(context, title = title, orientation = orientation) + view.setBitmap(bitmap) + updateVideoMarker(view, latLng) + } else { + Log.w(TAG, "downloadImage:onSuccess:lineId不同!") + } + }, + onFailed = { latLng, lineId -> + if (lineId == CallerAutoPilotStatusListenerManager.getLineId()) { + val view = EventVideoView(context, title = title, orientation = orientation) + view.setPlaceHolder() + updateVideoMarker(view, latLng) + } else { + Log.w(TAG, "downloadImage:onFailed:lineId不同!") + } + }) } private fun reqCrossLive( @@ -1080,10 +1095,14 @@ class TravelRealityView @JvmOverloads constructor( } private fun drawEndMarker(options: MarkerOptions) { - Message.obtain().apply { - what = DRAW_END_MARKER - obj = options - nonFrequentHandler?.sendMessage(this) + if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) { + Message.obtain().apply { + what = DRAW_END_MARKER + obj = options + nonFrequentHandler?.sendMessage(this) + } + } else { + Log.d(TAG, "drawEndMarker:lineId为0") } } @@ -1093,35 +1112,52 @@ class TravelRealityView @JvmOverloads constructor( options.position(latLng) options.icon(BitmapDescriptorFactory.fromView(view)) Log.d(TAG, "更新时位置为:${latLng},标题为:${view.title}") - Message.obtain().apply { - what = UPDATE_VIDEO_MARKER - obj = options - nonFrequentHandler?.sendMessage(this) + if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) { + Message.obtain().apply { + what = UPDATE_VIDEO_MARKER + obj = options + nonFrequentHandler?.sendMessage(this) + } + } else { + Log.d(TAG, "updateVideoMarker:lineId为0") } } private fun drawMarkers(type: Int, optionList: ArrayList) { - Message.obtain().apply { - what = type - obj = optionList - nonFrequentHandler?.sendMessage(this) + if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) { + Message.obtain().apply { + what = type + obj = optionList + nonFrequentHandler?.sendMessage(this) + } + } else { + Log.d(TAG, "drawMarkers:lineId为0") } } private fun drawPolyline(type: Int, polylineOptions: PolylineOptions) { - Message.obtain().apply { - what = type - obj = polylineOptions - nonFrequentHandler?.sendMessage(this) + if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) { + Message.obtain().apply { + what = type + obj = polylineOptions + nonFrequentHandler?.sendMessage(this) + } + } else { + Log.d(TAG, "drawMarkers:lineId为0") } } private fun drawPolylineList(type: Int, polylineOptionsList: ArrayList) { if (polylineOptionsList.isEmpty()) return - Message.obtain().apply { - what = type - obj = polylineOptionsList - nonFrequentHandler?.sendMessage(this) + // 智慧道路范围绘制不依赖订单 + if (DRAW_ROAD_TRAJECTORY == type || CallerAutoPilotStatusListenerManager.getLineId() != 0L) { + Message.obtain().apply { + what = type + obj = polylineOptionsList + nonFrequentHandler?.sendMessage(this) + } + } else { + Log.d(TAG, "drawPolylineList:lineId为0") } }