diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt index e3ba3c913b..5f8f399ab5 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/Identify.kt @@ -15,4 +15,6 @@ interface Identify { } fun clearOldMarker() + + fun getIdentifyObj(uuid: String):TrackedObject? } \ 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/IdentifyBeautifyDataDrawer.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyBeautifyDataDrawer.kt index aa8a35caf9..977e319371 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyBeautifyDataDrawer.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyBeautifyDataDrawer.kt @@ -61,5 +61,9 @@ class IdentifyBeautifyDataDrawer : Identify { TrackManager.getInstance().clearAll() } + override fun getIdentifyObj(uuid: String): TrackedObject? { + return TrackManager.getInstance().getIdentifyObj(uuid) + } + } diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt index 78e56df4f0..fc72dba29c 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyFactory.kt @@ -105,6 +105,10 @@ object IdentifyFactory : Identify, IMoGoObuStatusListener { mDrawerHandler.sendMessage(message) } + override fun getIdentifyObj(uuid: String): TrackedObject? { + return identify?.getIdentifyObj(uuid) + } + override fun updateTrackerWarningInfo(trafficData: TrafficData) { super.updateTrackerWarningInfo(trafficData) val message = Message.obtain() diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyOriginDataDrawer.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyOriginDataDrawer.kt index 72052c3a59..1aa1fe92aa 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyOriginDataDrawer.kt +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/IdentifyOriginDataDrawer.kt @@ -136,4 +136,8 @@ class IdentifyOriginDataDrawer : Identify { WarningHelper.clear() } + override fun getIdentifyObj(uuid: String): TrackedObject? { + return mMarkersCaches[uuid] + } + } \ 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/MapIdentifySubscriber.kt b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/MapIdentifySubscriber.kt index 33fa6a5a1c..7fbe8275d9 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,8 +1,11 @@ package com.mogo.eagle.core.function.business.identify +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 import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotIdentifyListener import com.mogo.eagle.core.function.api.base.IMoGoSubscriber +import com.mogo.eagle.core.function.api.map.marker.IMoGoIdentifyListener import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotIdentifyListenerManager import com.mogo.eagle.core.utilcode.util.ThreadUtils import mogo.telematics.pad.MessagePad @@ -14,7 +17,8 @@ import mogo.telematics.pad.MessagePad.TrackedObject * * @author donghongyu */ -class MapIdentifySubscriber private constructor() : IMoGoSubscriber, +@Route(path = PATH_IDENTIFY) +class MapIdentifySubscriber private constructor() :IMoGoIdentifyListener, IMoGoSubscriber, IMoGoAutopilotIdentifyListener { private val TAG = "MapIdentifySubscriber" @@ -67,4 +71,8 @@ class MapIdentifySubscriber private constructor() : IMoGoSubscriber, } } + override fun getIdentifyObj(uuid: String): TrackedObject? { + return IdentifyFactory.getIdentifyObj(uuid) + } + } \ 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/TrackManager.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackManager.java index 907f04ce8d..b06fe8bdfd 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackManager.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/business/identify/TrackManager.java @@ -163,4 +163,13 @@ public class TrackManager { mMarkersCaches.forEach((uuid, trackObj) -> removeKey(uuid)); } + public MessagePad.TrackedObject getIdentifyObj(String uuid) { + TrackObj trackObj = mMarkersCaches.get(uuid); + if (trackObj != null && trackObj.getCache() != null) { + return trackObj.getCache(); + } else { + return null; + } + } + } 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 acc4631953..bf5bdf7af1 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 @@ -444,56 +444,20 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb handleWarningTargetEvent(event.data) } is V2XEvent.RoadAI -> { - handleRoadMarkerEvent(event.data.toRoadMarker) + handleRoadMarkerEvent(event.data.toRoadMarker()) } } } - private val RW_PB.toRoadMarker: V2XMarkerCardResult - get() = V2XMarkerCardResult().also { l1 -> - this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old -> - l1.extras = HashMap>>().also { extra -> - extra["polygon"] = old.map { d -> - Pair(d.lon, d.lat) - } - - extra["gps_location"] = listOf( - Pair( - this.roadwork?.center?.point?.lon ?: 0.0, - this.roadwork?.center?.point?.lat ?: 0.0 - ) - ) - } - } - l1.exploreWay = ArrayList().also { l2 -> - l2.add(V2XMarkerExploreWay().also { l3 -> - l3.poiType = this.roadwork?.poiType?.toString() - l3.generateTime = this.roadwork?.detectTime ?: 0L - l3.location = V2XMarkerLocation().also { l4 -> - val p = CoordinateUtils.transformWgsToGcj( - this.roadwork?.center?.point?.lat ?: 0.0, - this.roadwork?.center?.point?.lon ?: 0.0 - ) - l4.lon = p[0] - l4.lat = p[1] - l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0 - } - }) - } - - AiRoadMarker.receive( - Marker( - this.roadwork?.center?.point?.lat ?: 0.0, - this.roadwork?.center?.point?.lon ?: 0.0, - this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, - null, - null, - null - ) - ) - } - @SuppressLint("NewApi") + @ChainLog( + linkChainLog = CHAIN_LINK_LOG_CLOUD_V2N, + linkCode = CHAIN_LINK_CLOUD, + endpoint = TracingConstants.Endpoint.PAD, + nodeAliasCode = CHAIN_ALIAS_CODE_CLOUD_V2N, + paramIndexes = [0], + clientPkFileName = "sn" + ) override fun onAutopilotIdentifyPlanningObj(planningObjects: List?) { super.onAutopilotIdentifyPlanningObj(planningObjects) planningObjects?.let { @@ -501,12 +465,18 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb val first = it.stream() .filter { planningObj: MessagePad.PlanningObject -> planningObj.type >= 1000 } .findFirst() - if(first.isPresent){ - when(first.get().type){ + if (first.isPresent) { + when (first.get().type) { // 1004 -> { //V2N_RSM,静止事件,包括异常停车、异常静止障碍物 -// // } 1005 -> { //V2N_RSI,施工事件,包括锥桶或者挡板围城的施工场景,是个多边形包围区域 + val trackedObj = + CallerMapIdentifyManager.getIdentifyObj(first.get().uuid.toString()) + trackedObj?.let { t -> + handleRoadMarkerEvent(t.toRoadMarker()) + } + } + 1007 -> { //三角牌 } } 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 042c5b9e54..b39e53a7f2 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 @@ -1,55 +1,132 @@ 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.map.entity.MarkerExploreWay import com.mogo.eagle.core.data.map.entity.MarkerLocation import com.mogo.eagle.core.data.map.entity.MarkerUserInfo -import com.mogo.v2x.data.MarkerExploreWayItem -import com.mogo.v2x.data.V2XMarkerExploreWay -import com.mogo.v2x.data.V2XMarkerLocation -import com.mogo.v2x.data.V2XMarkerUserInfo +import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker +import com.mogo.v2x.data.* +import mogo.telematics.pad.MessagePad +import roadwork.Road -fun V2XMarkerLocation?.toMarkerLocation(): MarkerLocation? = if (this == null) null else MarkerLocation().also { - it.lon = this.lon - it.lat = this.lat - it.address = this.address - it.angle = this.angle -} +fun V2XMarkerLocation?.toMarkerLocation(): MarkerLocation? = + if (this == null) null else MarkerLocation().also { + it.lon = this.lon + it.lat = this.lat + it.address = this.address + it.angle = this.angle + } -fun MarkerExploreWayItem?.toMarkerExploreWayItem(): com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem? = if (this == null) null else com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem().also { - it.illegalCount = this.illegalCount - it.content = this.content - it.url = this.url - it.thumbnail = this.thumbnail -} +fun MarkerExploreWayItem?.toMarkerExploreWayItem(): com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem? = + if (this == null) null else com.mogo.eagle.core.data.map.entity.MarkerExploreWayItem().also { + it.illegalCount = this.illegalCount + it.content = this.content + it.url = this.url + it.thumbnail = this.thumbnail + } -fun V2XMarkerUserInfo?.toMarkerUserInfo(): MarkerUserInfo? = if (this == null) null else MarkerUserInfo().also { - it.safeLabelType = this.safeLabelType - it.safeLabel = this.safeLabel - it.lastActiveweekAvgscore = this.lastActiveweekAvgscore - it.gender = this.gender - it.userHead = this.userHead - it.userName = this.userName - it.setAge(this.age) -} +fun V2XMarkerUserInfo?.toMarkerUserInfo(): MarkerUserInfo? = + if (this == null) null else MarkerUserInfo().also { + it.safeLabelType = this.safeLabelType + it.safeLabel = this.safeLabel + it.lastActiveweekAvgscore = this.lastActiveweekAvgscore + it.gender = this.gender + it.userHead = this.userHead + it.userName = this.userName + it.setAge(this.age) + } -fun V2XMarkerExploreWay.toMarkExploreWay(extras: Map? = null): MarkerExploreWay = MarkerExploreWay().also { - it.items = this.items?.map { itx -> itx.toMarkerExploreWayItem() } - it.userInfo = this.userInfo?.toMarkerUserInfo() - it.distance = this.distance - it.cityName = this.cityName - it.setGenerateTime(this.generateTime) - it.infoId = this.infoId - it.setFileType(this.fileType) - it.setDirection(this.direction) - it.location = this.location?.toMarkerLocation() - it.sn = this.sn - it.canLive = this.canLive != "0" - it.poiType = this.poiType - it.type = this.type - it.infoCheckNode = this.infoCheckNode - it.isFabulous = this.isFabulous - it.uploadType = this.uploadType - it.isCanLive = this.canLive != "0" - it.extras = extras -} \ No newline at end of file +fun V2XMarkerExploreWay.toMarkExploreWay(extras: Map? = null): MarkerExploreWay = + MarkerExploreWay().also { + it.items = this.items?.map { itx -> itx.toMarkerExploreWayItem() } + it.userInfo = this.userInfo?.toMarkerUserInfo() + it.distance = this.distance + it.cityName = this.cityName + it.setGenerateTime(this.generateTime) + it.infoId = this.infoId + it.setFileType(this.fileType) + it.setDirection(this.direction) + it.location = this.location?.toMarkerLocation() + it.sn = this.sn + it.canLive = this.canLive != "0" + it.poiType = this.poiType + it.type = this.type + it.infoCheckNode = this.infoCheckNode + it.isFabulous = this.isFabulous + it.uploadType = this.uploadType + it.isCanLive = this.canLive != "0" + it.extras = extras + } + +fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult = + V2XMarkerCardResult().also { l1 -> + this.roadwork?.polygonList?.takeIf { it.isNotEmpty() }?.also { old -> + l1.extras = HashMap>>().also { extra -> + extra["polygon"] = old.map { d -> + Pair(d.lon, d.lat) + } + + extra["gps_location"] = listOf( + Pair( + this.roadwork?.center?.point?.lon ?: 0.0, + this.roadwork?.center?.point?.lat ?: 0.0 + ) + ) + } + } + l1.exploreWay = ArrayList().also { l2 -> + l2.add(V2XMarkerExploreWay().also { l3 -> + l3.poiType = this.roadwork?.poiType?.toString() + l3.generateTime = this.roadwork?.detectTime ?: 0L + l3.location = V2XMarkerLocation().also { l4 -> + val p = CoordinateUtils.transformWgsToGcj( + this.roadwork?.center?.point?.lat ?: 0.0, + this.roadwork?.center?.point?.lon ?: 0.0 + ) + l4.lon = p[0] + l4.lat = p[1] + l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0 + } + }) + } + + AiRoadMarker.receive( + AiRoadMarker.Marker( + this.roadwork?.center?.point?.lat ?: 0.0, + this.roadwork?.center?.point?.lon ?: 0.0, + this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, + null, + null, + null + ) + ) + } + +fun MessagePad.TrackedObject.toRoadMarker(): V2XMarkerCardResult = + V2XMarkerCardResult().also { l1 -> + this.polygonList?.takeIf { it.isNotEmpty() }?.also { old -> + l1.extras = HashMap>>().also { extra -> + extra["polygon"] = old.map { d -> Pair(d.longitude, d.latitude) } + extra["gps_location"] = listOf(Pair(this.longitude, this.latitude)) + } + } + l1.exploreWay = ArrayList().also { l2 -> + l2.add(V2XMarkerExploreWay().also { l3 -> + l3.poiType = EventTypeEnum.AI_ROAD_WORK.poiType + l3.generateTime = 0L + l3.location = V2XMarkerLocation().also { l4 -> + val p = CoordinateUtils.transformWgsToGcj(this.latitude, this.longitude) + l4.lon = p[0] + l4.lat = p[1] + l4.angle = this.heading + } + }) + } + + 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-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java index 0b2ca7cbbe..8b135ecf92 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/constants/MogoServicePaths.java @@ -153,4 +153,7 @@ public class MogoServicePaths { @Keep public static final String PATH_MSG_BOX_MODULE = "/msg_box/api"; + + @Keep + public static final String PATH_IDENTIFY = "/map/identify"; } 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 new file mode 100644 index 0000000000..417ac0653d --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/map/marker/IMoGoIdentifyListener.kt @@ -0,0 +1,8 @@ +package com.mogo.eagle.core.function.api.map.marker + +import mogo.telematics.pad.MessagePad + +interface IMoGoIdentifyListener { + + fun getIdentifyObj(uuid: String): MessagePad.TrackedObject? +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapIdentifyManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapIdentifyManager.kt new file mode 100644 index 0000000000..3272b5220b --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/map/CallerMapIdentifyManager.kt @@ -0,0 +1,18 @@ +package com.mogo.eagle.core.function.call.map + +import com.alibaba.android.arouter.launcher.ARouter +import com.mogo.eagle.core.data.constants.MogoServicePaths.PATH_IDENTIFY +import com.mogo.eagle.core.function.api.map.marker.IMoGoIdentifyListener +import com.mogo.eagle.core.function.call.base.CallerBase +import mogo.telematics.pad.MessagePad + +object CallerMapIdentifyManager : CallerBase() { + + private val identifyApi: IMoGoIdentifyListener + get() = ARouter.getInstance().build(PATH_IDENTIFY) + .navigation() as IMoGoIdentifyListener + + fun getIdentifyObj(uuid: String): MessagePad.TrackedObject? { + return identifyApi.getIdentifyObj(uuid) + } +} \ No newline at end of file