[6.5.0]refactor: 通过公交站优化;

This commit is contained in:
aibingbing
2024-07-11 11:55:41 +08:00
parent 07ec6a9085
commit a306705cb7

View File

@@ -112,12 +112,12 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener {
val currentLocation =
CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84()
busStationListNeedNotified.values.forEach {
// val distance = CoordinateUtils.calculateLineDistance(
// currentLocation.longitude,
// currentLocation.latitude,
// it.getBusStationPoint().longitude,
// it.getBusStationPoint().latitude,
// ).toInt()
val distance = CoordinateUtils.calculateLineDistance(
currentLocation.longitude,
currentLocation.latitude,
it.getBusStationPoint().longitude,
it.getBusStationPoint().latitude,
).toInt()
val angle = DrivingDirectionUtils.getDegreeOfCar2Poi(
currentLocation.longitude,
currentLocation.latitude,
@@ -125,7 +125,7 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener {
it.getBusStationPoint().latitude,
currentLocation.heading.toInt()
)
if (angle >= 90) {
if (angle >= 90 || distance >= 150) {
CallerRoadV2NEventWindowListenerManager.dismiss(it.getBusStationId())
busStationListNeedNotified.remove(it.getBusStationId())
trackEvent("dismiss --> busStationId=${it.getBusStationId()}")
@@ -213,18 +213,20 @@ object PassBusStationEventManager : IMoGoChassisLocationWGS84Listener {
fun init() {
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 1, this)
handler?.post(checkDistanceRunnable)
handler.removeCallbacks(checkDistanceRunnable)
handler.removeCallbacks(notificationCheckRunnable)
handler.post(checkDistanceRunnable)
trackEvent("init")
}
fun unInit() {
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
mCoroutineScope?.cancel()
busStationNearByQueue?.clear()
busStationListNeedNotified?.clear()
handler?.removeCallbacks(checkDistanceRunnable)
handler?.removeCallbacks(notificationCheckRunnable)
handler?.looper?.quit()
busStationNearByQueue.clear()
busStationListNeedNotified.clear()
handler.removeCallbacks(checkDistanceRunnable)
handler.removeCallbacks(notificationCheckRunnable)
handler.looper?.quit()
trackEvent("unInit")
}