From 07838e7ba0dd9592f1552f203e848aafa870b33e Mon Sep 17 00:00:00 2001 From: renwj Date: Thu, 12 Jan 2023 10:41:08 +0800 Subject: [PATCH] =?UTF-8?q?[2.13.2]=E4=BC=98=E5=8C=96V2X=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E5=8E=BB=E9=87=8D=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2x/events/scenario/impl/AbsV2XScenario.java | 15 ++++++++------- .../events/scenario/impl/V2XScenarioManager.java | 2 ++ .../scenario/scene/road/V2XRoadEventScenario.java | 5 +++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java index cd72feafbd..8fe0d5b892 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/AbsV2XScenario.java @@ -7,6 +7,8 @@ import com.mogo.eagle.core.data.map.entity.V2XMessageEntity; import com.mogo.eagle.core.function.v2x.events.scenario.IV2XScenario; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; +import java.util.concurrent.atomic.AtomicReference; + /** * author : donghongyu * e-mail : 1358506549@qq.com @@ -17,7 +19,7 @@ import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; public abstract class AbsV2XScenario implements IV2XScenario { protected String TAG = "AbsV2XScenario"; private IV2XMarker mV2XMarker; - private V2XMessageEntity mV2XMessageEntity; + private static final AtomicReference mV2XMessageEntity = new AtomicReference<>(); protected AbsV2XScenario() { } @@ -33,7 +35,6 @@ public abstract class AbsV2XScenario implements IV2XScenario { * 释放资源 */ public void release() { - mV2XMessageEntity = null; mV2XMarker = null; } @@ -46,19 +47,19 @@ public abstract class AbsV2XScenario implements IV2XScenario { } public void setV2XMessageEntity(@Nullable V2XMessageEntity mV2XMessageEntity) { - this.mV2XMessageEntity = mV2XMessageEntity; + this.mV2XMessageEntity.set(mV2XMessageEntity); } public V2XMessageEntity getV2XMessageEntity() { - return mV2XMessageEntity; + return mV2XMessageEntity.get(); } @Override public boolean isSameScenario(@Nullable V2XMessageEntity v2XMessageEntity) { - if (mV2XMessageEntity == null) { + V2XMessageEntity old = mV2XMessageEntity.get(); + if (old == null) { return false; } - return mV2XMessageEntity.equals(v2XMessageEntity); + return old.equals(v2XMessageEntity); } - } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java index a5addc16c7..a8f916dc9f 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/impl/V2XScenarioManager.java @@ -21,6 +21,8 @@ import com.mogo.map.MogoMapUIController; import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.map.uicontroller.VisualAngleMode; +import java.util.concurrent.atomic.AtomicReference; + /** * author : donghongyu * e-mail : 1358506549@qq.com diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java index 88e13b8217..12c6437810 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventScenario.java @@ -1,6 +1,5 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; -import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X; import android.util.Log; @@ -26,7 +25,6 @@ import com.mogo.eagle.core.function.v2x.events.manager.V2XStatusManager; import com.mogo.eagle.core.function.v2x.events.scenario.impl.AbsV2XScenario; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; import com.mogo.eagle.core.network.utils.GsonUtil; -import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -41,6 +39,9 @@ import java.util.concurrent.TimeUnit; public class V2XRoadEventScenario extends AbsV2XScenario implements IMoGoWarningStatusListener { private static final String TAG = "V2XRoadEventScenario"; + public V2XRoadEventScenario() { + setV2XMarker(new V2XRoadEventMarker()); + } @Override public void init(V2XMessageEntity v2XMessageEntity) {