From 55ef01e72e4895e446edfcd97dd5c252873506c2 Mon Sep 17 00:00:00 2001 From: zhongchao Date: Tue, 20 Dec 2022 15:08:34 +0800 Subject: [PATCH] [2.13.2] new func --- .../identify/MapIdentifySubscriber.kt | 5 +++ .../identify/TrackerSourceColorHelper.kt | 4 +-- .../function/v2x/events/V2XEventManager.kt | 36 +++++++++---------- .../function/v2x/events/utils/EntityUtils.kt | 28 +++++++++++---- .../api/map/marker/IMoGoIdentifyListener.kt | 3 +- 5 files changed, 48 insertions(+), 28 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt index 7fbe8275d9..da726f6703 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt @@ -1,5 +1,6 @@ package com.mogo.eagle.core.function.business.identify +import android.content.Context import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_IDENTIFY @@ -75,4 +76,8 @@ class MapIdentifySubscriber private constructor() :IMoGoIdentifyListener, IMoGoS return IdentifyFactory.getIdentifyObj(uuid) } + override fun init(context: Context?) { + + } + } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt index 68abd5926b..00e9089c7e 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackerSourceColorHelper.kt @@ -9,9 +9,7 @@ object TrackerSourceColorHelper { @SuppressLint("NewApi") fun filterData(data: TrackedObject): Boolean { - if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type - || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_501.type || data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_502.type - ) { + if (!FunctionBuildConfig.isDrawUnknownIdentifyData && data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type) { return true } var trackIPCFilter = true diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt index bf5bdf7af1..a181b9daa1 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/V2XEventManager.kt @@ -466,34 +466,34 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb .filter { planningObj: MessagePad.PlanningObject -> planningObj.type >= 1000 } .findFirst() if (first.isPresent) { - when (first.get().type) { -// 1004 -> { //V2N_RSM,静止事件,包括异常停车、异常静止障碍物 -// } + val poiType = when (first.get().type) { + // 1004 -> { //V2N_RSM,静止事件,包括异常停车、异常静止障碍物 + // } 1005 -> { //V2N_RSI,施工事件,包括锥桶或者挡板围城的施工场景,是个多边形包围区域 - val trackedObj = - CallerMapIdentifyManager.getIdentifyObj(first.get().uuid.toString()) - trackedObj?.let { t -> - handleRoadMarkerEvent(t.toRoadMarker()) - } + EventTypeEnum.AI_ROAD_WORK.poiType } 1007 -> { //三角牌 - + EventTypeEnum.FOURS_ACCIDENT.poiType } + else -> { + return + } + } + val trackedObj = + CallerMapIdentifyManager.getIdentifyObj(first.get().uuid.toString()) + trackedObj?.let { t -> + TrackUtils.trackV2xRoadProduceEvent(1) + val v2XMessageEntity = V2XMessageEntity() + v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING + v2XMessageEntity.content = t.toRoadMarker(poiType).toV2XRoadEventEntity() + v2XMessageEntity.isShowState = true + V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity) } } } } } -// private fun buildRoadEntity(e: V2XMarkerExploreWay, extra: Map? = null): V2XRoadEventEntity { // 记录道路事件 -// val v2XRoadEventEntity = V2XRoadEventEntity() -// v2XRoadEventEntity.location = e.location.toMarkerLocation() // 探路目前只有上报拥堵 -// v2XRoadEventEntity.poiType = EventTypeEnum.AI_ROAD_WORK.poiType -// v2XRoadEventEntity.noveltyInfo = e.toMarkExploreWay(extra) -// v2XRoadEventEntity.expireTime = 20000 -// return v2XRoadEventEntity -// } - private fun handleWarningTargetEvent(data: V2XWarningTarget) { val v2xMessageEntity = V2XMessageEntity() v2xMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_WEAKNESS diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt index b39e53a7f2..174512bae7 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/utils/EntityUtils.kt @@ -3,9 +3,12 @@ package com.mogo.eagle.core.function.v2x.events.utils import androidx.core.util.Pair import com.mogo.cloud.commons.utils.CoordinateUtils import com.mogo.eagle.core.data.enums.EventTypeEnum +import com.mogo.eagle.core.data.enums.EventTypeEnum.Companion.isRoadEvent import com.mogo.eagle.core.data.map.entity.MarkerExploreWay import com.mogo.eagle.core.data.map.entity.MarkerLocation import com.mogo.eagle.core.data.map.entity.MarkerUserInfo +import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity +import com.mogo.eagle.core.function.v2x.events.manager.impl.MoGoV2XMarkerManager import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker import com.mogo.v2x.data.* import mogo.telematics.pad.MessagePad @@ -105,7 +108,7 @@ fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult = ) } -fun MessagePad.TrackedObject.toRoadMarker(): V2XMarkerCardResult = +fun MessagePad.TrackedObject.toRoadMarker(poiType:String): V2XMarkerCardResult = V2XMarkerCardResult().also { l1 -> this.polygonList?.takeIf { it.isNotEmpty() }?.also { old -> l1.extras = HashMap>>().also { extra -> @@ -115,7 +118,7 @@ fun MessagePad.TrackedObject.toRoadMarker(): V2XMarkerCardResult = } l1.exploreWay = ArrayList().also { l2 -> l2.add(V2XMarkerExploreWay().also { l3 -> - l3.poiType = EventTypeEnum.AI_ROAD_WORK.poiType + l3.poiType = poiType l3.generateTime = 0L l3.location = V2XMarkerLocation().also { l4 -> val p = CoordinateUtils.transformWgsToGcj(this.latitude, this.longitude) @@ -125,8 +128,21 @@ fun MessagePad.TrackedObject.toRoadMarker(): V2XMarkerCardResult = } }) } + } + +fun V2XMarkerCardResult.toV2XRoadEventEntity():V2XRoadEventEntity = + V2XRoadEventEntity().also { l1 -> + val exploreWayList: List? = this.exploreWay + if(!exploreWayList.isNullOrEmpty() && exploreWayList.isNotEmpty()){ + for (markerExploreWay in exploreWayList) { + if (isRoadEvent(markerExploreWay.poiType)) { + val markerLocation = markerExploreWay.location + l1.location = markerLocation.toMarkerLocation() + l1.poiType = markerExploreWay.poiType + l1.noveltyInfo = markerExploreWay.toMarkExploreWay(this.extras) + l1.expireTime = 20000 + } + } + } + } - AiRoadMarker.receive( - AiRoadMarker.Marker(this.latitude, this.longitude, this.heading, null, null, null) - ) - } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMoGoIdentifyListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMoGoIdentifyListener.kt index 417ac0653d..168b5071b9 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMoGoIdentifyListener.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMoGoIdentifyListener.kt @@ -1,8 +1,9 @@ package com.mogo.eagle.core.function.api.map.marker +import com.alibaba.android.arouter.facade.template.IProvider import mogo.telematics.pad.MessagePad -interface IMoGoIdentifyListener { +interface IMoGoIdentifyListener :IProvider{ fun getIdentifyObj(uuid: String): MessagePad.TrackedObject? } \ No newline at end of file