Merge branch 'dev_minibus-d_230425_3.2.0' into code_opt_3.3.0
This commit is contained in:
@@ -5,8 +5,9 @@ import android.os.Message
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.deva.chain.ChainConstant
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
|
||||
import com.mogo.eagle.core.function.api.datacenter.obu.IMoGoObuStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuWarningListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isTaxi
|
||||
import com.mogo.eagle.core.utilcode.mogo.thread.WorkThreadHandler
|
||||
@@ -16,7 +17,7 @@ import mogo.telematics.pad.MessagePad
|
||||
import mogo.telematics.pad.MessagePad.TrackedObject
|
||||
import mogo.yycp.api.proto.SocketDownData
|
||||
|
||||
object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
object IdentifyFactory : Identify, IMoGoObuStatusListener, IMoGoAutopilotCarConfigListener {
|
||||
|
||||
private const val TAG = "IdentifyFactory"
|
||||
|
||||
@@ -35,8 +36,16 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
private var identify: Identify? = null
|
||||
private var aiCloudIdentify: Identify? = null
|
||||
|
||||
init {
|
||||
val dockerVersion = getAutoPilotStatusInfo().dockVersion
|
||||
fun initType(){
|
||||
drawType("默认开启感知优化,等待docker版本")
|
||||
identify = UserIdentify.beautifyDataDrawer
|
||||
aiCloudIdentify = AiIdentify.aiCloudDataDrawer
|
||||
CallerAutopilotCarConfigListenerManager.addListener(TAG, this)
|
||||
CallerObuWarningListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onAutopilotCarConfig(carConfigResp: MessagePad.CarConfigResp) {
|
||||
val dockerVersion = carConfigResp.dockVersion
|
||||
if (dockerVersion != null && dockerVersion.isNotEmpty()) {
|
||||
try {
|
||||
val version = ParseVersionUtils.parseVersion(true, dockerVersion)
|
||||
@@ -54,8 +63,6 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
identify = UserIdentify.beautifyDataDrawer
|
||||
}
|
||||
}
|
||||
aiCloudIdentify = AiIdentify.aiCloudDataDrawer
|
||||
CallerObuWarningListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
@@ -180,4 +187,5 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener {
|
||||
message.obj = trafficData
|
||||
mDrawerHandler.sendMessage(message)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -34,6 +34,7 @@ class MapIdentifySubscriber private constructor() : IMoGoSubscriber,
|
||||
}
|
||||
|
||||
override fun onCrate() {
|
||||
IdentifyFactory.initType()
|
||||
CallerAutopilotIdentifyListenerManager.addListener(TAG, this)
|
||||
CallerObuWarningListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.smp
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.amap.api.maps.CoordinateConverter
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
@@ -60,19 +61,28 @@ object MarkerDrawerManager {
|
||||
private fun getLoopCalCarObservable(): Observable<Int> {
|
||||
return Observable.create(ObservableOnSubscribe { emitter ->
|
||||
if (emitter.isDisposed) return@ObservableOnSubscribe
|
||||
loopRouteAndWipe(planningPoints, lonLatHeading.first, lonLatHeading.second, lonLatHeading.third)
|
||||
loopRouteAndWipe(
|
||||
planningPoints,
|
||||
lonLatHeading.first,
|
||||
lonLatHeading.second,
|
||||
lonLatHeading.third
|
||||
)
|
||||
emitter.onComplete()
|
||||
})
|
||||
}
|
||||
|
||||
private fun loopRouteAndWipe(routePoints: List<LatLng>?, lon: Double, lat: Double, heading: Double) {
|
||||
private fun loopRouteAndWipe(
|
||||
routePoints: List<LatLng>?,
|
||||
lon: Double,
|
||||
lat: Double,
|
||||
heading: Double
|
||||
) {
|
||||
if (routePoints != null && routePoints.isNotEmpty()) {
|
||||
val newPointList = ArrayList<LatLng>()
|
||||
val arrivedIndex: Int = getArrivedPointIndex(routePoints, newPointList, lon, lat, heading)
|
||||
if (arrivedIndex != -1 && lastArrivedIndex != arrivedIndex) {
|
||||
callback?.onLocationChanged(newPointList, arrivedIndex)
|
||||
lastArrivedIndex = arrivedIndex
|
||||
}
|
||||
val locationIndex: Int =
|
||||
getCarLocationIndex(routePoints, newPointList, lon, lat, heading)
|
||||
Log.d("MarkerDrawerManager", "自车在轨迹集合中的索引为:$locationIndex")
|
||||
callback?.onLocationChanged(newPointList, locationIndex)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +100,7 @@ object MarkerDrawerManager {
|
||||
* @param realLat
|
||||
* @return 返回已经到达点的index
|
||||
*/
|
||||
private fun getArrivedPointIndex(
|
||||
private fun getCarLocationIndex(
|
||||
routePoints: List<LatLng>,
|
||||
newPoints: MutableList<LatLng>,
|
||||
realLon: Double,
|
||||
@@ -112,12 +122,21 @@ object MarkerDrawerManager {
|
||||
if (baseDiffDis > diff) {
|
||||
baseDiffDis = diff
|
||||
// 距离最近的时候判断是否走过
|
||||
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(realLon, realLat, latLng.longitude, latLng.latitude, heading) >= 90) {
|
||||
if (DrivingDirectionUtils.getDegreeOfCar2Poi2(
|
||||
realLon,
|
||||
realLat,
|
||||
latLng.longitude,
|
||||
latLng.latitude,
|
||||
heading
|
||||
) >= 90
|
||||
) {
|
||||
currentIndex = if (i < lastArrivedIndex) {
|
||||
lastArrivedIndex
|
||||
} else {
|
||||
lastArrivedIndex = i
|
||||
i
|
||||
}
|
||||
Log.d("MarkerDrawerManager", "已走过的点的索引为:$currentIndex")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ import com.mogo.eagle.core.function.smp.MarkerDrawerManager.planningPoints
|
||||
import com.mogo.eagle.core.function.smp.MarkerDrawerManager.startLoopCalCarLocation
|
||||
import com.mogo.eagle.core.function.smp.MarkerDrawerManager.updateRoutePoints
|
||||
import com.mogo.eagle.core.function.smp.V2XMarkerView
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.MapAssetStyleUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
@@ -124,6 +123,9 @@ class OverMapView @JvmOverloads constructor(
|
||||
var siteMarkerList: ArrayList<Marker>? = null
|
||||
var siteNameList: ArrayList<Marker>? = null
|
||||
|
||||
@Volatile
|
||||
private var isInit = false
|
||||
|
||||
companion object {
|
||||
const val TAG = "OverMapView"
|
||||
}
|
||||
@@ -329,6 +331,7 @@ class OverMapView @JvmOverloads constructor(
|
||||
MarkerDrawerManager.stopLoopCalCarLocation()
|
||||
planningPoints.clear()
|
||||
lastArrivedIndex = -1
|
||||
isInit = false
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@@ -460,34 +463,42 @@ class OverMapView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
fun handlePlanningData(locationList: List<MessagePad.Location>?) {
|
||||
if (locationList.isNullOrEmpty()) return
|
||||
val list: List<MessagePad.Location> = locationList
|
||||
// 转成高德坐标系并存储
|
||||
updateRoutePoints(list, mContext!!)
|
||||
val planningPointList: List<LatLng> = planningPoints
|
||||
UiThreadHandler.post {
|
||||
displayCustomOverView()
|
||||
drawStartAndEndMarker(planningPointList)
|
||||
if (locationList.isNullOrEmpty()) {
|
||||
Log.d(TAG, "全局路径规划轨迹为空")
|
||||
return
|
||||
}
|
||||
callback = object : MarkerDrawerManager.Callback {
|
||||
override fun onLocationChanged(planningPoints: List<LatLng>, locIndex: Int) {
|
||||
// 每1s刷新一下轨迹线
|
||||
UiThreadHandler.post {
|
||||
if (planningPoints.isNotEmpty()) {
|
||||
drawPolyline(planningPoints, locIndex)
|
||||
}
|
||||
val list: List<MessagePad.Location> = locationList
|
||||
ThreadUtils.getSinglePool().submit {
|
||||
lastArrivedIndex = -1
|
||||
// 转成高德坐标系并存储
|
||||
updateRoutePoints(list, mContext!!)
|
||||
val planningPointList: List<LatLng> = planningPoints
|
||||
UiThreadHandler.post {
|
||||
displayCustomOverView()
|
||||
drawStartAndEndMarker(planningPointList)
|
||||
|
||||
if (geoHashInfMap.isNullOrEmpty()) {
|
||||
UiThreadHandler.postDelayed({
|
||||
drawInfrastructureMarkers(locationList)
|
||||
}, 1000)
|
||||
} else {
|
||||
drawInfrastructureMarkers(locationList)
|
||||
}
|
||||
}
|
||||
}
|
||||
startLoopCalCarLocation()
|
||||
UiThreadHandler.post {
|
||||
if (geoHashInfMap.isNullOrEmpty()) {
|
||||
UiThreadHandler.postDelayed({
|
||||
drawInfrastructureMarkers(locationList)
|
||||
}, 1000)
|
||||
} else {
|
||||
drawInfrastructureMarkers(locationList)
|
||||
if (!isInit) {
|
||||
callback = object : MarkerDrawerManager.Callback {
|
||||
override fun onLocationChanged(planningPoints: List<LatLng>, locIndex: Int) {
|
||||
// 每1s刷新一下轨迹线
|
||||
UiThreadHandler.post {
|
||||
if (planningPoints.isNotEmpty()) {
|
||||
drawPolyline(planningPoints, locIndex)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
startLoopCalCarLocation()
|
||||
isInit = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user