[6.5.0][Opt]行程总览添加些日志

This commit is contained in:
chenfufeng
2024-07-17 20:09:33 +08:00
parent 6296f7d9e6
commit 2f66fa2f55

View File

@@ -27,7 +27,6 @@ import com.amap.api.maps.model.Marker
import com.amap.api.maps.model.MarkerOptions
import com.amap.api.maps.model.Polyline
import com.amap.api.maps.model.PolylineOptions
import com.google.gson.reflect.TypeToken
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
@@ -116,6 +115,8 @@ class TravelRealityView @JvmOverloads constructor(
@Volatile
private var isMapLoaded = false
@Volatile
private var isMapDestroyed = false
// =============自定义属性相关=============
private var mapStylePath: String? = null
@@ -242,24 +243,31 @@ class TravelRealityView @JvmOverloads constructor(
initView(context)
} catch (e: Exception) {
e.printStackTrace()
Log.d(TAG, "TravelRealityView初始化异常")
}
}
// =================必须通知高德地图生命周期的变化=================
fun onCreateView(savedInstanceState: Bundle?) {
mMapView?.onCreate(savedInstanceState)
Log.d(TAG, "高德地图onCreateView")
}
fun onResume() {
mMapView?.onResume()
isMapDestroyed = false
Log.d(TAG, "高德地图onResume")
}
fun onPause() {
mMapView?.onPause()
Log.d(TAG, "高德地图onPause")
}
fun onDestroy() {
mMapView?.onDestroy()
isMapDestroyed = true
Log.d(TAG, "高德地图页面已销毁!")
}
// =================必须通知高德地图生命周期的变化=================
@@ -349,6 +357,7 @@ class TravelRealityView @JvmOverloads constructor(
override fun onAttachedToWindow() {
super.onAttachedToWindow()
Log.d(TAG, "onAttachedToWindow")
initHandlers()
advanceRequest()
CallerPlanningRottingListenerManager.addListener(TAG, this)
@@ -358,6 +367,7 @@ class TravelRealityView @JvmOverloads constructor(
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
Log.d(TAG, "onDetachedFromWindow")
deviceList = null
retryCount = 0
// 注册定位监听
@@ -1097,8 +1107,10 @@ class TravelRealityView @JvmOverloads constructor(
} else {
lastTime = System.currentTimeMillis()
}
Log.d(TAG, "下发全局轨迹!")
globalPathResp?.let { globalPath ->
// nonFrequentHandler?.removeCallbacksAndMessages(null)
Log.d(TAG, "取消之前的网络请求!")
travelNetWorkModel.cancelAllRequest()
val pointList = ArrayList<Point>()
@@ -1148,6 +1160,7 @@ class TravelRealityView @JvmOverloads constructor(
when (msg.what) {
DRAW_CAR_LOCATION -> {
removeMessages(DRAW_CAR_LOCATION)
if (isMapDestroyed) return
(msg.obj as MogoLocation).apply {
realDrawCar(this)
}
@@ -1155,6 +1168,7 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_POLY_LINE -> {
removeMessages(DRAW_POLY_LINE)
if (isMapDestroyed) return
(msg.obj as PolylineOptions).apply {
realDrawGlobalPath(this)
}
@@ -1162,6 +1176,7 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_ROAD_EVENT -> {
removeMessages(DRAW_ROAD_EVENT)
if (isMapDestroyed) return
(msg.obj as ArrayList<MarkerOptions>).apply {
realDrawEventMarkers(this)
}
@@ -1169,6 +1184,7 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_CROSS_DEVICE -> {
removeMessages(DRAW_CROSS_DEVICE)
if (isMapDestroyed) return
(msg.obj as ArrayList<MarkerOptions>).apply {
realDrawCrossDeviceMarkers(this)
}
@@ -1176,6 +1192,7 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_ROAD_RANGE -> {
removeMessages(DRAW_ROAD_RANGE)
if (isMapDestroyed) return
(msg.obj as PolylineOptions).apply {
realDrawRoadRange(this)
}
@@ -1183,6 +1200,7 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_ROAD_TRAJECTORY -> {
removeMessages(DRAW_ROAD_TRAJECTORY)
if (isMapDestroyed) return
(msg.obj as ArrayList<PolylineOptions>).apply {
realDrawRoadTrajectory(this)
}
@@ -1190,17 +1208,20 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_GLOBAL_TRAJECTORY -> {
removeMessages(DRAW_GLOBAL_TRAJECTORY)
if (isMapDestroyed) return
(msg.obj as ArrayList<PolylineOptions>).apply {
realDrawGlobalTrajectory(this)
}
}
MOVE_MAP_CAMERA -> {
if (isMapDestroyed) return
mAMap?.moveCamera(msg.obj as CameraUpdate)
}
DRAW_LIVE_DETAIL -> {
removeMessages(DRAW_LIVE_DETAIL)
if (isMapDestroyed) return
(msg.obj as ArrayList<MarkerOptions>).apply {
realDrawLiveMarkers(this)
}
@@ -1208,10 +1229,12 @@ class TravelRealityView @JvmOverloads constructor(
DRAW_END_MARKER -> {
removeMessages(DRAW_END_MARKER)
if (isMapDestroyed) return
realDrawEndMarker(msg.obj as MarkerOptions)
}
UPDATE_VIDEO_MARKER -> {
if (isMapDestroyed) return
realUpdateVideoMarker(msg.obj as MarkerOptions)
}
}
@@ -1252,6 +1275,7 @@ class TravelRealityView @JvmOverloads constructor(
}
private fun realDrawGlobalPath(polylineOptions: PolylineOptions) {
Log.d(TAG, "realDrawGlobalPath")
if (globalPolyline == null) {
globalPolyline = mAMap?.addPolyline(polylineOptions)
} else {
@@ -1260,6 +1284,7 @@ class TravelRealityView @JvmOverloads constructor(
}
private fun realDrawEventMarkers(eventOptionList: ArrayList<MarkerOptions>) {
Log.d(TAG, "realDrawEventMarkers")
eventMarkerList.forEach {
it.destroy()
}
@@ -1274,6 +1299,7 @@ class TravelRealityView @JvmOverloads constructor(
}
private fun realDrawCrossDeviceMarkers(eventMarkerList: ArrayList<MarkerOptions>) {
Log.d(TAG, "realDrawCrossDeviceMarkers")
deviceMarkerList.forEach {
it.destroy()
}
@@ -1287,6 +1313,7 @@ class TravelRealityView @JvmOverloads constructor(
}
private fun realDrawGlobalTrajectory(polylineOptionsList: ArrayList<PolylineOptions>) {
Log.d(TAG, "realDrawGlobalTrajectory")
if (globalPolylineList.isNotEmpty() && globalPolylineList.size != polylineOptionsList.size) {
globalPolylineList.forEach {
it.remove()
@@ -1313,6 +1340,7 @@ class TravelRealityView @JvmOverloads constructor(
}
private fun realDrawRoadTrajectory(polylineOptionsList: ArrayList<PolylineOptions>) {
Log.d(TAG, "realDrawRoadTrajectory")
if (trajectoryPolylineList.isNotEmpty() && trajectoryPolylineList.size != polylineOptionsList.size) {
trajectoryPolylineList.forEach {
it.remove()
@@ -1359,6 +1387,7 @@ class TravelRealityView @JvmOverloads constructor(
}
private fun realDrawEndMarker(options: MarkerOptions) {
Log.d(TAG, "realDrawEndMarker")
mEndMarker?.destroy()
if (endPointDrawable != -1) {
mEndMarker = mAMap?.addMarker(