diff --git a/app/src/main/java/com/mogo/launcher/stageone/ThreadOptStartup.kt b/app/src/main/java/com/mogo/launcher/stageone/ThreadOptStartup.kt index 4f86a8f3ff..d0043384b8 100644 --- a/app/src/main/java/com/mogo/launcher/stageone/ThreadOptStartup.kt +++ b/app/src/main/java/com/mogo/launcher/stageone/ThreadOptStartup.kt @@ -18,6 +18,7 @@ class ThreadOptStartup: AndroidStartup() { /*.dump(DumpConfig.Builder() .dumpLogFilePath(File(context.getExternalFilesDir(null), "thread_dump_log_${ SimpleDateFormat("yyyy-MM-dd-HH-mm-ss", Locale.ROOT).format(Date()) }.txt").absolutePath) .dumpPeriod(5, SECONDS) + .threadRunThreshold(10, SECONDS) .build())*/) return 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 fb19fe252c..6d4fb4572b 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 @@ -106,7 +106,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb V2XManager.init(V2XConfig.Builder().also { it.aiCloudConfig(MoGoAiCloudClientConfig.getInstance()) it.context(context) - it.loggable(false) + it.loggable(true) it.distanceForTriggerRefresh(200f) //行驶超过200(包含)米,刷新道路周边信息(短链请求) it.durationForTriggerRefresh( 60, @@ -364,7 +364,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb ) if (v2XRoadEventEntity != null) { val distance = v2XRoadEventEntity.distance - val min = if (EventTypeEnumNew.AI_ROAD_WORK.poiType == v2XRoadEventEntity.poiType) 0 else 5 + val min = if (EventTypeEnumNew.isCloudSocketEvent(v2XRoadEventEntity.poiType)) 0 else 5 CallerLogger.d( "$M_V2X$TAG", "--- trigger show before ---:data=>[${location.longitude}, ${location.latitude}, ${location.speed}], distance: $distance, minDistance: $min, poiType: ${v2XRoadEventEntity.poiType}" @@ -448,6 +448,10 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb } handleRoadMarkerEvent(event.data.toRoadMarker()) } + + is V2XEvent.RoadEventX -> { + handleRoadMarkerEvent(event.data.toRoadMarker()) + } } } @@ -466,7 +470,7 @@ object V2XEventManager : IMoGoMapLocationListener, IMoGoTokenCallback, IV2XCallb // 1004 -> { //V2N_RSM,静止事件,包括异常停车、异常静止障碍物 // } 1005 -> { //V2N_RSI,施工事件,包括锥桶或者挡板围城的施工场景,是个多边形包围区域 - EventTypeEnumNew.AI_ROAD_WORK.poiType + EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType } 1007 -> { //三角牌 EventTypeEnumNew.FOURS_ACCIDENT_04.poiType diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java index 32217ef98e..38bb51676b 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/alarm/V2XAlarmServer.java @@ -1,5 +1,8 @@ package com.mogo.eagle.core.function.v2x.events.alarm; +import android.util.Log; + +import com.facebook.common.logging.LoggingDelegate; import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.data.map.entity.MarkerLocation; @@ -24,7 +27,7 @@ import io.netty.util.internal.ConcurrentSet; public class V2XAlarmServer { // 记录道路播报的事件 - private static ConcurrentSet showedEvents = new ConcurrentSet<>(); + private static final ConcurrentSet showedEvents = new ConcurrentSet<>(); /** * 获取当前车辆前方距离最近的道路事件 */ @@ -32,6 +35,7 @@ public class V2XAlarmServer { CopyOnWriteArrayList v2XRoadEventEntityList, MogoLocation currentLocation) { try { + Log.d("RWJ", "getDriveFrontAlarmEvent --- 1 ---" + currentLocation ); if (!showedEvents.isEmpty()) { Iterator iterator = showedEvents.iterator(); while (iterator.hasNext()) { @@ -48,15 +52,18 @@ public class V2XAlarmServer { } } } + Log.d("RWJ", "getDriveFrontAlarmEvent --- 2 ---" + currentLocation); if (currentLocation != null && v2XRoadEventEntityList != null) { // 因为集合是按照距离排序后的所以这里检索出来第一个就发出警告 for (V2XRoadEventEntity v2XRoadEventEntity : v2XRoadEventEntityList) { // 0、道路事件必须有朝向,角度>=0; + Log.d("RWJ", "entity:" + v2XRoadEventEntity.getLocation()); if (v2XRoadEventEntity.getLocation().getAngle() >= 0) { // 计算车辆距离指定气泡的距离 MarkerLocation eventLocation = v2XRoadEventEntity.getLocation(); // 1、判断是否到达了触发距离,20 ~ 500, double distance = v2XRoadEventEntity.getDistance(); + Log.d("RWJ", "distance:" + distance); if (distance <= 500) { if (EventTypeEnumNew.GHOST_PROBE.getPoiType().equals(v2XRoadEventEntity.getPoiType())) { if (distance > 25) { @@ -67,6 +74,7 @@ public class V2XAlarmServer { double carBearing = currentLocation.getBearing(); double eventBearing = eventLocation.getAngle(); double diffAngle = DrivingDirectionUtils.getAngleDiff(carBearing, eventBearing); + Log.d("RWJ", "car_bearing:" + carBearing + ",eventBearing:" + eventBearing + ",diffAngle:" + diffAngle); if (diffAngle < 20) { // 3、计算当前车辆行驶方向与事件位置之间夹角《20度,保证道路事件在车辆前方 double eventAngle = DrivingDirectionUtils.getDegreeOfCar2Poi( @@ -76,6 +84,8 @@ public class V2XAlarmServer { eventLocation.getLat(), (int) currentLocation.getBearing() ); + + Log.d("RWJ", "eventAngle:" + eventAngle); if (0 <= eventAngle && eventAngle <= 20) { if (showedEvents.contains(v2XRoadEventEntity)) { return null; @@ -90,6 +100,7 @@ public class V2XAlarmServer { } } catch (Exception e) { e.printStackTrace(); + Log.w("RWJ", "error: " + e.getMessage()); } return null; } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingConstruction.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingConstruction.java index fb476713ce..eb63f3cc4a 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingConstruction.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/entity/panel/SurroundingConstruction.java @@ -36,9 +36,4 @@ public class SurroundingConstruction implements Serializable { construtList.add(item); } - public String getTypeNameTTS(String type) { - String typeName = "请查看周边的"; - typeName += EventTypeEnumNew.getTypeNameTTS(type); - return typeName + "信息"; - } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt index b97eee7287..27ffef0b67 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/receiver/TestPanelBroadcastReceiver.kt @@ -199,7 +199,7 @@ class TestPanelBroadcastReceiver : BroadcastReceiver() { val v2XMessageEntity = V2XMessageEntity() v2XMessageEntity.type = V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING v2XMessageEntity.content = - trackedObj.toRoadMarker(EventTypeEnumNew.AI_ROAD_WORK.poiType).toV2XRoadEventEntity() + trackedObj.toRoadMarker(EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType).toV2XRoadEventEntity() v2XMessageEntity.isShowState = true V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity) } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt index 36113a7a20..5251b27fa6 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/airoad/AiRoadMarker.kt @@ -29,7 +29,6 @@ import com.mogo.map.overlay.* import io.netty.util.internal.* import java.lang.Runnable import java.util.* -import java.util.concurrent.* import java.util.concurrent.atomic.* import kotlin.collections.ArrayList @@ -59,27 +58,13 @@ object AiRoadMarker { val poi = this.marker.get() val car = this.carLocation.get() if (poi != null && car != null) { - val distance = DrivingDirectionUtils.distance(car.first, car.second, poi.poi_lon, poi.poi_lat) * 10000 + val distance = CoordinateUtils.calculateLineDistance(car.first, car.second, poi.poi_lon, poi.poi_lat) if (distance < 500) { unMarker(poi) } } } - private val checkV2NExpiredTask = Runnable { - val poi = this.marker.get() - val car = this.carLocation.get() - if (poi != null && car != null) { - val distance = CoordinateUtils.calculateLineDistance(car.first, car.second, poi.poi_lon, poi.poi_lat) - Logger.d(TAG, "receive --- checkV2N --- distance: $distance") - if (distance > 200) { - unMarker(poi) - }else{ - checkV2NExpired() - } - } - } - private val onClearAllMarker = object : OnClearAllMarker { override fun onClearAllMarkers() { @@ -125,28 +110,6 @@ object AiRoadMarker { }) } - private val onRoadListener = object : OnRoadListener { - private var roadId = "" - private var hasCrossRoad = false - - override fun onRoadIdInfo(roadId: String) { - Logger.d(TAG, "--- onRoadInfo --- roadId: $roadId") - val oldRoadId = this.roadId - if (oldRoadId != roadId) { - if (hasCrossRoad) { - hasCrossRoad = false - } - } - this.roadId = roadId - } - override fun onStopLineInfo(info: StopLine) { - Logger.d(TAG, "--- onStopLineInfo --- info: $info") - if (!hasCrossRoad) { - hasCrossRoad = true - } - } - } - private val onLocationListener = object : IMoGoMapLocationListener { override fun onLocationChanged(location: MogoLocation?, from: Int, isGps: Boolean) { @@ -163,102 +126,105 @@ object AiRoadMarker { } private fun onCreate() { - CallerMapRoadListenerManager.registerRoadListener(TAG, onRoadListener) CallMarkersClearManager.addAllMarkersClearListener(TAG, onClearAllMarker) CallerMapLocationListenerManager.addListener(TAG, onLocationListener, true) } private fun onDestroy() { - CallerMapRoadListenerManager.unRegisterRoadListener(TAG) CallMarkersClearManager.removeAllMarkersClearListener(TAG) CallerMapLocationListenerManager.removeListener(TAG, true) removeLine() } - fun marker(marker: Marker, drawMarker: Boolean) { + fun marker(marker: Marker, drawMarker: Boolean, drawRoadLine: Boolean = false) { handler.removeCallbacks(checkExpiredTask) val location = carLocation.get() ?: return if (markers.contains(marker)) { - Logger.d(TAG, "--- enqueue --- cache hit ---") + Logger.d(TAG, "--- maker --- cache hit ---") return } + Logger.d(TAG, "--- marker ---:${marker}") synchronized(markers) { markers += marker } this.marker.set(marker) - //施工中心点前方的自车行驶方向上300米距离 - val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f) - //施工中心点后方的自车行驶方向上300米距离 - Logger.d(TAG, "--- marker --- 3 --- l1: $l1") - val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), -300f) - if (l1.points.isEmpty() || l2.points.isEmpty()) { - Logger.d(TAG, "--- marker --- 3 --- return ----") - synchronized(markers) { - markers.remove(marker) - } - return - } - Logger.d(TAG, "--- marker --- 4 --- l2: $l2") - val points = LinkedList() - if (l2 != null && l2.points.isNotEmpty()) { - points.addAll(l2.points.reversed().map { - MogoLatLng(it.second, it.first) - }) - } - val centerX= marker.poi_lon - val centerY = marker.poi_lat - Logger.d(TAG, "--- marker --- 5 --- marker: $marker") - val farthestPoint = marker.polygon?.let { - var find: Pair = Pair(centerX, centerY) - var min = Long.MAX_VALUE - for (p in it) { - val angle = DrivingDirectionUtils.getDegreeOfCar2Poi2(centerX, centerY, p.first, p.second, location.third) - if (angle < min) { - min = angle - find = p - } - } - MogoLatLng(find.second, find.first) - } ?: MogoLatLng(centerY, centerX) - marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat) - Logger.d(TAG, "--- marker --- 6 --- marker: $marker") - if (l1 != null && l1.points.isNotEmpty()) { - for (l in l1.points) { - if (DrivingDirectionUtils.getDegreeOfCar2Poi2(farthestPoint.lon, farthestPoint.lat, l.first, l.second, location.third + 180) < 90L) { - points.add(l.let { MogoLatLng(it.second, it.first) }) - } - } - } - if (points.size <= 1) { - synchronized(markers) { - markers.remove(marker) - } - return - } - removeLine() if (drawMarker) { marker.entity?.apply { V2XAiRoadEventMarker.drawMarkers(this) } } - val evaluator = ArgbEvaluator() - val interceptor = DecelerateInterpolator(1.5f) - val total = points.size - val colors = ArrayList() - (0..total).forEach { i -> - colors += evaluator.evaluate(interceptor.getInterpolation(i * 1f / total), START_COLOR, END_COLOR) as Int - } - var line = line.get() - options.points(points) - options.colorValues(colors) - Logger.d(TAG, "--- marker --- 7 --- points: ${points.size}") - if (line == null || line.isDestroyed) { - val l = overlayManager.addPolyline(options) - this.line.set(l) - line = l + if (drawRoadLine) { + //施工中心点前方的自车行驶方向上300米距离 + val l1 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), 300f) + //施工中心点后方的自车行驶方向上300米距离 + Logger.d(TAG, "--- marker --- 3 --- l1: $l1") + val l2 = MogoMap.getInstance().mogoMap.getCenterLineRangeInfo(marker.poi_lon, marker.poi_lat, location.third.toFloat(), -300f) + if (l1.points.isEmpty() || l2.points.isEmpty()) { + Logger.d(TAG, "--- marker --- 3 --- return ----") + synchronized(markers) { + markers.remove(marker) + } + return + } + Logger.d(TAG, "--- marker --- 4 --- l2: $l2") + val points = LinkedList() + if (l2 != null && l2.points.isNotEmpty()) { + points.addAll(l2.points.reversed().map { + MogoLatLng(it.second, it.first) + }) + } + val centerX= marker.poi_lon + val centerY = marker.poi_lat + Logger.d(TAG, "--- marker --- 5 --- marker: $marker") + val farthestPoint = marker.polygon?.let { + var find: Pair = Pair(centerX, centerY) + var min = Long.MAX_VALUE + for (p in it) { + val angle = DrivingDirectionUtils.getDegreeOfCar2Poi2(centerX, centerY, p.first, p.second, location.third) + if (angle < min) { + min = angle + find = p + } + } + MogoLatLng(find.second, find.first) + } ?: MogoLatLng(centerY, centerX) + marker.farthestPoint = Pair(farthestPoint.lon, farthestPoint.lat) + Logger.d(TAG, "--- marker --- 6 --- marker: $marker") + if (l1 != null && l1.points.isNotEmpty()) { + for (l in l1.points) { + if (DrivingDirectionUtils.getDegreeOfCar2Poi2(farthestPoint.lon, farthestPoint.lat, l.first, l.second, location.third + 180) < 90L) { + points.add(l.let { MogoLatLng(it.second, it.first) }) + } + } + } + if (points.size <= 1) { + synchronized(markers) { + markers.remove(marker) + } + return + } + removeLine() + val evaluator = ArgbEvaluator() + val interceptor = DecelerateInterpolator(1.5f) + val total = points.size + val colors = ArrayList() + (0..total).forEach { i -> + colors += evaluator.evaluate(interceptor.getInterpolation(i * 1f / total), START_COLOR, END_COLOR) as Int + } + var line = line.get() + options.points(points) + options.colorValues(colors) + Logger.d(TAG, "--- marker --- 7 --- points: ${points.size}") + if (line == null || line.isDestroyed) { + val l = overlayManager.addPolyline(options) + this.line.set(l) + line = l + } else { + line.setOption(options) + } + if (!line.isVisible) { + line.isVisible = true + } } else { - line.setOption(options) - } - if (!line.isVisible) { - line.isVisible = true + removeLine() } } @@ -287,7 +253,7 @@ object AiRoadMarker { val poi = this.marker.get() val car = this.carLocation.get() if (poi != null && car != null) { - val distance = DrivingDirectionUtils.distance(car.first, car.second, marker.poi_lon, marker.poi_lat) * 10000 + val distance = CoordinateUtils.calculateLineDistance(car.first, car.second, marker.poi_lon, marker.poi_lat) Logger.d(TAG, "receive --- 2 ---:car:[${car.first}, ${car.second}] -> poi:[${marker.poi_lon}, ${marker.poi_lat}] --> distance:$distance") if (distance < 500) { checkExpired() @@ -306,32 +272,13 @@ object AiRoadMarker { handler.postDelayed(checkExpiredTask, 10000) } - fun receiveV2N(marker: Marker) { - Logger.d(TAG, "receive --- 1 ---") - val car = this.carLocation.get() - if (car != null) { - val distance = DrivingDirectionUtils.distance(car.first, car.second, marker.poi_lon, marker.poi_lat) * 10000 - Logger.d(TAG, "receive --- 2 ---:car:[${car.first}, ${car.second}] -> poi:[${marker.poi_lon}, ${marker.poi_lat}] --> distance:$distance") - if (distance < 500) { - checkV2NExpired() - } else { - handler.removeCallbacks(checkV2NExpiredTask) - } - } else { - checkV2NExpired() - } - } - - private fun checkV2NExpired() { - handler.removeCallbacks(checkV2NExpiredTask) - handler.postDelayed(checkV2NExpiredTask, 5000) - } - data class Marker( + val id: String, + val poiType: String, val poi_lat: Double, val poi_lon: Double, val poi_angle: Double, - val polygon: List>?, + val polygon: List>? = null, var farthestPoint: Pair? = null, var entity: V2XRoadEventEntity? = null ) { @@ -340,15 +287,12 @@ object AiRoadMarker { if (this === other) return true if (javaClass != other?.javaClass) return false other as Marker - if (poi_lat != other.poi_lat) return false - if (poi_lon != other.poi_lon) return false + if (id != other.id) return false return true } override fun hashCode(): Int { - var result = poi_lat.hashCode() - result = 31 * result + poi_lon.hashCode() - return result + return id.hashCode() } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java index e63a5cc18c..ff12063cb2 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/road/V2XRoadEventMarker.java @@ -1,5 +1,7 @@ package com.mogo.eagle.core.function.v2x.events.scenario.scene.road; +import android.util.Log; + import androidx.core.util.Pair; import com.mogo.eagle.core.data.enums.EventTypeEnumNew; @@ -11,6 +13,8 @@ import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XMarkerManager; import com.mogo.eagle.core.function.v2x.events.manager.IMoGoV2XPolylineManager; import com.mogo.eagle.core.function.v2x.events.scenario.scene.airoad.AiRoadMarker; import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker; +import com.mogo.eagle.core.network.utils.GsonUtil; + import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -31,8 +35,12 @@ public class V2XRoadEventMarker implements IV2XMarker { if (marker != null) { marker.clearAlarmPOI(); if (entity != null) { - if (!Objects.equals(entity.getPoiType(), EventTypeEnumNew.AI_ROAD_WORK.getPoiType()) - && !Objects.equals(entity.getPoiType(), EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType())) { + Log.d("RWJ", "V2XRoadEventMarker:" + entity.getPoiType()); + if (!Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType()) + && !Objects.equals(entity.getPoiType(), EventTypeEnumNew.FOURS_ACCIDENT_04.getPoiType()) + && !Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType()) + && !Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_CONGESTION.getPoiType()) + && !Objects.equals(entity.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType())) { AiRoadMarker.Marker prev = mMarker; if (prev != null) { AiRoadMarker.INSTANCE.unMarker(prev); @@ -46,6 +54,7 @@ public class V2XRoadEventMarker implements IV2XMarker { mMarker = null; } MarkerExploreWay noveltyInfo = entity.getNoveltyInfo(); + Log.d("RWJ", "V2XRoadEventMarker -> noveltyInfo:" + noveltyInfo); if (noveltyInfo != null && noveltyInfo.extras != null) { List> polygons = new ArrayList<>(); Pair gpsLocation = null; @@ -80,11 +89,10 @@ public class V2XRoadEventMarker implements IV2XMarker { if (!polygons.isEmpty() && gpsLocation != null) { MarkerLocation location = noveltyInfo.getLocation(); - AiRoadMarker.Marker m = new AiRoadMarker.Marker(gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity); + AiRoadMarker.Marker m = new AiRoadMarker.Marker(noveltyInfo.getInfoId(), noveltyInfo.getPoiType(), gpsLocation.second, gpsLocation.first, location.getAngle(), polygons, null, entity); mMarker = m; - AiRoadMarker.INSTANCE.marker(m, true); + AiRoadMarker.INSTANCE.marker(m, true, isDrawRoadLine(m.getPoiType())); } - } } } @@ -94,6 +102,10 @@ public class V2XRoadEventMarker implements IV2XMarker { } } + private boolean isDrawRoadLine(String poiType) { + return EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType().equals(poiType); + } + @Override public void clearPOI() { // 移除线 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 045fe265b5..eb0c4eea60 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 @@ -4,10 +4,13 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_V2X import android.util.Log; +import com.mogo.cloud.commons.utils.CoordinateUtils; import com.mogo.commons.analytics.AnalyticsUtils; import com.mogo.eagle.core.data.enums.EventTypeEnumNew; import com.mogo.eagle.core.data.enums.WarningDirectionEnum; +import com.mogo.eagle.core.data.map.MogoLocation; 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.V2XMessageEntity; import com.mogo.eagle.core.data.map.entity.V2XRoadEventEntity; import com.mogo.eagle.core.data.msgbox.MsgBoxBean; @@ -15,6 +18,7 @@ import com.mogo.eagle.core.data.msgbox.MsgBoxType; import com.mogo.eagle.core.data.msgbox.V2XMsg; import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener; import com.mogo.eagle.core.function.call.hmi.CallerHmiManager; +import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager; import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager; import com.mogo.eagle.core.function.v2x.events.consts.V2XConst; @@ -44,7 +48,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp @Override public void init(V2XMessageEntity v2XMessageEntity) { try { - CallerLogger.INSTANCE.d(M_V2X + TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity)); + Log.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity)); V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent(); if (v2XRoadEventEntity != null) { if (v2XMessageEntity.isShowState()) { @@ -99,20 +103,39 @@ public class V2XRoadEventScenario extends AbsV2XScenario imp V2XRoadEventEntity content = entity != null ? entity.getContent() : null; if (content != null) { // //显示警告红边 - if (content.getAlarmContent() == null || content.getAlarmContent().isEmpty() - || content.getTts() == null || content.getTts().isEmpty()) { + String alarmText = content.getAlarmContent(); + String ttsText = content.getTts(); + if (alarmText == null || alarmText.isEmpty() + || ttsText == null || ttsText.isEmpty()) { Log.d("MsgBox-V2XRoadScenario", "alertContent或ttsContent为空!"); } + String poiType = content.getPoiType(); + if (EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType().equals(poiType) || + EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType().equals(poiType) || + EventTypeEnumNew.TYPE_SOCKET_ROAD_CONGESTION.getPoiType().equals(poiType) || + EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType().equals(poiType)) { + MogoLocation carLocation = CallerMapLocationListenerManager.INSTANCE.getCurrentLocation(); + MarkerExploreWay noveltyInfo = content.getNoveltyInfo(); + if (carLocation != null && noveltyInfo != null) { + MarkerLocation eventLocation = noveltyInfo.getLocation(); + if (eventLocation != null) { + double distance = CoordinateUtils.calculateLineDistance(carLocation.getLongitude(), carLocation.getLatitude(), eventLocation.getLon(), eventLocation.getLat()); + alarmText = String.format(alarmText, distance + ""); + ttsText = String.format(ttsText, distance + ""); + } + } + } + CallerMsgBoxManager.INSTANCE.saveMsgBox( new MsgBoxBean( MsgBoxType.V2X, - new V2XMsg(content.getPoiType(), - content.getAlarmContent(), - content.getTts()) + new V2XMsg(poiType, + alarmText, + ttsText) ) ); - CallerHmiManager.INSTANCE.warningV2X(content.getPoiType(), content.getAlarmContent(), - content.getTts(), TAG, this, !entity.isOnlyShow(), + CallerHmiManager.INSTANCE.warningV2X(poiType, alarmText, + ttsText, TAG, this, !entity.isOnlyShow(), TimeUnit.SECONDS.toMillis(5)); } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java index 872505f046..477d399d74 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/events/scenario/scene/warning/V2XFrontWarningScenario.java @@ -40,7 +40,7 @@ public class V2XFrontWarningScenario extends AbsV2XScenario implements IMoGoMapL private WarningDirectionEnum mDirection; public V2XFrontWarningScenario() { - setV2XMarker(sV2XWarningMarker); + //setV2XMarker(sV2XWarningMarker); } @Override 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 60ec2f4030..2b3a12e579 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,17 +1,14 @@ package com.mogo.eagle.core.function.v2x.events.utils import androidx.core.util.Pair +import com.mogo.eagle.core.data.enums.EventTypeEnumNew import com.mogo.eagle.core.data.enums.EventTypeEnumNew.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.scenario.scene.airoad.AiRoadMarker -import com.mogo.eagle.core.function.v2x.internal.data.MarkerExploreWayItem -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerExploreWay -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerLocation -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerUserInfo +import com.mogo.eagle.core.function.v2x.internal.data.* import com.mogo.map.MogoMap import mogo.telematics.pad.MessagePad import roadwork.Road @@ -82,6 +79,9 @@ fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult = ) } } + val centerX = this.roadwork?.center?.point?.lon ?: 0.0 + val centerY = this.roadwork?.center?.point?.lat ?: 0.0 + val id = "${centerX}_${centerY}" l1.exploreWay = ArrayList().also { l2 -> l2.add(V2XMarkerExploreWay().also { l3 -> l3.poiType = this.roadwork?.poiType?.toString() @@ -95,17 +95,54 @@ fun Road.RW_PB.toRoadMarker(): V2XMarkerCardResult = l4.lat = p.lat l4.angle = this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0 } + l3.infoId = id + }) + } + + AiRoadMarker.receive( + AiRoadMarker.Marker(id, EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.poiType, + this.roadwork?.center?.point?.lat ?: 0.0, + this.roadwork?.center?.point?.lon ?: 0.0, + this.roadwork?.center?.road?.bearing?.toDouble() ?: 0.0, + ) + ) + } + +fun V2XRoadXData.toRoadMarker(): V2XMarkerCardResult = + V2XMarkerCardResult().also { l1 -> + this.polygon?.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.center?.lon ?: 0.0, this.center?.lat ?: 0.0)) + } + } + + l1.exploreWay = ArrayList().also { l2 -> + l2.add(V2XMarkerExploreWay().also { l3 -> + l3.poiType = this.poiType + l3.generateTime = this.detectTime ?: 0L + l3.location = V2XMarkerLocation().also { l4 -> + val p = MogoMap.getInstance().mogoMap.switchLonLat( + this.center?.lon ?: 0.0, + this.center?.lat ?: 0.0 + ) + l4.lon = p.lon + l4.lat = p.lat + l4.angle = this.centerRoad?.bearing ?: 0.0 + } + l3.infoId = this.index }) } 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 + this.index.toString(), + this.poiType ?: "", + this.center?.lat ?: 0.0, + this.center?.lon ?: 0.0, + this.centerRoad?.bearing ?: 0.0 ) ) } @@ -118,6 +155,7 @@ fun MessagePad.TrackedObject.toRoadMarker(poiType: String): V2XMarkerCardResult extra["gps_location"] = listOf(Pair(this.longitude, this.latitude)) } } + val id = "${this.longitude}_${this.latitude}" l1.exploreWay = ArrayList().also { l2 -> l2.add(V2XMarkerExploreWay().also { l3 -> l3.poiType = poiType @@ -129,11 +167,11 @@ fun MessagePad.TrackedObject.toRoadMarker(poiType: String): V2XMarkerCardResult l4.lat = p.lat l4.angle = this.heading } + l3.infoId = id }) } - - AiRoadMarker.receiveV2N( - AiRoadMarker.Marker(this.latitude, this.longitude, this.heading, null, null, null) + AiRoadMarker.receive( + AiRoadMarker.Marker(id, poiType, this.latitude, this.longitude, this.heading, null, null, null) ) } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/V2XManager.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/V2XManager.kt index 3d6f2ec152..8622fd1f21 100755 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/V2XManager.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/V2XManager.kt @@ -11,11 +11,11 @@ import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent import com.mogo.eagle.core.function.v2x.internal.http.V2XRefreshModel import com.mogo.eagle.core.function.v2x.internal.http.callback.IV2XRefreshCallback import com.mogo.eagle.core.function.v2x.internal.logger.Logger +import com.mogo.eagle.core.function.v2x.internal.socket.* import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_401012 import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_401018 import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_402000 import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_404000 -import com.mogo.eagle.core.function.v2x.internal.socket.V2XMessageListener_503000 import com.mogo.eagle.core.function.v2x.internal.utils.DistanceUtils import java.util.concurrent.CopyOnWriteArrayList import java.util.concurrent.atomic.AtomicBoolean @@ -131,7 +131,8 @@ object V2XManager { SocketManager.getInstance().registerOnMessageListener(401018, V2XMessageListener_401018(cbs)) SocketManager.getInstance().registerOnMessageListener(402000, V2XMessageListener_402000(cbs)) SocketManager.getInstance().registerOnMessageListener(404000, V2XMessageListener_404000(cbs)) - SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener_503000(cbs)) + //SocketManager.getInstance().registerOnMessageListener(503000, V2XMessageListener_503000(cbs)) + SocketManager.getInstance().registerOnMessageListener(70001, V2XMessageListener_70001(cbs)) handler.post(refreshTask) } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/data/V2XRoadXEvent.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/data/V2XRoadXEvent.kt new file mode 100644 index 0000000000..2ff6735c39 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/data/V2XRoadXEvent.kt @@ -0,0 +1,57 @@ +package com.mogo.eagle.core.function.v2x.internal.data + +import androidx.annotation.Keep + + +@Keep +data class V2XRoadXData( + val poiType: String? = null, + val center: Point? = null, + val centerRoad: CenterRoad? = null, + val congestionLanes: List? = null, + val coordinateType: Int? = -1, + val id: String? = null, + val index: String? = null, + val obstacles: List? = null, + val polygon: List? = null, + val type: Int? = 0, + val detectTime: Long? = 0L +) + +@Keep +data class CenterRoad( + val bearing: Double? = 0.0, + val laneNo: Int? = null, + val roadId: String? = null, + val roadName: String? = null, + val tileId: Int? = 0 +) + +@Keep +data class Congestion( + val laneId: Int? = null, + val level: Int? = null +) + +@Keep +data class Obstacle( + val boundBox: List? = null, + val center: Point? = null, + val id: Int? = null, + val polygon: List? = null, + val score: Double? = null, + val type: Int? = null +) + + +@Keep +data class Point( + val lon: Double? = null, + val lat: Double? = null +) + +@Keep +data class PointX( + val x: Double? = null, + val y: Double? = null +) \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/event/V2XEvent.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/event/V2XEvent.kt index 5743940cfd..40bf0b65c4 100644 --- a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/event/V2XEvent.kt +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/event/V2XEvent.kt @@ -1,10 +1,6 @@ package com.mogo.eagle.core.function.v2x.internal.event -import com.mogo.eagle.core.function.v2x.internal.data.V2XAdvanceWarning -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerCardResult -import com.mogo.eagle.core.function.v2x.internal.data.V2XMarkerResponse -import com.mogo.eagle.core.function.v2x.internal.data.V2XOptimalRoute -import com.mogo.eagle.core.function.v2x.internal.data.V2XWarningTarget +import com.mogo.eagle.core.function.v2x.internal.data.* import roadwork.Road.RW_PB sealed class V2XEvent { @@ -65,4 +61,15 @@ sealed class V2XEvent { return "Marker(data=$data)" } } + + + /** + * 长链-道路事件扩展数据结构 + */ + class RoadEventX(val type: Int = 70001, val data: V2XRoadXData): V2XEvent() { + + override fun toString(): String { + return "RoadEventX(type=$type, data=$data)" + } + } } diff --git a/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/socket/V2XMessageListener_70001.kt b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/socket/V2XMessageListener_70001.kt new file mode 100644 index 0000000000..cb1b9be044 --- /dev/null +++ b/core/function-impl/mogo-core-function-v2x/src/main/java/com/mogo/eagle/core/function/v2x/internal/socket/V2XMessageListener_70001.kt @@ -0,0 +1,27 @@ +package com.mogo.eagle.core.function.v2x.internal.socket + +import com.mogo.cloud.socket.IMogoCloudSocketOnMessageListener +import com.mogo.eagle.core.function.v2x.internal.V2XManager +import com.mogo.eagle.core.function.v2x.internal.callback.IV2XCallback +import com.mogo.eagle.core.function.v2x.internal.data.V2XRoadXData +import com.mogo.eagle.core.function.v2x.internal.event.V2XEvent +import com.mogo.eagle.core.function.v2x.internal.logger.Logger + +internal class V2XMessageListener_70001(val cbs: Iterable?): IMogoCloudSocketOnMessageListener { + + override fun target(msgType: Int): Class = V2XRoadXData::class.java + + override fun onMsgReceived(msgType: Int, data: V2XRoadXData?) { + if (msgType != 70001) { + return + } + if (data == null) { + Logger.i(V2XManager.TAG, "V2XMessageListener_70001:message is null!") + return + } + Logger.i(V2XManager.TAG, "V2XMessageListener_70001:$data") + cbs?.forEach { + it.onAck(V2XEvent.RoadEventX(data = data)) + } + } +} \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java index 1569fa8a1b..1359dd3e6b 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/config/CloudPoiManager.java @@ -44,7 +44,7 @@ public class CloudPoiManager { R.drawable.module_common_icon_map_marker_road_block_off2, R.drawable.module_common_icon_map_marker_road_block_off2_white, "封路")); poiWrapper.put(EventTypeEnumNew.FOURS_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_ROAD_WORK.getPoiType(), R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工")); - poiWrapper.put(EventTypeEnumNew.AI_ROAD_WORK.getPoiType(), new PoiWrapper(EventTypeEnumNew.AI_ROAD_WORK.getPoiType(), + poiWrapper.put(EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType(), new PoiWrapper(EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType(), R.drawable.module_common_icon_map_marker_road_work2, R.drawable.module_common_icon_map_marker_road_work2_white, "施工")); poiWrapper.put(EventTypeEnumNew.FOURS_BLOCK_UP.getPoiType(), new PoiWrapper(EventTypeEnumNew.FOURS_BLOCK_UP.getPoiType(), R.drawable.module_common_icon_map_marker_road_block_up2, R.drawable.module_common_icon_map_marker_road_block_up2_white, "拥堵")); diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt index 1422083e39..1b36458818 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/enums/EventTypeEnumNew.kt @@ -33,12 +33,6 @@ enum class EventTypeEnumNew( "注意施工占道", "注意施工占道" ), - //施工-AI云下发 - AI_ROAD_WORK( - "100061", "道路施工", "前方施工", R.drawable.icon_warning_v2x_road_construction, - "前方施工", "道路施工" - ), - //拥堵 FOURS_BLOCK_UP( "10007", "道路拥堵", "前方拥堵", R.drawable.icon_warning_v2x_congestion, @@ -466,6 +460,38 @@ enum class EventTypeEnumNew( ), //------------车内标牌 obu end --------------> + TYPE_SOCKET_ROAD_CONGESTION( + "10007", + "道路拥堵", + poiTypeSrcVr = R.drawable.v2x_icon_yongdu_vr, + content = "前方%s米交通拥堵", + tts = "前方%s米交通拥堵" + ), + + TYPE_SOCKET_ROAD_JINGZHI( + "10025", + "前方%s米静止障碍物占道", + poiTypeSrcVr = R.drawable.v2x_icon_jingzhi_zhangai, + content = "前方%s米静止障碍物占道", + tts = "前方%s米静止障碍物占道" + ), + + TYPE_SOCKET_ROAD_SHIGU( + "10013", + "前方%s米道路事故", + poiTypeSrcVr = R.drawable.v2x_icon_shigu_sanjiaopai, + content = "前方%s米道路事故", + tts = "前方%s米道路事故" + ), + + TYPE_SOCKET_ROAD_SHIGONG( + "100061", + "前方%米道路施工", + poiTypeSrcVr = R.drawable.v2x_icon_shigong_zhandao, + content = "前方%米道路施工", + tts = "前方%米道路施工" + ), + TYPE_ERROR( 0.toString(), "未知/错误/异常", @@ -492,7 +518,6 @@ enum class EventTypeEnumNew( TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStr ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStr FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStr - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStr FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStr FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStr FOURS_FOG.poiType -> FOURS_FOG.poiTypeStr @@ -514,7 +539,6 @@ enum class EventTypeEnumNew( TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeStrVr ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeStrVr FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeStrVr - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeStrVr FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeStrVr FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeStrVr FOURS_FOG.poiType -> FOURS_FOG.poiTypeStrVr @@ -536,7 +560,6 @@ enum class EventTypeEnumNew( TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.poiTypeSrcVr ROAD_CLOSED.poiType -> ROAD_CLOSED.poiTypeSrcVr FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.poiTypeSrcVr - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.poiTypeSrcVr FOURS_PONDING.poiType -> FOURS_PONDING.poiTypeSrcVr FOURS_FOG.poiType -> FOURS_FOG.poiTypeSrcVr @@ -558,7 +581,7 @@ enum class EventTypeEnumNew( fun getPoiTypeBg(poiType: String, isVrMode: Boolean): Int { return when (poiType) { FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType-> if (isVrMode) R.drawable.bg_v2x_event_type_orange_vr else R.drawable.bg_v2x_event_type_orange - TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, + TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> if (isVrMode) R.drawable.bg_v2x_event_type_red_vr else R.drawable.bg_v2x_event_type_read @@ -574,7 +597,7 @@ enum class EventTypeEnumNew( FOURS_BLOCK_UP.poiType, FOURS_LIVING.poiType -> R.drawable.bg_v2x_event_type_orange TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, - FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_PONDING.poiType, + FOURS_ROAD_WORK.poiType, FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, @@ -591,65 +614,40 @@ enum class EventTypeEnumNew( fun isRoadEvent(poiType: String?): Boolean { return when (poiType) { TRAFFIC_CHECK.poiType, ROAD_CLOSED.poiType, - FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType, + FOURS_ROAD_WORK.poiType, FOURS_BLOCK_UP.poiType, FOURS_PONDING.poiType, FOURS_FOG.poiType, FOURS_ICE.poiType, FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, - FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType, AI_ROAD_WORK.poiType -> true + FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType, + TYPE_SOCKET_ROAD_SHIGONG.poiType, + TYPE_SOCKET_ROAD_JINGZHI.poiType, + TYPE_SOCKET_ROAD_SHIGU.poiType, + TYPE_SOCKET_ROAD_CONGESTION.poiType -> true else -> false } } - /** - * 是否需要UGC预警 - */ - @JvmStatic - fun isNeedRoadEventUgc(poiType: String?): Boolean { - return when (poiType) { - ROAD_CLOSED.poiType, FOURS_ROAD_WORK.poiType, AI_ROAD_WORK.poiType, - FOURS_BLOCK_UP.poiType, FOURS_ACCIDENT.poiType, - FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, - FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, - FOURS_ACCIDENT_05.poiType, GHOST_PROBE.poiType -> true - else -> false - } - } - - @JvmStatic fun getTts(poiType: String?): String { return when (poiType) { TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.tts ROAD_CLOSED.poiType -> ROAD_CLOSED.tts FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.tts FOURS_PONDING.poiType -> FOURS_PONDING.tts FOURS_FOG.poiType -> FOURS_FOG.tts FOURS_ICE.poiType -> FOURS_ICE.tts FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.tts + TYPE_SOCKET_ROAD_SHIGONG.poiType -> TYPE_SOCKET_ROAD_SHIGONG.tts + TYPE_SOCKET_ROAD_JINGZHI.poiType -> TYPE_SOCKET_ROAD_JINGZHI.tts + TYPE_SOCKET_ROAD_SHIGU.poiType -> TYPE_SOCKET_ROAD_SHIGU.tts + TYPE_SOCKET_ROAD_CONGESTION.poiType -> TYPE_SOCKET_ROAD_CONGESTION.tts else -> "道路事件" } } - @JvmStatic - fun getTtsWithFeedback(poiType: String?): String { - return when (poiType) { - TRAFFIC_CHECK.poiType -> "交通检查" - ROAD_CLOSED.poiType -> "封路" - FOURS_ROAD_WORK.poiType -> "施工" - AI_ROAD_WORK.poiType -> "施工" - FOURS_BLOCK_UP.poiType -> "道路拥堵" - FOURS_PONDING.poiType -> "道路积水" - FOURS_FOG.poiType -> "出现浓雾" - FOURS_ICE.poiType -> "路面结冰" - FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, - FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" - else -> "道路事件" - } - } @JvmStatic fun getAlarmContent(poiType: String?): String { @@ -657,7 +655,6 @@ enum class EventTypeEnumNew( TRAFFIC_CHECK.poiType -> TRAFFIC_CHECK.content ROAD_CLOSED.poiType -> ROAD_CLOSED.content FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content FOURS_BLOCK_UP.poiType -> FOURS_BLOCK_UP.content FOURS_PONDING.poiType -> FOURS_PONDING.content FOURS_FOG.poiType -> FOURS_FOG.content @@ -666,63 +663,14 @@ enum class EventTypeEnumNew( FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> FOURS_ACCIDENT.content GHOST_PROBE.poiType -> GHOST_PROBE.content + TYPE_SOCKET_ROAD_SHIGONG.poiType -> TYPE_SOCKET_ROAD_SHIGONG.content + TYPE_SOCKET_ROAD_JINGZHI.poiType -> TYPE_SOCKET_ROAD_JINGZHI.content + TYPE_SOCKET_ROAD_SHIGU.poiType -> TYPE_SOCKET_ROAD_SHIGU.content + TYPE_SOCKET_ROAD_CONGESTION.poiType -> TYPE_SOCKET_ROAD_CONGESTION.content else -> "道路事件" } } - @JvmStatic - fun getTypeSmallRes(type: String): Int { - return when (type) { - TRAFFIC_CHECK.poiType -> - R.drawable.mogo_image_jiaotongjiancha_small - ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_small - FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small - AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_small - FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_small - FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_small - FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_small - FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_small - FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, - FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> - R.drawable.mogo_image_accident_small - else -> R.drawable.mogo_image_shishilukuang_small - } - } - - @JvmStatic - fun getTypeRes(type: String): Int { - return when (type) { - TRAFFIC_CHECK.poiType -> R.drawable.mogo_image_jiaotongjiancha_nor - ROAD_CLOSED.poiType -> R.drawable.mogo_image_fenglu_nor - FOURS_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor - AI_ROAD_WORK.poiType -> R.drawable.mogo_image_daolushigong_nor - FOURS_BLOCK_UP.poiType -> R.drawable.mogo_image_yongdu_nor - FOURS_PONDING.poiType -> R.drawable.mogo_image_jishui_nor - FOURS_ICE.poiType -> R.drawable.mogo_image_jiebing_nor - FOURS_FOG.poiType -> R.drawable.mogo_image_nongwu_nor - FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, - FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> - R.drawable.mogo_image_jiaotongshigu_nor - else -> R.drawable.mogo_image_shishlukuang_nor - } - } - - @JvmStatic - fun getTypeName(type: String?): String { - return when (type) { - ROAD_CLOSED.poiType -> "封路" - FOURS_ICE.poiType -> "道路结冰" - FOURS_FOG.poiType -> "浓雾" - TRAFFIC_CHECK.poiType -> "交通检查" - FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, - FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" - FOURS_BLOCK_UP.poiType -> "拥堵" - FOURS_ROAD_WORK.poiType -> "施工" - AI_ROAD_WORK.poiType -> "施工" - FOURS_PONDING.poiType -> "道路积水" - else -> "实时路况" - } - } @JvmStatic fun getMarker3DRes(poiType: String?): Int { @@ -733,31 +681,17 @@ enum class EventTypeEnumNew( FOURS_FOG.poiType -> R.raw.v2x_nongwu TRAFFIC_CHECK.poiType -> R.raw.v2x_jiaotongjiancha FOURS_ROAD_WORK.poiType -> R.raw.v2x_daolushigong - AI_ROAD_WORK.poiType -> R.raw.v2x_daolushigong FOURS_ICE.poiType -> R.raw.v2x_daolujiebing FOURS_PONDING.poiType -> R.raw.v2x_daolujishui GHOST_PROBE.poiType -> R.raw.v2x_guzhangqiuzhu + TYPE_SOCKET_ROAD_SHIGONG.poiType -> R.raw.v2x_shigong_warning + TYPE_SOCKET_ROAD_JINGZHI.poiType -> R.raw.v2x_zhangai + TYPE_SOCKET_ROAD_SHIGU.poiType -> R.raw.v2x_shigu_sanjiaopai + TYPE_SOCKET_ROAD_CONGESTION.poiType -> R.raw.v2x_yongdu else -> 0 } } - @JvmStatic - fun getTypeNameTTS(type: String?): String { - return when (type) { - ROAD_CLOSED.poiType -> "封路" - FOURS_ICE.poiType -> "道路结冰" - FOURS_FOG.poiType -> "浓雾" - TRAFFIC_CHECK.poiType -> "交通检查" - FOURS_ACCIDENT.poiType, FOURS_ACCIDENT_01.poiType, FOURS_ACCIDENT_02.poiType, - FOURS_ACCIDENT_03.poiType, FOURS_ACCIDENT_04.poiType, FOURS_ACCIDENT_05.poiType -> "交通事故" - FOURS_BLOCK_UP.poiType -> "拥堵" - FOURS_ROAD_WORK.poiType -> "施工" - AI_ROAD_WORK.poiType -> "施工" - FOURS_PONDING.poiType -> "道路积水" - else -> "实时路况" - } - } - @JvmStatic fun getUpdateIconRes(poiType: String?): Int { return when (poiType) { @@ -773,10 +707,10 @@ enum class EventTypeEnumNew( FOURS_ROAD_WORK.poiType -> { R.drawable.icon_warning_v2x_road_construction } - //AI施工 - AI_ROAD_WORK.poiType -> { - R.drawable.icon_warning_v2x_road_construction - } + TYPE_SOCKET_ROAD_SHIGONG.poiType -> R.drawable.icon_warning_v2x_road_construction + TYPE_SOCKET_ROAD_JINGZHI.poiType -> R.drawable.v2x_icon_jingzhi_zhangai + TYPE_SOCKET_ROAD_SHIGU.poiType -> R.drawable.v2x_icon_shigu_sanjiaopai + TYPE_SOCKET_ROAD_CONGESTION.poiType -> R.drawable.v2x_icon_yongdu_vr //拥堵 FOURS_BLOCK_UP.poiType -> { R.drawable.icon_warning_v2x_congestion @@ -939,7 +873,10 @@ enum class EventTypeEnumNew( TYPE_ERROR.poiType -> TYPE_ERROR.poiTypeSrcVr TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.poiTypeSrcVr GHOST_PROBE.poiType -> GHOST_PROBE.poiTypeSrcVr - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.poiTypeSrcVr + TYPE_SOCKET_ROAD_SHIGONG.poiType -> TYPE_SOCKET_ROAD_SHIGONG.poiTypeSrcVr + TYPE_SOCKET_ROAD_JINGZHI.poiType -> TYPE_SOCKET_ROAD_JINGZHI.poiTypeSrcVr + TYPE_SOCKET_ROAD_SHIGU.poiType -> TYPE_SOCKET_ROAD_SHIGU.poiTypeSrcVr + TYPE_SOCKET_ROAD_CONGESTION.poiType -> TYPE_SOCKET_ROAD_CONGESTION.poiTypeSrcVr TYPE_USECASE_ID_IVP_RED.poiType -> TYPE_USECASE_ID_IVP_RED.poiTypeSrcVr TYPE_USECASE_ID_IVP_GREEN.poiType -> TYPE_USECASE_ID_IVP_GREEN.poiTypeSrcVr @@ -999,7 +936,10 @@ enum class EventTypeEnumNew( TYPE_VIP_IDENTIFICATION_PASS.poiType -> TYPE_VIP_IDENTIFICATION_PASS.content TYPE_VIP_IDENTIFICATION_EXTEND.poiType -> TYPE_VIP_IDENTIFICATION_EXTEND.content FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.content - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.content + TYPE_SOCKET_ROAD_SHIGONG.poiType -> TYPE_SOCKET_ROAD_SHIGONG.content + TYPE_SOCKET_ROAD_JINGZHI.poiType -> TYPE_SOCKET_ROAD_JINGZHI.content + TYPE_SOCKET_ROAD_SHIGU.poiType -> TYPE_SOCKET_ROAD_SHIGU.content + TYPE_SOCKET_ROAD_CONGESTION.poiType -> TYPE_SOCKET_ROAD_CONGESTION.content TYPE_ERROR.poiType -> TYPE_ERROR.content TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.content GHOST_PROBE.poiType -> GHOST_PROBE.content @@ -1063,7 +1003,10 @@ enum class EventTypeEnumNew( TYPE_VIP_IDENTIFICATION_PASS.poiType -> TYPE_VIP_IDENTIFICATION_PASS.tts TYPE_VIP_IDENTIFICATION_EXTEND.poiType -> TYPE_VIP_IDENTIFICATION_EXTEND.tts FOURS_ROAD_WORK.poiType -> FOURS_ROAD_WORK.tts - AI_ROAD_WORK.poiType -> AI_ROAD_WORK.tts + TYPE_SOCKET_ROAD_SHIGONG.poiType -> TYPE_SOCKET_ROAD_SHIGONG.tts + TYPE_SOCKET_ROAD_JINGZHI.poiType -> TYPE_SOCKET_ROAD_JINGZHI.tts + TYPE_SOCKET_ROAD_SHIGU.poiType -> TYPE_SOCKET_ROAD_SHIGU.tts + TYPE_SOCKET_ROAD_CONGESTION.poiType -> TYPE_SOCKET_ROAD_CONGESTION.tts TYPE_ERROR.poiType -> TYPE_ERROR.tts TYPE_OPTIMAL_ROUTE_RECOMMEND.poiType -> TYPE_OPTIMAL_ROUTE_RECOMMEND.tts GHOST_PROBE.poiType -> GHOST_PROBE.tts @@ -1110,6 +1053,16 @@ enum class EventTypeEnumNew( else -> TYPE_ERROR.tts } } - } + @JvmStatic + fun isCloudSocketEvent(poiType: String?): Boolean { + return when(poiType) { + TYPE_SOCKET_ROAD_SHIGONG.poiType, + TYPE_SOCKET_ROAD_JINGZHI.poiType, + TYPE_SOCKET_ROAD_SHIGU.poiType, + TYPE_SOCKET_ROAD_CONGESTION.poiType -> true + else -> false + } + } + } } \ No newline at end of file diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java index 2aba9f30fc..096016b387 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/map/entity/V2XRoadEventEntity.java @@ -71,16 +71,6 @@ public class V2XRoadEventEntity implements Serializable { return tts; } - /** - * 检测到附近#道路施工#,确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。 - */ - public String getTtsWithFeedback() { - tts = "检测到附近"; - tts += EventTypeEnumNew.getTtsWithFeedback(getPoiType()); - tts += ",确认该信息是否正确?您可以说“正确”或“错误”帮助其他车友。"; - return tts; - } - public String getTts() { return tts; } diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_jingzhi_zhangai.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_jingzhi_zhangai.png new file mode 100644 index 0000000000..c5e2711db3 Binary files /dev/null and b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_jingzhi_zhangai.png differ diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_shigong_zhandao.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_shigong_zhandao.png new file mode 100644 index 0000000000..0a21b49728 Binary files /dev/null and b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_shigong_zhandao.png differ diff --git a/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_shigu_sanjiaopai.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_shigu_sanjiaopai.png new file mode 100644 index 0000000000..10e3accd56 Binary files /dev/null and b/core/mogo-core-res/src/main/res/drawable-xhdpi/v2x_icon_shigu_sanjiaopai.png differ diff --git a/core/mogo-core-res/src/main/res/raw/v2x_shigu_sanjiaopai.nt3d b/core/mogo-core-res/src/main/res/raw/v2x_shigu_sanjiaopai.nt3d new file mode 100644 index 0000000000..79c8df21ad Binary files /dev/null and b/core/mogo-core-res/src/main/res/raw/v2x_shigu_sanjiaopai.nt3d differ diff --git a/core/mogo-core-res/src/main/res/raw/v2x_zhangai.nt3d b/core/mogo-core-res/src/main/res/raw/v2x_zhangai.nt3d new file mode 100644 index 0000000000..a5a7d00b5f Binary files /dev/null and b/core/mogo-core-res/src/main/res/raw/v2x_zhangai.nt3d differ