From ebe4d8b133136318ab3c20f2a8d05631998a9f88 Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Wed, 1 Dec 2021 18:44:43 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=E4=BB=85=E5=8F=B3=E8=BD=AC=E8=BF=87?= =?UTF-8?q?=E5=8E=BB=E4=B8=8D=E5=A4=84=E7=90=86=E7=BA=A2=E7=81=AF=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E5=92=8C=E7=BB=BF=E7=81=AF=E9=80=9A=E8=A1=8C=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/v2x/redlightwarning/RedLightWarningManager.kt | 4 ++++ .../java/com/mogo/eagle/core/data/trafficlight/RoadArrow.kt | 4 ++++ .../mogo/eagle/core/data/trafficlight/TrafficLightResult.kt | 4 ++++ .../eagle/core/data/trafficlight/TrafficLightStatusHelper.kt | 5 +++++ 4 files changed, 17 insertions(+) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt index 1f267f14df..964be8caf0 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/redlightwarning/RedLightWarningManager.kt @@ -45,6 +45,10 @@ class RedLightWarningManager : IMoGoTrafficLightListener, IMoGoVipSetListener, override fun onTrafficLightStatus(trafficLightResult: TrafficLightResult) { // 到路口100m时回调 Logger.d(TAG, "处理路口交通数据:是否是第一次处理:${isFirst}是否进入路口:${isEnter}") + if (trafficLightResult.currentRoadIsRight()) { + Logger.d(TAG,"当前道路右转,不处理") + return + } if (isFirst && !isEnter) { getCurrentRoadTrafficLight(trafficLightResult)?.let { handleRedLightWarning(it, trafficLightResult) diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadArrow.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadArrow.kt index c63ba750d1..d2dc51943c 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadArrow.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/RoadArrow.kt @@ -25,6 +25,10 @@ class RoadArrow { fun isRight(arrowId: Int): Boolean { return arrowId == TURN_RIGHT || arrowId == STRAIGHT_OR_RIGHT || arrowId == TURN_LEFT_OR_RIGHT } + + fun isOnlyRight(arrowId: Int): Boolean { + return arrowId == TURN_RIGHT + } } } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightResult.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightResult.kt index 66bf66feb4..78d6158db9 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightResult.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightResult.kt @@ -4,6 +4,10 @@ fun TrafficLightResult.currentRoadTrafficLight(): TrafficLightStatus? { return TrafficLightStatusHelper.getCurrentRoadTrafficLight(this) } +fun TrafficLightResult.currentRoadIsRight():Boolean{ + return TrafficLightStatusHelper.currentRoadIsRight(this) +} + /** * 路口红绿灯请求返回数据 */ diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightStatusHelper.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightStatusHelper.kt index 56214d173d..3b6f9ac6ef 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightStatusHelper.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/trafficlight/TrafficLightStatusHelper.kt @@ -16,5 +16,10 @@ object TrafficLightStatusHelper { return null } + fun currentRoadIsRight(trafficLightResult: TrafficLightResult) : Boolean{ + val arrowNo = trafficLightResult.arrowNo + return RoadArrow.isOnlyRight(arrowNo) + } + } \ No newline at end of file