[6.1.0] fix bug of cross road , spilt the cross and cross change to identify false
This commit is contained in:
@@ -51,11 +51,14 @@ object CallerMapRoadListenerManager {
|
||||
}
|
||||
}
|
||||
|
||||
private var mCross: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
|
||||
private var mCross: Int by Delegates.observable(-1) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
CallerLogger.d("$M_MAP onRoadChange", newValue)
|
||||
listeners.forEach { entry ->
|
||||
entry.value.onRoadChange(newValue)
|
||||
when(newValue){
|
||||
1,2 -> entry.value.onRoadChange(false)
|
||||
else -> entry.value.onRoadChange(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +69,7 @@ object CallerMapRoadListenerManager {
|
||||
nodeAliasCode = ChainConstant.CHAIN_CODE_HD_MAP_ROAD_CROSS,
|
||||
paramIndexes = [0, 1]
|
||||
)
|
||||
fun invokeRoadChange(cross: Boolean, roadCross: RoadCross) {
|
||||
fun invokeRoadChange(cross: Int, roadCross: RoadCross) {
|
||||
mCross = cross
|
||||
|
||||
}
|
||||
|
||||
@@ -211,14 +211,20 @@ class AMapViewWrapper(mMapView: MapAutoView) : IMogoMapView, IMogoMapUIControlle
|
||||
oldValue?.let {
|
||||
//对驶入驶出路口做二次过滤,防止多次回调
|
||||
if (it.status == 0 && newValue!!.status == 1) {
|
||||
//进入路口
|
||||
//径直进入路口
|
||||
i("$M_MAP$TAG", "进入路口 :${newValue.cross_id}")
|
||||
invokeRoadChange(true, newValue)
|
||||
invokeRoadChange(0, newValue)
|
||||
}
|
||||
if ((it.status == 1 && newValue!!.status == 0) || (newValue!!.cross_id_end.isNotEmpty() && oldValue.cross_id_end != newValue.cross_id_end)) {
|
||||
//驶出路口
|
||||
if ((it.status == 1 && newValue!!.status == 0)) {
|
||||
//径直驶出路口
|
||||
i("$M_MAP$TAG", "驶出路口 上个:${oldValue.cross_id_end} , 下个:${newValue.cross_id_end}")
|
||||
invokeRoadChange(false, newValue)
|
||||
invokeRoadChange(1, newValue)
|
||||
return@let
|
||||
}
|
||||
if((newValue!!.cross_id_end.isNotEmpty() && oldValue.cross_id_end != newValue.cross_id_end)){
|
||||
//路口发生变化
|
||||
i("$M_MAP$TAG", "路段发生变化 上个:${oldValue.cross_id_end} , 下个:${newValue.cross_id_end}")
|
||||
invokeRoadChange(2, newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user