[6.5.0][Fix]解决道路事件不显示的问题
This commit is contained in:
@@ -198,6 +198,12 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
private val ipPointMap by lazy {
|
||||
HashMap<String, VideoMarkerEntity>()
|
||||
}
|
||||
private val eventPointMap by lazy {
|
||||
HashMap<String, Int>()
|
||||
}
|
||||
private val devicePointMap by lazy {
|
||||
HashMap<String, Int>()
|
||||
}
|
||||
|
||||
private var testTime = 0L
|
||||
|
||||
@@ -459,34 +465,40 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
testTime = System.currentTimeMillis()
|
||||
val eventDrawMap = HashMap<String, EventDrawBean>()
|
||||
val eventOptionsList = ArrayList<MarkerOptions>()
|
||||
var distance = 0.0
|
||||
var key = ""
|
||||
globalList.forEachIndexed { index, globalPoint ->
|
||||
if (index >= 0 && index < globalList.size - 1) {
|
||||
eventList.forEach { eventBean ->
|
||||
if (LocationUtils.pointToLine(
|
||||
globalPoint.lon,
|
||||
globalPoint.lat,
|
||||
globalList[index + 1].lon,
|
||||
globalList[index + 1].lat,
|
||||
eventBean.lon,
|
||||
eventBean.lat
|
||||
) > 5
|
||||
) {
|
||||
distance = LocationUtils.pointToLine(
|
||||
globalPoint.lon,
|
||||
globalPoint.lat,
|
||||
globalList[index + 1].lon,
|
||||
globalList[index + 1].lat,
|
||||
eventBean.lon,
|
||||
eventBean.lat
|
||||
)
|
||||
key = "${eventBean.lon},${eventBean.lat}"
|
||||
if (distance >= 10 || eventPointMap.contains(key)) {
|
||||
Log.d(TAG, "道路事件:点(${key})到线段${index}-${index+1}的距离为:${distance}米")
|
||||
return@forEach
|
||||
}
|
||||
eventPointMap[key] = 1
|
||||
eventBean.orientation = travelNetWorkModel.calculateOrientation(
|
||||
eventBean.lon, eventBean.lat, globalPoint.lon,
|
||||
globalPoint.lat, globalList[index + 1].lon, globalList[index + 1].lat,
|
||||
)
|
||||
filterEventWithType(eventBean, eventOptionsList, eventDrawMap)
|
||||
listener?.onDraw(eventDrawMap.values.toList(), true)
|
||||
}
|
||||
}
|
||||
}
|
||||
listener?.onDraw(eventDrawMap.values.toList(), true)
|
||||
Log.d(TAG, "过滤掉的事件个数为:${eventList.size - eventOptionsList.size}")
|
||||
// 事件不足3个则用路口设备补齐
|
||||
completeQuantity()
|
||||
// 绘制道路事件
|
||||
drawMarkers(DRAW_ROAD_EVENT, eventOptionsList)
|
||||
eventPointMap.clear()
|
||||
}
|
||||
|
||||
private fun completeQuantity() {
|
||||
@@ -724,22 +736,27 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
if (crossDeviceList.isEmpty()) return
|
||||
val crossOptionsList = ArrayList<MarkerOptions>()
|
||||
val globalList = reqData
|
||||
var distance = 0.0
|
||||
var key = ""
|
||||
val deviceInPaths = ArrayList<DeviceInfoBean>()
|
||||
globalList?.forEachIndexed { index, globalPoint ->
|
||||
if (index >= 0 && index < globalList.size - 1) {
|
||||
crossDeviceList.forEach {
|
||||
it.deviceInfoList?.forEach loop@{ deviceBean ->
|
||||
if (LocationUtils.pointToLine(
|
||||
globalPoint.lon,
|
||||
globalPoint.lat,
|
||||
globalList[index + 1].lon,
|
||||
globalList[index + 1].lat,
|
||||
deviceBean.lon,
|
||||
deviceBean.lat
|
||||
) > 5
|
||||
) {
|
||||
distance = LocationUtils.pointToLine(
|
||||
globalPoint.lon,
|
||||
globalPoint.lat,
|
||||
globalList[index + 1].lon,
|
||||
globalList[index + 1].lat,
|
||||
deviceBean.lon,
|
||||
deviceBean.lat
|
||||
)
|
||||
key = "${deviceBean.lon},${deviceBean.lat}"
|
||||
if (distance >= 10 || devicePointMap.contains(key)) {
|
||||
Log.d(TAG, "路口设备:点(${key})到线段${index}-${index+1}的距离为:${distance}米")
|
||||
return@loop
|
||||
}
|
||||
devicePointMap[key] = 1
|
||||
// 计算事件Marker朝向
|
||||
deviceBean.orientation = travelNetWorkModel.calculateOrientation(
|
||||
deviceBean.lon,
|
||||
@@ -764,6 +781,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
devicePointMap.clear()
|
||||
if (deviceInPaths.isNotEmpty()) {
|
||||
listener?.onDraw(
|
||||
arrayListOf(EventDrawBean(R.drawable.mogo_quanxi_lukou, "全息路口")),
|
||||
|
||||
Reference in New Issue
Block a user