[6.5.0][Opt]没有订单时高德地图不绘制新元素

This commit is contained in:
chenfufeng
2024-07-23 20:13:28 +08:00
parent bd6f1b1976
commit 9b68203e3a
2 changed files with 70 additions and 33 deletions

View File

@@ -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<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
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)
}
})
}

View File

@@ -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<MarkerOptions>) {
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<PolylineOptions>) {
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")
}
}