From 5fd9fec0c661669ca45e726707601cc38146d54d Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 31 Mar 2021 12:27:35 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A03D=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E8=B5=84=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/v2x/scenario/scene/warning/V2XWarningMarker.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index ba46da31b6..127f3353a2 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -48,8 +48,7 @@ public class V2XWarningMarker implements IV2XMarker { .latitude(markerShowEntity.getMarkerLocation().getLat()) .longitude(markerShowEntity.getMarkerLocation().getLon()); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); - Bitmap bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.v2x_road_front_p_warning); - options.icon(bitmap); + options.icon3DRes(com.mogo.module.service.R.raw.people); IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); iMarkerView.setMarker(marker); marker.setToTop(); From aef0349f247b443adb30196913464dc8dcd3c146 Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 31 Mar 2021 13:27:15 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=A1=A5=E9=BD=90,?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=95=B0=E6=8D=AE=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/entity/V2XWarningEntity.java | 115 +++++++++++++----- .../scene/warning/V2XWarningMarker.java | 1 + .../scene/warning/V2XWarningWindow.java | 2 +- .../res/raw/scenario_warning_event_data.json | 10 +- 4 files changed, 96 insertions(+), 32 deletions(-) diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java index 0231d8fa6b..01665c64f1 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWarningEntity.java @@ -14,7 +14,9 @@ public class V2XWarningEntity implements Serializable { //目标物位置 private double lat; private double lon; - //距离 + //目标物颜色 + public String targetColor; + //目标物距离 private double distance; //预测碰撞点位置 private double collisionLat; @@ -28,9 +30,30 @@ public class V2XWarningEntity implements Serializable { //停止线经纬度 private double stopLineLat; private double stopLineLon; - + //自车到停止线距离 + private double stopLineDistance; + //道路唯一标识 + public String roadId; + //车道唯一标识 + public String laneId; + //识别物体唯一标识 + public String uuid; + //红绿灯颜色 + public String color; + //车ID 暂不使用 + public String carId; //预警文案 - private String tipContent; + private String warningContent; + //车头朝向 + public double heading; + //系统时间 暂时没用 + public long systemTime; + //定位卫星时间 暂时没用 + public long satelliteTime; + //莫顿码 暂时没用 + public long mortonCode; + + //自组字段 //tts播报 private String tts; //打点位置 @@ -54,15 +77,15 @@ public class V2XWarningEntity implements Serializable { public void setTipContent(int type) { switch (type) { case 0: - this.tipContent = "行人碰撞预警"; + this.warningContent = "行人碰撞预警"; break; case 1: case 3: case 4: - this.tipContent = "前车碰撞预警"; + this.warningContent = "前车碰撞预警"; break; case 2: - this.tipContent = "摩托车碰撞预警"; + this.warningContent = "摩托车碰撞预警"; break; default: break; @@ -121,6 +144,10 @@ public class V2XWarningEntity implements Serializable { this.direction = direction; } + public void setTts(String tts) { + this.tts = tts; + } + public void setSpeed(float speed) { this.speed = speed; } @@ -129,7 +156,6 @@ public class V2XWarningEntity implements Serializable { return type; } - public double getLat() { return lat; } @@ -150,7 +176,6 @@ public class V2XWarningEntity implements Serializable { return distance; } - public double getAngle() { return angle; } @@ -163,13 +188,54 @@ public class V2XWarningEntity implements Serializable { return speed; } - public String getTipContent() { - if (this.tipContent == null) { + public String getTargetColor() { + return targetColor; + } + + public String getRoadId() { + return roadId; + } + + public String getLaneId() { + return laneId; + } + + public String getUuid() { + return uuid; + } + + public String getColor() { + return color; + } + + public String getCarId() { + return carId; + } + + public String getWarningContent() { + if (this.warningContent == null) { setTipContent(type); } - return tipContent; + return warningContent; } + public double getHeading() { + return heading; + } + + public long getSystemTime() { + return systemTime; + } + + public long getSatelliteTime() { + return satelliteTime; + } + + public long getMortonCode() { + return mortonCode; + } + + public String getTts() { if (tts == null) { setTts(type); @@ -177,22 +243,6 @@ public class V2XWarningEntity implements Serializable { return tts; } - public void setStopLineLat(double stopLineLat) { - this.stopLineLat = stopLineLat; - } - - public void setStopLineLon(double stopLineLon) { - this.stopLineLon = stopLineLon; - } - - public void setTipContent(String tipContent) { - this.tipContent = tipContent; - } - - public void setTts(String tts) { - this.tts = tts; - } - public double getStopLineLat() { return stopLineLat; } @@ -215,9 +265,18 @@ public class V2XWarningEntity implements Serializable { ", speed=" + speed + ", stopLineLat=" + stopLineLat + ", stopLineLon=" + stopLineLon + - ", tipContent='" + tipContent + '\'' + + ", roadId='" + roadId + '\'' + + ", laneId='" + laneId + '\'' + + ", uuid='" + uuid + '\'' + + ", color='" + color + '\'' + + ", carId='" + carId + '\'' + + ", warningContent='" + warningContent + '\'' + ", tts='" + tts + '\'' + ", location=" + location + + ", heading=" + heading + + ", systemTime=" + systemTime + + ", satelliteTime=" + satelliteTime + + ", mortonCode=" + mortonCode + '}'; } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index 127f3353a2..f636f2c83f 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -49,6 +49,7 @@ public class V2XWarningMarker implements IV2XMarker { .longitude(markerShowEntity.getMarkerLocation().getLon()); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); options.icon3DRes(com.mogo.module.service.R.raw.people); + options.anchorColor("#DC143C"); IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); iMarkerView.setMarker(marker); marker.setToTop(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java index 4b609c7777..5e090685fb 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java @@ -75,7 +75,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { break; } distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "米"); - warningTextView.setText(mV2XWarningEntity.getTipContent()); + warningTextView.setText(mV2XWarningEntity.getWarningContent()); AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts()); } if (runnableV2XEvent == null) { diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index 5e70ce79e8..edec36bc85 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -1,6 +1,5 @@ { "type":0, - "targetType": "1", "lat":39.977121, "lon":116.417537, "distance": 2.22, @@ -9,6 +8,11 @@ "from": 1, "angle": 120, "direction": 10014, - "speed":11.108121 - + "speed":11.108121, + "targetColor": "#D8BFD8", + "stopLineDistance":20, + "stopLineLat": 39.977123, + "stopLineLon": 116.417537, + "warningContent": "小新行人", + "heading": 30 } \ No newline at end of file From aaced2d740dfa75ab4328615fd883c87cf8c1868 Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 31 Mar 2021 14:49:00 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=94=BB=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scene/warning/V2XWarningMarker.java | 36 +++++++++++++------ .../scene/warning/V2XWarningWindow.java | 3 +- .../res/raw/scenario_warning_event_data.json | 12 +++---- .../com/mogo/service/impl/v2x/V2XManager.java | 4 +-- 4 files changed, 36 insertions(+), 19 deletions(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index f636f2c83f..912903e282 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -1,10 +1,7 @@ package com.mogo.module.v2x.scenario.scene.warning; import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; - -import com.mogo.commons.AbsMogoApplication; +import com.mogo.map.MogoLatLng; import com.mogo.map.marker.IMogoMarker; import com.mogo.map.marker.MogoMarkerOptions; import com.mogo.module.common.MogoApisHandler; @@ -13,9 +10,9 @@ import com.mogo.module.common.drawer.marker.MapMarkerAdapter; import com.mogo.module.common.entity.MarkerLocation; import com.mogo.module.common.entity.MarkerShowEntity; import com.mogo.module.common.entity.V2XWarningEntity; -import com.mogo.module.v2x.R; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; +import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.scenario.view.IV2XMarker; import com.mogo.utils.WorkThreadHandler; @@ -41,7 +38,7 @@ public class V2XWarningMarker implements IV2XMarker { markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER); if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER); + clearPOI(); WorkThreadHandler.getInstance().postDelayed(() -> { MogoMarkerOptions options = new MogoMarkerOptions() .object(markerShowEntity) @@ -49,11 +46,17 @@ public class V2XWarningMarker implements IV2XMarker { .longitude(markerShowEntity.getMarkerLocation().getLon()); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); options.icon3DRes(com.mogo.module.service.R.raw.people); - options.anchorColor("#DC143C"); + options.anchorColor(mMarkerEntity.getTargetColor()); IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); iMarkerView.setMarker(marker); marker.setToTop(); - }, 1000); + }, 0); + + //如果有预警碰撞点,识别物与预警碰撞点之间连线,并执行平移动画 + if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() != 0) { + drawLine(); + smooth(); + } } else { } @@ -63,8 +66,21 @@ public class V2XWarningMarker implements IV2XMarker { } - @Override - public void clearPOI() { + public void drawLine() { + DrawLineInfo drawLineInfo = new DrawLineInfo(); + MogoLatLng slatLng = new MogoLatLng(mMarkerEntity.getLat(), mMarkerEntity.getLon()); + MogoLatLng endLatLng = new MogoLatLng(mMarkerEntity.getCollisionLat(), mMarkerEntity.getCollisionLon()); + drawLineInfo.setStartLocation(slatLng); + drawLineInfo.setEndLocation(endLatLng); + V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, drawLineInfo); + } + + public void smooth() { } + + @Override + public void clearPOI() { + V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER); + } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java index 5e090685fb..3983091eaf 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningWindow.java @@ -69,7 +69,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { break; case 1: case 2: - typeImage.setImageResource(R.drawable.v2x_road_front_p_warning); + typeImage.setImageResource(R.drawable.v2x_road_front_m_warning); break; default: break; @@ -78,6 +78,7 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow { warningTextView.setText(mV2XWarningEntity.getWarningContent()); AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts()); } + //3秒后移除提示弹框 if (runnableV2XEvent == null) { runnableV2XEvent = () -> { EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER; diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index edec36bc85..7467cf488c 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -1,18 +1,18 @@ { "type":0, - "lat":39.977121, - "lon":116.417537, + "lat":39.977113, + "lon":116.417457, "distance": 2.22, - "collisionLat": 39.9760799115429, - "collisionLon": 116.411360351446, + "collisionLat": 39.977139, + "collisionLon": 116.417607, "from": 1, "angle": 120, "direction": 10014, "speed":11.108121, - "targetColor": "#D8BFD8", + "targetColor": "#FF4040", "stopLineDistance":20, "stopLineLat": 39.977123, "stopLineLon": 116.417537, - "warningContent": "小新行人", + "warningContent": "小心行人", "heading": 30 } \ No newline at end of file diff --git a/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java b/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java index d27ca128e8..7b7c867a67 100644 --- a/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java +++ b/services/mogo-service/src/main/java/com/mogo/service/impl/v2x/V2XManager.java @@ -29,11 +29,11 @@ public class V2XManager implements IV2XProvider { @Override public void registerIntentListener(String intent, IV2XListener listener) { if (listener == null || intent == null) { - Log.d("V2XManager","listener == null || intent == null"); + Log.d("V2XManager", "listener == null || intent == null"); return; } if (!mListeners.containsKey(intent)) { - Log.d("V2XManager","intent=="+intent+"listener"+listener); + Log.d("V2XManager", "intent==" + intent + "listener" + listener); mListeners.put(intent, new CopyOnWriteArrayList<>()); } mListeners.get(intent).add(listener); From 2f1437842cdb8cbe17ce21b4e720f9505791ed9d Mon Sep 17 00:00:00 2001 From: liujing Date: Wed, 31 Mar 2021 15:03:32 +0800 Subject: [PATCH 4/8] =?UTF-8?q?[add]=20=E4=BA=91=E4=B8=8B=E5=8F=91?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9B=91=E5=90=AC=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../listener/V2XMessageListener_401013.java | 21 +++++++++++++++++++ .../scene/warning/V2XWarningMarker.java | 2 +- .../res/raw/scenario_warning_event_data.json | 8 +++---- 3 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401013.java diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401013.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401013.java new file mode 100644 index 0000000000..a197aa0819 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401013.java @@ -0,0 +1,21 @@ +package com.mogo.module.v2x.listener; + +import com.mogo.module.common.entity.V2XWarningEntity; +import com.mogo.service.connection.IMogoOnMessageListener; + +/** + * @author liujing + * @description 车路云—场景预警-云下发数据监听 前车/行人/摩托车/盲区碰撞预警 + * @since: 2021/3/31 + */ +public class V2XMessageListener_401013 implements IMogoOnMessageListener { + @Override + public Class target() { + return null; + } + + @Override + public void onMsgReceived(V2XWarningEntity obj) { + + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index 912903e282..d458a1195a 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -46,7 +46,7 @@ public class V2XWarningMarker implements IV2XMarker { .longitude(markerShowEntity.getMarkerLocation().getLon()); IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options); options.icon3DRes(com.mogo.module.service.R.raw.people); - options.anchorColor(mMarkerEntity.getTargetColor()); + options.anchorColor("#FF4040"); IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options); iMarkerView.setMarker(marker); marker.setToTop(); diff --git a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json index 7467cf488c..d514923ffe 100644 --- a/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json +++ b/modules/mogo-module-v2x/src/main/res/raw/scenario_warning_event_data.json @@ -1,10 +1,10 @@ { "type":0, - "lat":39.977113, - "lon":116.417457, + "lat":39.977148, + "lon":116.417478, "distance": 2.22, - "collisionLat": 39.977139, - "collisionLon": 116.417607, + "collisionLat": 39.977131, + "collisionLon": 116.417741, "from": 1, "angle": 120, "direction": 10014, From 7290d41b2b72239796cec1a87dee59508f9d799b Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 31 Mar 2021 15:48:49 +0800 Subject: [PATCH 5/8] opt --- .../zhidao/roadcondition/net/HttpClient.kt | 1 - .../mogo/module/v2x/MoGoV2XServicePaths.java | 6 ++ .../java/com/mogo/module/v2x/V2XConst.java | 5 + .../mogo/module/v2x/V2XModuleProvider.java | 2 +- .../mogo/module/v2x/V2XServiceManager.java | 12 +++ .../com/mogo/module/v2x/V2XWaringManager.java | 16 ++- .../v2x/entity/model/CloundWarningInfo.java | 4 +- .../IMoGoPersonWarnPolylineManager.java | 27 +++++ .../v2x/manager/IMoGoWarnPolylineManager.java | 2 +- .../impl/MoGoPersonWarnPolylineManager.java | 84 ++++++++++++++++ .../impl/MoGoV2XCloundDataManager.java | 99 +++++++++++++++---- .../manager/impl/MoGoWarnPolylineManager.java | 5 +- .../receiver/AdasDataBroadcastReceiver.java | 4 +- .../v2x/receiver/SceneBroadcastReceiver.java | 1 - 14 files changed, 229 insertions(+), 39 deletions(-) create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoPersonWarnPolylineManager.java create mode 100644 modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java diff --git a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt index 81d6b3bac9..376c6dd254 100644 --- a/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt +++ b/libraries/tanlulib/src/main/java/com/zhidao/roadcondition/net/HttpClient.kt @@ -80,7 +80,6 @@ class HttpClient private constructor(baseUrl: String) { if (httpDns != null) { builder.dns(Dns { hostname: String? -> val addresses = httpDns.lookup(hostname) -// Log.d("liyz", "addresses 1 = $addresses") if (addresses != null && !addresses.isEmpty()) { return@Dns addresses } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/MoGoV2XServicePaths.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/MoGoV2XServicePaths.java index 6fe683f7e8..483ac4e448 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/MoGoV2XServicePaths.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/MoGoV2XServicePaths.java @@ -37,6 +37,12 @@ public class MoGoV2XServicePaths { @Keep public static final String PATH_V2X_WARN_POLYLINE_MANAGER = "/v2xWarnPolylineManager/api"; + /** + * V2X 二轮车和行人连接线 + */ + @Keep + public static final String PATH_V2X_PERSON_WARN_POLYLINE_MANAGER = "/v2xPersonWarnPolylineManager/api"; + /** * V2X 云端数据处理 */ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java index a610ab58d9..4d03e6cf94 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java @@ -145,4 +145,9 @@ public class V2XConst { * */ public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER"; + /** + * V2X预警日志tag + */ + public static final String LOG_NAME_WARN = "liyz"; + } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java index 417e971ee9..f6178c986d 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java @@ -303,7 +303,7 @@ public class V2XModuleProvider implements V2XServiceManager.getV2XMarkerService().startAutoRefresh(); // 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随 V2XServiceManager.getMapUIController().recoverLockMode(); - Log.d("liyz", "V2XModuleProvider ------> "); + Log.d(V2XConst.LOG_NAME_WARN, "V2XModuleProvider ------> "); //注册adas数据通道 V2XWaringManager.getInstance().registerAdasSocketMessage(mContext); } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java index 1622399387..2df6f55679 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XServiceManager.java @@ -16,6 +16,7 @@ import com.mogo.module.common.MogoApisHandler; import com.mogo.module.common.drawer.AdasRecognizedResultDrawer; import com.mogo.module.service.MarkerServiceHandler; import com.mogo.module.v2x.alarm.V2XCalculateServer; +import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager; import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager; import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager; import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager; @@ -112,6 +113,7 @@ public class V2XServiceManager { private static IMoGoV2XPolylineManager moGoV2XPolylineManager; private static IMoGoV2XStatusManager moGoV2XStatusManager; private static IMoGoWarnPolylineManager moGoWarnPolylineManager; + private static IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager; private static IMoGoV2XCloundDataManager moGoV2XCloundDataManager; private V2XServiceManager() { @@ -167,6 +169,7 @@ public class V2XServiceManager { moGoV2XPolylineManager = (IMoGoV2XPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context); moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context); moGoV2XCloundDataManager = (IMoGoV2XCloundDataManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER).navigation(context); + moGoPersonWarnPolylineManager = (IMoGoPersonWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER).navigation(context); moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context); } @@ -339,4 +342,13 @@ public class V2XServiceManager { public static void setMoGoV2XCloundDataManager(IMoGoV2XCloundDataManager moGoV2XCloundDataManager) { V2XServiceManager.moGoV2XCloundDataManager = moGoV2XCloundDataManager; } + + public static IMoGoPersonWarnPolylineManager getMoGoPersonWarnPolylineManager() { + return moGoPersonWarnPolylineManager; + } + + public static void setMoGoPersonWarnPolylineManager(IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager) { + V2XServiceManager.moGoPersonWarnPolylineManager = moGoPersonWarnPolylineManager; + } + } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java index 38682e7778..a5b28a5b8b 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java @@ -24,7 +24,6 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext; public class V2XWaringManager { List lonLats = new ArrayList<>(); - List resultList = new ArrayList<>(); private Context mContext; private static V2XWaringManager mV2XWaringManager; @@ -51,7 +50,7 @@ public class V2XWaringManager { * 注册长链接消息处理 */ public void registerAdasSocketMessage(Context context) { - Logger.d("liyz", "开始注册Socket通道...."); + Logger.d(V2XConst.LOG_NAME_WARN, "开始注册Socket通道...."); mContext = context; //根据云端,绘制自车和交点,以及行人或二轮车与交点的绘制 @@ -64,7 +63,7 @@ public class V2XWaringManager { * 反注册消息通道,不再进行接受 */ public void unregisterAdasSocketMessage() { - Logger.w("liyz", "反注册Socket通道...."); + Logger.w(V2XConst.LOG_NAME_WARN, "反注册Socket通道...."); if (v2XWarnMessageListener != null) { V2XServiceManager .getMoGoSocketManager() @@ -94,9 +93,7 @@ public class V2XWaringManager { * 处理adas返回的数据 */ private void handleAdasData() { - Log.d("liyz", "V2XWaringManager ---- handleAdasData ---0-- "); - //清理 - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + Log.d(V2XConst.LOG_NAME_WARN, "V2XWaringManager ---- handleAdasData "); // 绘制连接线 TODO 来的是列表数据 DrawLineInfo info1 = new DrawLineInfo(); @@ -104,13 +101,12 @@ public class V2XWaringManager { MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821); info1.setStartLocation(startLatlng1); info1.setEndLocation(endLatlng1); - V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1); + V2XServiceManager.getMoGoWarnPolylineManager().drawaWarnPolyline(getContext(), info1); // adas 每隔一秒传递的他车或行人数据 V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> { // 绘制近景识别到的车辆,行人和二轮车 TODO AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList ); - Log.d("liyz", "V2XWaringManager ---- handleAdasData ----- "); //清理 V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); @@ -121,7 +117,7 @@ public class V2XWaringManager { MogoLatLng endLatlng = new MogoLatLng(39.971089,116.407384); info.setStartLocation(startLatlng); info.setEndLocation(endLatlng); - V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, info); + V2XServiceManager.getMoGoWarnPolylineManager().drawaWarnPolyline(mContext, info); //更新数据 for (ADASRecognizedResult result : resultList) { @@ -135,7 +131,7 @@ public class V2XWaringManager { double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(); - Log.d("liyz", "lon = " + lon + "----lat = " + lat); + Log.d(V2XConst.LOG_NAME_WARN, "lon = " + lon + "----lat = " + lat); //绘制自车数据 liyz // DrawLineInfo info = new DrawLineInfo(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/CloundWarningInfo.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/CloundWarningInfo.java index 240c9a269a..cf0c398f82 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/CloundWarningInfo.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/model/CloundWarningInfo.java @@ -58,12 +58,12 @@ public class CloundWarningInfo { /** * 识别物经纬度 * */ - private MogoLatLng startLocation; + public MogoLatLng startLocation; /** * 行人经纬度交点 */ - private MogoLatLng endLocation; + public MogoLatLng endLocation; /** * 停止线的纬度 diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoPersonWarnPolylineManager.java new file mode 100644 index 0000000000..777d1257fa --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoPersonWarnPolylineManager.java @@ -0,0 +1,27 @@ +package com.mogo.module.v2x.manager; + +import android.content.Context; + +import com.alibaba.android.arouter.facade.template.IProvider; +import com.mogo.map.overlay.IMogoPolyline; +import com.mogo.module.v2x.entity.model.DrawLineInfo; + +/** + * 绘制可变宽度和渐变的线, + */ +public interface IMoGoPersonWarnPolylineManager extends IProvider { + /** + * 绘制连接线,人物和二轮车 + * + * @param context + * @param info + */ + void drawPersonWarnPolyline(Context context, DrawLineInfo info); + + /** + * 移除连接线 + */ + void clearLine(); + + IMogoPolyline getMogoPersonWarnPolyline(); +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java index fbdd452138..8d3eaa1530 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java @@ -18,7 +18,7 @@ public interface IMoGoWarnPolylineManager extends IProvider { * @param context * @param info */ - void drawableWarnPolyline(Context context, DrawLineInfo info); + void drawaWarnPolyline(Context context, DrawLineInfo info); /** * 移除连接线 diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java new file mode 100644 index 0000000000..d3f7269187 --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java @@ -0,0 +1,84 @@ +package com.mogo.module.v2x.manager.impl; + +import android.content.Context; +import android.util.Log; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.map.overlay.IMogoPolyline; +import com.mogo.map.overlay.MogoPolylineOptions; +import com.mogo.module.v2x.MoGoV2XServicePaths; +import com.mogo.module.v2x.V2XConst; +import com.mogo.module.v2x.V2XServiceManager; +import com.mogo.module.v2x.entity.model.DrawLineInfo; +import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager; +import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager; + +import java.util.ArrayList; +import java.util.List; + +/** + * 当前车辆与道路事件的连接线 + */ +@Route(path = MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER) +public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineManager { + private static IMogoPolyline mMogoPolyline; + + + @Override + public void drawPersonWarnPolyline(Context context, DrawLineInfo info) { + try { + if (mMogoPolyline != null) { + mMogoPolyline.remove(); + } + + // 连接线参数 + MogoPolylineOptions options = new MogoPolylineOptions(); + + // 渐变色 + List colors = new ArrayList<>(); + + if (info.getType().equals("1")) { //预警 TODO + colors.add(0xFFFFA31A); + colors.add(0xFFFFA31A); + } else { + colors.add(0xFFE32F46); + colors.add(0xFFE32F46); + } + + // 线条粗细,渐变,渐变色值 + options.width(60).useGradient(true).colorValues(colors); + // 当前车辆位置 + options.add(info.getStartLocation()); + // 目标车辆位置 + options.add(info.getEndLocation()); + + // 绘制线的对象 + mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); + Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager drawableWarnPolyline -----> "); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void clearLine() { + if (mMogoPolyline != null) { + mMogoPolyline.remove(); + mMogoPolyline = null; + } + } + + @Override + public void init(Context context) { + + } + + /** + * @return 绘制连接线的对象 + */ + @Override + public IMogoPolyline getMogoPersonWarnPolyline() { + return mMogoPolyline; + } +} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java index 72631d7481..f431cd20b2 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java @@ -1,23 +1,31 @@ package com.mogo.module.v2x.manager.impl; import android.content.Context; +import android.location.Location; +import android.util.Log; import com.alibaba.android.arouter.facade.annotation.Route; import com.mogo.map.MogoLatLng; +import com.mogo.map.navi.IMogoCarLocationChangedListener2; +import com.mogo.map.overlay.IMogoPolyline; +import com.mogo.module.common.drawer.SnapshotSetDataDrawer; import com.mogo.module.v2x.MoGoV2XServicePaths; +import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.entity.model.CloundWarningInfo; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager; +import java.util.Arrays; + import static com.mogo.module.v2x.V2XServiceManager.getContext; /** * desc : V2X 服务端下发数据处理 点的绘制 */ @Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER) -public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager { - private static final String TAG = "MoGoV2XCloundDataManager"; +public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 { + private CloundWarningInfo mCloundWarningInfo; @Override public void init(Context context) { @@ -26,28 +34,42 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager { @Override public void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo) { - //TODO - //清理 - V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + mCloundWarningInfo = cloundWarningInfo; - //绘制连接线自车与交汇点连线 - DrawLineInfo info1 = new DrawLineInfo(); - MogoLatLng startLatlng1 = new MogoLatLng(39.968919,116.407642); - MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821); - info1.setStartLocation(startLatlng1); - info1.setEndLocation(endLatlng1); - V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1); + //TODO 根据判断条件,决定是否画线或者删除线 - //绘制识别物与交汇点连线 TODO + //绘制识别物与交汇点连线,并且更新连线数据 + drawOtherObjectLine(cloundWarningInfo); + //二轮车和行人的移动和渲染 +// SnapshotSetDataDrawer.getInstance().renderSnapshotData(); - //更新数据连线数据 他车和自车 + } - - //自车的移动 - - - //他车的移动 + /** + * 绘制行人和二轮车连线,并且更新数据 + */ + private void drawOtherObjectLine(CloundWarningInfo info) { + IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline(); + if (info != null) { + if (polyLine != null) { + polyLine.setPoints(Arrays.asList(new MogoLatLng(info.startLocation.lat, info.startLocation.lon), + new MogoLatLng(info.endLocation.lat, info.endLocation.lon))); + } else { + DrawLineInfo lineInfo = new DrawLineInfo(); +// MogoLatLng startLatlng = new MogoLatLng(39.968919,116.407642); +// MogoLatLng endLatlng = new MogoLatLng(40.010906,116.423821); + MogoLatLng startLatlng = new MogoLatLng(info.startLocation.lat,info.startLocation.lon); + MogoLatLng endLatlng = new MogoLatLng(info.endLocation.lat,info.endLocation.lon); + lineInfo.setStartLocation(startLatlng); + lineInfo.setEndLocation(endLatlng); + lineInfo.setHeading(info.heading); + V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo); + } + } else { + Log.e(V2XConst.LOG_NAME_WARN, "mCloundWarningInfo == null"); + V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine(); + } } @@ -55,4 +77,43 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager { public void clearALLPOI() { } + + /** + * 自车定位 移动完成需要 3s消失 TODO + */ + @Override + public void onCarLocationChanged2(Location latLng) { + Log.d(V2XConst.LOG_NAME_WARN, "latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude()); + //当行人经纬度交点 经纬度不为空,开始画线,否则清理 + //自车只需要关注移动 + IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline(); + if (mCloundWarningInfo != null) { + if (mogoPolyline != null) { + mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()), + new MogoLatLng(mCloundWarningInfo.endLocation.lat, mCloundWarningInfo.endLocation.lon))); + + } else { + Log.e(V2XConst.LOG_NAME_WARN, "V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline() == null"); + DrawLineInfo info = new DrawLineInfo(); // 对象 TODO +// MogoLatLng startLatlng = new MogoLatLng(39.968919, 116.407642); +// MogoLatLng endLatlng = new MogoLatLng(40.010906, 116.423821); + MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()); + MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.endLocation.lat, mCloundWarningInfo.endLocation.lon); + info.setHeading(latLng.getBearing()); + info.setStartLocation(startLatlng); + info.setEndLocation(endLatlng); + V2XServiceManager.getMoGoWarnPolylineManager().drawaWarnPolyline(getContext(), info); + } + } else { + Log.e(V2XConst.LOG_NAME_WARN, "mCloundWarningInfo == null"); + V2XServiceManager.getMoGoWarnPolylineManager().clearLine(); + } + } + + @Override + public void onCarLocationChanged(MogoLatLng latLng) { + + } + + } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java index 237a54fc30..a5e4a310e5 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java @@ -10,6 +10,7 @@ import com.mogo.map.overlay.MogoPolylineOptions; import com.mogo.module.common.entity.V2XPoiTypeEnum; import com.mogo.module.common.entity.V2XRoadEventEntity; import com.mogo.module.v2x.MoGoV2XServicePaths; +import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager; @@ -27,7 +28,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { @Override - public void drawableWarnPolyline(Context context, DrawLineInfo info) { + public void drawaWarnPolyline(Context context, DrawLineInfo info) { try { if (mMogoPolyline != null) { mMogoPolyline.remove(); @@ -56,7 +57,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { // 绘制线的对象 mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - Log.d("liyz", "MoGoWarnPolylineManager drawableWarnPolyline -----> "); + Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager drawableWarnPolyline -----> "); } catch (Exception e) { e.printStackTrace(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/AdasDataBroadcastReceiver.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/AdasDataBroadcastReceiver.java index df75b1e5aa..62905c22a0 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/AdasDataBroadcastReceiver.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/AdasDataBroadcastReceiver.java @@ -20,9 +20,9 @@ public class AdasDataBroadcastReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { try { // ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY); -// Logger.d("liyz", "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult)); +// Logger.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult)); String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY); - Log.d("liyz", "AdasDataBroadcastReceiver -----> "); + Log.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -----> "); V2XWaringManager.getInstance().registerAdasSocketMessage(context); } catch (Exception e) { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/SceneBroadcastReceiver.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/SceneBroadcastReceiver.java index d4cd59f9a7..8b8b094354 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/SceneBroadcastReceiver.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/receiver/SceneBroadcastReceiver.java @@ -25,7 +25,6 @@ public class SceneBroadcastReceiver extends BroadcastReceiver { try { V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY); //Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity)); - Log.d("liyz", "SceneBroadcastReceiver ------->"); V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity); } catch (Exception e) { e.printStackTrace(); From 9cd0b09a4b1ba6a99e2860a7319ff5e2c4dc85df Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 31 Mar 2021 16:49:11 +0800 Subject: [PATCH 6/8] opt --- .../src/main/java/com/mogo/map/impl/amap/AMapWrapper.java | 5 +++++ .../main/java/com/mogo/map/impl/custom/AMapWrapper.java | 8 ++++++++ .../mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java | 5 +++++ .../com/mogo/map/uicontroller/IMogoMapUIController.java | 1 + .../main/java/com/mogo/module/v2x/V2XWaringManager.java | 4 ++-- .../mogo/module/v2x/manager/IMoGoWarnPolylineManager.java | 2 +- .../module/v2x/manager/impl/MoGoV2XCloundDataManager.java | 2 +- .../module/v2x/manager/impl/MoGoWarnPolylineManager.java | 2 +- .../v2x/scenario/scene/warning/V2XWarningMarker.java | 2 +- 9 files changed, 25 insertions(+), 6 deletions(-) diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapWrapper.java index a1e9cea21c..a0bcb0467b 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapWrapper.java @@ -253,6 +253,11 @@ public class AMapWrapper implements IMogoMap { return true; } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + return 0; + } + private Context getContext() { return mContext; } diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java index 47c8fcaae2..e87532715c 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapWrapper.java @@ -20,6 +20,7 @@ import com.mogo.map.uicontroller.IMogoMapUIController; import com.mogo.utils.logger.Logger; import com.zhidaoauto.map.sdk.open.MapAutoApi; import com.zhidaoauto.map.sdk.open.data.MapDataApi; +import com.zhidaoauto.map.sdk.open.data.SinglePointRoadInfo; import com.zhidaoauto.map.sdk.open.marker.Marker; import com.zhidaoauto.map.sdk.open.marker.MarkerOptions; import com.zhidaoauto.map.sdk.open.marker.MultiPointOverlayOptions; @@ -275,6 +276,13 @@ public class AMapWrapper implements IMogoMap { return true; } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + SinglePointRoadInfo singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(lon, lat, angle, isGpsLocation, isRTK); + + return singlePointRoadInfo.getLaneWidth(); + } + private Context getContext() { return mMapView.getContext(); } diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java index 1c648028dd..0cf8a64ecc 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/IMogoMap.java @@ -130,6 +130,11 @@ public interface IMogoMap { */ float getZoomLevel(); + /** + * 获取道路的宽度 + */ + float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK); + /** * 添加线段 * diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index 8617c38106..6b64d46920 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -121,6 +121,7 @@ public interface IMogoMapUIController { */ float getZoomLevel(); + /** * 获取视图东北角坐标 */ diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java index a5b28a5b8b..2dc4c068fe 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XWaringManager.java @@ -101,7 +101,7 @@ public class V2XWaringManager { MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821); info1.setStartLocation(startLatlng1); info1.setEndLocation(endLatlng1); - V2XServiceManager.getMoGoWarnPolylineManager().drawaWarnPolyline(getContext(), info1); + V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info1); // adas 每隔一秒传递的他车或行人数据 V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> { @@ -117,7 +117,7 @@ public class V2XWaringManager { MogoLatLng endLatlng = new MogoLatLng(39.971089,116.407384); info.setStartLocation(startLatlng); info.setEndLocation(endLatlng); - V2XServiceManager.getMoGoWarnPolylineManager().drawaWarnPolyline(mContext, info); + V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, info); //更新数据 for (ADASRecognizedResult result : resultList) { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java index 8d3eaa1530..f06da3a68a 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoWarnPolylineManager.java @@ -18,7 +18,7 @@ public interface IMoGoWarnPolylineManager extends IProvider { * @param context * @param info */ - void drawaWarnPolyline(Context context, DrawLineInfo info); + void drawWarnPolyline(Context context, DrawLineInfo info); /** * 移除连接线 diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java index f431cd20b2..fc647acaaf 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java @@ -102,7 +102,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog info.setHeading(latLng.getBearing()); info.setStartLocation(startLatlng); info.setEndLocation(endLatlng); - V2XServiceManager.getMoGoWarnPolylineManager().drawaWarnPolyline(getContext(), info); + V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info); } } else { Log.e(V2XConst.LOG_NAME_WARN, "mCloundWarningInfo == null"); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java index a5e4a310e5..1b2aa082a1 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java @@ -28,7 +28,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { @Override - public void drawaWarnPolyline(Context context, DrawLineInfo info) { + public void drawWarnPolyline(Context context, DrawLineInfo info) { try { if (mMogoPolyline != null) { mMogoPolyline.remove(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java index d458a1195a..f365363897 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/warning/V2XWarningMarker.java @@ -72,7 +72,7 @@ public class V2XWarningMarker implements IV2XMarker { MogoLatLng endLatLng = new MogoLatLng(mMarkerEntity.getCollisionLat(), mMarkerEntity.getCollisionLon()); drawLineInfo.setStartLocation(slatLng); drawLineInfo.setEndLocation(endLatLng); - V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, drawLineInfo); + V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, drawLineInfo); } public void smooth() { From 145ac41a40cb8ba03d937ce9f2744396e4d401be Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 31 Mar 2021 17:21:39 +0800 Subject: [PATCH 7/8] opt --- .../map/impl/amap/AMapNaviViewWrapper.java | 5 +++++ .../mogo/map/impl/amap/AMapViewWrapper.java | 5 +++++ .../amap/uicontroller/AMapUIController.java | 8 ++++++++ .../mogo/map/impl/custom/AMapViewWrapper.java | 5 +++++ .../custom/uicontroller/AMapUIController.java | 8 ++++++++ .../uicontroller/IMogoMapUIController.java | 4 ++++ .../com/mogo/map/MogoMapUIController.java | 10 ++++++++++ .../v2x/listener/V2XWarnMessageListener.java | 10 +++++----- .../manager/IMoGoV2XCloundDataManager.java | 4 ++-- .../impl/MoGoPersonWarnPolylineManager.java | 9 ++++++--- .../impl/MoGoV2XCloundDataManager.java | 20 +++++++++---------- .../manager/impl/MoGoWarnPolylineManager.java | 8 +++++--- 12 files changed, 73 insertions(+), 23 deletions(-) diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java index 2cf6e854fc..46a19654e9 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapNaviViewWrapper.java @@ -729,6 +729,11 @@ public class AMapNaviViewWrapper implements IMogoMapView, return getMap().getZoomLevel(); } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK); + } + @Override public void onNaviStarted() { if ( checkAMapView() ) { diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java index 6beedf3fc1..42d06f624f 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/AMapViewWrapper.java @@ -564,6 +564,11 @@ public class AMapViewWrapper implements IMogoMapView, return getMap().getZoomLevel(); } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK); + } + @Override public void onNaviStarted() { if ( checkMapView() ) { diff --git a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java index 79a180d0cd..d8f81123fa 100644 --- a/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java +++ b/libraries/map-amap/src/main/java/com/mogo/map/impl/amap/uicontroller/AMapUIController.java @@ -163,6 +163,14 @@ public class AMapUIController implements IMogoMapUIController { return 0; } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + if (mClient != null) { + return mClient.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK); + } + return 0; + } + @Override public MogoLatLng getCameraNorthEastPosition() { if (mClient != null) { diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java index 6b93b87225..ebe2ac1cbd 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/AMapViewWrapper.java @@ -522,6 +522,11 @@ public class AMapViewWrapper implements IMogoMapView, return getMap().getZoomLevel(); } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + return getMap().getRoadWidth(lon, lat, angle, isGpsLocation, isRTK); + } + @Override public MogoLatLng getCameraNorthEastPosition() { return ObjectUtils.fromAMap(MapTools.INSTANCE.getVisibleRegion().getRightTopPoint()); diff --git a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java index 6c61a9d71e..4dc88d87fb 100644 --- a/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java +++ b/libraries/map-custom/src/main/java/com/mogo/map/impl/custom/uicontroller/AMapUIController.java @@ -149,6 +149,14 @@ public class AMapUIController implements IMogoMapUIController { return 0; } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + if ( mClient != null ) { + return mClient.getRoadWidth(lon,lat,angle,isGpsLocation,isRTK); + } + return 0; + } + @Override public MogoLatLng getCameraNorthEastPosition() { if ( mClient != null ) { diff --git a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java index 6b64d46920..4f7ee5a167 100644 --- a/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java +++ b/libraries/mogo-map-api/src/main/java/com/mogo/map/uicontroller/IMogoMapUIController.java @@ -121,6 +121,10 @@ public interface IMogoMapUIController { */ float getZoomLevel(); + /** + * 获取道路的宽度 + */ + float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK); /** * 获取视图东北角坐标 diff --git a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java index 09acac208a..9aca5abc2c 100644 --- a/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java +++ b/libraries/mogo-map/src/main/java/com/mogo/map/MogoMapUIController.java @@ -174,6 +174,16 @@ public class MogoMapUIController implements IMogoMapUIController { return 0; } + @Override + public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) { + initDelegate(); + if ( mDelegate != null ) { + return mDelegate.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK); + } + + return 0; + } + @Override public MogoLatLng getCameraNorthEastPosition() { initDelegate(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java index d8cb12895a..a88353cec1 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XWarnMessageListener.java @@ -1,22 +1,22 @@ package com.mogo.module.v2x.listener; +import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.model.CloundWarningInfo; import com.mogo.module.v2x.utils.V2XUtils; import com.mogo.service.connection.IMogoOnMessageListener; /** * desc: 下发的云端预警数据 */ -public class V2XWarnMessageListener implements IMogoOnMessageListener { +public class V2XWarnMessageListener implements IMogoOnMessageListener { @Override - public Class target() { - return CloundWarningInfo.class; + public Class target() { + return V2XWarningEntity.class; } @Override - public void onMsgReceived(CloundWarningInfo info) { + public void onMsgReceived(V2XWarningEntity info) { //Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新:\n" + GsonUtil.jsonFromObject(response)); V2XUtils.runOnBackgroundThread(() -> { // 解析不同的Marker类型,然后对应的进行绘制 diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XCloundDataManager.java index e49122aa47..9c00da2a52 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XCloundDataManager.java @@ -1,7 +1,7 @@ package com.mogo.module.v2x.manager; import com.alibaba.android.arouter.facade.template.IProvider; -import com.mogo.module.v2x.entity.model.CloundWarningInfo; +import com.mogo.module.common.entity.V2XWarningEntity; /** * desc: V2X 处理云端预警消息 @@ -11,7 +11,7 @@ public interface IMoGoV2XCloundDataManager extends IProvider { /** * 处理下发数据 */ - void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo); + void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo); /** * 清除 所有的 POI diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java index d3f7269187..19c96ecc65 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java @@ -11,7 +11,6 @@ import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager; -import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager; import java.util.ArrayList; import java.util.List; @@ -34,6 +33,9 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan // 连接线参数 MogoPolylineOptions options = new MogoPolylineOptions(); + float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon, + info.getStartLocation().lat, (float) info.getHeading(), true, true); + // 渐变色 List colors = new ArrayList<>(); @@ -46,7 +48,9 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan } // 线条粗细,渐变,渐变色值 - options.width(60).useGradient(true).colorValues(colors); + Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager roadWidth = " + roadWidth); + options.width(roadWidth).useGradient(true).colorValues(colors); +// options.width(60).useGradient(true).colorValues(colors); // 当前车辆位置 options.add(info.getStartLocation()); // 目标车辆位置 @@ -54,7 +58,6 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan // 绘制线的对象 mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager drawableWarnPolyline -----> "); } catch (Exception e) { e.printStackTrace(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java index fc647acaaf..420e8da55e 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XCloundDataManager.java @@ -9,10 +9,10 @@ import com.mogo.map.MogoLatLng; import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.map.overlay.IMogoPolyline; import com.mogo.module.common.drawer.SnapshotSetDataDrawer; +import com.mogo.module.common.entity.V2XWarningEntity; import com.mogo.module.v2x.MoGoV2XServicePaths; import com.mogo.module.v2x.V2XConst; import com.mogo.module.v2x.V2XServiceManager; -import com.mogo.module.v2x.entity.model.CloundWarningInfo; import com.mogo.module.v2x.entity.model.DrawLineInfo; import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager; @@ -25,7 +25,7 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext; */ @Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER) public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 { - private CloundWarningInfo mCloundWarningInfo; + private V2XWarningEntity mCloundWarningInfo; @Override public void init(Context context) { @@ -33,7 +33,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog } @Override - public void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo) { + public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) { mCloundWarningInfo = cloundWarningInfo; //TODO 根据判断条件,决定是否画线或者删除线 @@ -49,18 +49,18 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog /** * 绘制行人和二轮车连线,并且更新数据 */ - private void drawOtherObjectLine(CloundWarningInfo info) { + private void drawOtherObjectLine(V2XWarningEntity info) { IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline(); if (info != null) { if (polyLine != null) { - polyLine.setPoints(Arrays.asList(new MogoLatLng(info.startLocation.lat, info.startLocation.lon), - new MogoLatLng(info.endLocation.lat, info.endLocation.lon))); + polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()), + new MogoLatLng(info.getCollisionLat(), info.getCollisionLon()))); } else { DrawLineInfo lineInfo = new DrawLineInfo(); // MogoLatLng startLatlng = new MogoLatLng(39.968919,116.407642); // MogoLatLng endLatlng = new MogoLatLng(40.010906,116.423821); - MogoLatLng startLatlng = new MogoLatLng(info.startLocation.lat,info.startLocation.lon); - MogoLatLng endLatlng = new MogoLatLng(info.endLocation.lat,info.endLocation.lon); + MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon()); + MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon()); lineInfo.setStartLocation(startLatlng); lineInfo.setEndLocation(endLatlng); lineInfo.setHeading(info.heading); @@ -90,7 +90,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog if (mCloundWarningInfo != null) { if (mogoPolyline != null) { mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()), - new MogoLatLng(mCloundWarningInfo.endLocation.lat, mCloundWarningInfo.endLocation.lon))); + new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon()))); } else { Log.e(V2XConst.LOG_NAME_WARN, "V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline() == null"); @@ -98,7 +98,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog // MogoLatLng startLatlng = new MogoLatLng(39.968919, 116.407642); // MogoLatLng endLatlng = new MogoLatLng(40.010906, 116.423821); MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()); - MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.endLocation.lat, mCloundWarningInfo.endLocation.lon); + MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon()); info.setHeading(latLng.getBearing()); info.setStartLocation(startLatlng); info.setEndLocation(endLatlng); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java index 1b2aa082a1..b918dfc565 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoWarnPolylineManager.java @@ -37,7 +37,9 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { // 连接线参数 MogoPolylineOptions options = new MogoPolylineOptions(); - // 渐变色 + float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon, + info.getStartLocation().lat, (float) info.getHeading(), true, true); + List colors = new ArrayList<>(); if (info.getType().equals("1")) { //预警 TODO @@ -48,8 +50,9 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { colors.add(0xFFE32F46); } + Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth); // 线条粗细,渐变,渐变色值 - options.width(60).useGradient(true).colorValues(colors); + options.width(roadWidth).useGradient(true).colorValues(colors); // 当前车辆位置 options.add(info.getStartLocation()); // 目标车辆位置 @@ -57,7 +60,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager { // 绘制线的对象 mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); - Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager drawableWarnPolyline -----> "); } catch (Exception e) { e.printStackTrace(); From 4a774e66a88fdc4e80e17869c81df9c56d647de4 Mon Sep 17 00:00:00 2001 From: lixiaopeng Date: Wed, 31 Mar 2021 17:22:04 +0800 Subject: [PATCH 8/8] add get roadwidth --- .../module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java index 19c96ecc65..c53b9315cc 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoPersonWarnPolylineManager.java @@ -57,7 +57,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan options.add(info.getEndLocation()); // 绘制线的对象 - mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); + mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options); } catch (Exception e) { e.printStackTrace();