[6.5.0][Fix]解决高德地图显示Marker原始样式的问题

This commit is contained in:
chenfufeng
2024-07-25 14:56:20 +08:00
parent a332f0f37a
commit 326076a408

View File

@@ -809,42 +809,7 @@ class TravelRealityView @JvmOverloads constructor(
it.forEach { roadCamera ->
roadCamera.ip?.let { ip ->
if (roadCamera.imageUrl.isNullOrEmpty()) {
var view: EventVideoView
if (ipPointEntityMap[ip] != null) {
// 一个ip可能对应多个卡片缩略图
ipPointEntityMap[ip]!!.forEach { videoMarkerEntity ->
// 计算卡片四个顶点的高德地图经纬度
vertexList.addAll(
getRectVertex(
videoMarkerEntity.orientation,
videoMarkerEntity.latLng
)
)
markerOption = MarkerOptions()
markerOption.zIndex(0.9f)
markerOption.position(videoMarkerEntity.latLng)
view = EventVideoView(
context,
title = videoMarkerEntity.title,
orientation = videoMarkerEntity.orientation
)
pair =
travelNetWorkModel.calculateAnchor(videoMarkerEntity.orientation)
Log.d(
TAG,
"绘制时位置为:${videoMarkerEntity.latLng},标题为:${videoMarkerEntity.title},方向为:${videoMarkerEntity.orientation},锚点为:${pair}"
)
markerOption.anchor(pair.first, pair.second)
view.setPlaceHolder()
markerOption.icon(BitmapDescriptorFactory.fromView(view))
liveOptionsList.add(markerOption)
}
} else {
Log.d(TAG, "缓存中未查到对应ip!")
return@let
}
} else {
if (!roadCamera.imageUrl.isNullOrEmpty()) {
if (ipPointEntityMap[ip] != null) {
ipPointEntityMap[ip]!!.forEach { videoMarkerEntity ->
// 计算卡片四个顶点的高德地图经纬度
@@ -857,7 +822,6 @@ class TravelRealityView @JvmOverloads constructor(
// 需要下载缩略图
markerOption = MarkerOptions()
markerOption.zIndex(0.9f)
markerOption.icon(null)
markerOption.position(videoMarkerEntity.latLng)
pair = travelNetWorkModel.calculateAnchor(
videoMarkerEntity.orientation
@@ -1601,7 +1565,11 @@ class TravelRealityView @JvmOverloads constructor(
}
liveMarkerList.clear()
mAMap?.let {
liveMarkerList.addAll(it.addMarkers(liveOptionList, false))
liveOptionList.forEach { options ->
liveMarkerList.add(it.addMarker(options).also { marker ->
marker.isVisible = false
})
}
}
}
@@ -1619,6 +1587,7 @@ class TravelRealityView @JvmOverloads constructor(
options.forEach {
if (it.position == liveMarker.position) {
liveMarker.setIcon(it.icon)
liveMarker.isVisible = true
}
}
}