[6.5.0][Fix]解决智慧道路轨迹绘制不全的问题
This commit is contained in:
@@ -416,7 +416,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
Log.d(TAG, "Road track result is:$it")
|
||||
roadTrackList = it
|
||||
isRoadTrackReq = false
|
||||
handleRoadTrajectories(it)
|
||||
handleRoadTrajectories(it, reqData)
|
||||
}, onError = {
|
||||
isRoadTrackReq = false
|
||||
Log.d(TAG, "Road track error is:$it")
|
||||
@@ -496,8 +496,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
drawPolyline(DRAW_POLY_LINE, globalOptions)
|
||||
}
|
||||
|
||||
private fun handleRoadEvent(eventList: List<EventBean>) {
|
||||
val globalList = reqData
|
||||
private fun handleRoadEvent(eventList: List<EventBean>, globalList: ArrayList<Point>) {
|
||||
if (globalList.isNullOrEmpty()) return
|
||||
testTime = System.currentTimeMillis()
|
||||
if (eventList.isEmpty()) {
|
||||
@@ -832,10 +831,9 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
})
|
||||
}
|
||||
|
||||
private fun handleCrossDevices(crossDeviceList: List<CrossDeviceBean>) {
|
||||
private fun handleCrossDevices(crossDeviceList: List<CrossDeviceBean>, globalList: ArrayList<Point>?) {
|
||||
if (crossDeviceList.isEmpty()) return
|
||||
val crossOptionsList = ArrayList<MarkerOptions>()
|
||||
val globalList = reqData
|
||||
var distance = 0.0
|
||||
var key = ""
|
||||
val deviceInPaths = ArrayList<DeviceInfoBean>()
|
||||
@@ -918,14 +916,17 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
/**
|
||||
* 处理智慧道路轨迹的数据
|
||||
*/
|
||||
private fun handleRoadTrajectories(roadTrajectoryList: List<List<List<Double>?>?>?) {
|
||||
private fun handleRoadTrajectories(
|
||||
roadTrajectoryList: List<List<List<Double>?>?>?,
|
||||
globalList: List<Point>?
|
||||
) {
|
||||
if (roadTrajectoryList.isNullOrEmpty()) return
|
||||
val globalList = reqData
|
||||
// 绘制智慧道路范围
|
||||
val roadTrajectoryOptionsList = ArrayList<PolylineOptions>()
|
||||
val globalOptionList = ArrayList<PolylineOptions>()
|
||||
val globalIndexSet = HashSet<Int>()
|
||||
if (globalList.isNullOrEmpty()) {// 无轨迹时以道路中心线为中轴画给定宽度的纹理
|
||||
Log.d(TAG, "无轨迹点,绘制全局智慧道路!")
|
||||
val boundsBuilder = LatLngBounds.Builder()
|
||||
var latLngTmp: LatLng
|
||||
roadTrajectoryList.forEach { trajectoryList ->
|
||||
@@ -959,6 +960,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
)
|
||||
moveMapCamera(cameraUpdate)
|
||||
} else {
|
||||
Log.d(TAG, "有轨迹点,绘制局部智慧道路!")
|
||||
roadTrajectoryList.forEach { trajectoryList ->
|
||||
var distanceTmp: Double
|
||||
// var lastIndex = -1
|
||||
@@ -1095,14 +1097,10 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private fun drawEndMarker(options: MarkerOptions) {
|
||||
if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) {
|
||||
Message.obtain().apply {
|
||||
what = DRAW_END_MARKER
|
||||
obj = options
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "drawEndMarker:lineId为0")
|
||||
Message.obtain().apply {
|
||||
what = DRAW_END_MARKER
|
||||
obj = options
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1112,52 +1110,35 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
options.position(latLng)
|
||||
options.icon(BitmapDescriptorFactory.fromView(view))
|
||||
Log.d(TAG, "更新时位置为:${latLng},标题为:${view.title}")
|
||||
if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) {
|
||||
Message.obtain().apply {
|
||||
what = UPDATE_VIDEO_MARKER
|
||||
obj = options
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "updateVideoMarker:lineId为0")
|
||||
Message.obtain().apply {
|
||||
what = UPDATE_VIDEO_MARKER
|
||||
obj = options
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawMarkers(type: Int, optionList: ArrayList<MarkerOptions>) {
|
||||
if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) {
|
||||
Message.obtain().apply {
|
||||
what = type
|
||||
obj = optionList
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "drawMarkers:lineId为0")
|
||||
Message.obtain().apply {
|
||||
what = type
|
||||
obj = optionList
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawPolyline(type: Int, polylineOptions: PolylineOptions) {
|
||||
if (CallerAutoPilotStatusListenerManager.getLineId() != 0L) {
|
||||
Message.obtain().apply {
|
||||
what = type
|
||||
obj = polylineOptions
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
} else {
|
||||
Log.d(TAG, "drawMarkers:lineId为0")
|
||||
Message.obtain().apply {
|
||||
what = type
|
||||
obj = polylineOptions
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
}
|
||||
|
||||
private fun drawPolylineList(type: Int, polylineOptionsList: ArrayList<PolylineOptions>) {
|
||||
if (polylineOptionsList.isEmpty()) return
|
||||
// 智慧道路范围绘制不依赖订单
|
||||
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")
|
||||
Message.obtain().apply {
|
||||
what = type
|
||||
obj = polylineOptionsList
|
||||
nonFrequentHandler?.sendMessage(this)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1201,17 +1182,19 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
// nonFrequentHandler?.removeCallbacksAndMessages(null)
|
||||
|
||||
val pointList = ArrayList<Point>()
|
||||
val pointCloneList = ArrayList<Point>()
|
||||
globalPath.wayPointsList.forEach { loc ->
|
||||
pointList.add(Point(loc.longitude, loc.latitude))
|
||||
pointCloneList.add(Point(loc.longitude, loc.latitude))
|
||||
}
|
||||
Log.d(TAG, "轨迹点个数为:${pointList.size}")
|
||||
reqData = pointList
|
||||
reqData = pointCloneList
|
||||
handleGlobalPath(pointList)
|
||||
|
||||
requestData(pointList)
|
||||
if (!isRoadTrackReq) {
|
||||
Log.d(TAG, "请求智慧道路轨迹!")
|
||||
handleRoadTrajectories(roadTrackList)
|
||||
Log.d(TAG, "处理智慧道路轨迹!")
|
||||
handleRoadTrajectories(roadTrackList, pointList)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1225,7 +1208,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
Log.d(TAG, "Cross device result is:$it")
|
||||
isCrossDeviceReq = false
|
||||
deviceList = it
|
||||
handleCrossDevices(it)
|
||||
handleCrossDevices(it, pointList)
|
||||
}, onError = {
|
||||
isCrossDeviceReq = false
|
||||
Log.d(TAG, "Cross device error is:$it")
|
||||
@@ -1245,7 +1228,7 @@ class TravelRealityView @JvmOverloads constructor(
|
||||
isRoadEventReq = false
|
||||
retryCount = 0
|
||||
Log.d(TAG, "Events result is:$it")
|
||||
handleRoadEvent(it)
|
||||
handleRoadEvent(it, pointList)
|
||||
},
|
||||
onError = {
|
||||
isRoadEventReq = false
|
||||
|
||||
Reference in New Issue
Block a user