From 6f00c9569efb51da2f59ad54fa95fb90c980fb2a Mon Sep 17 00:00:00 2001 From: liujing Date: Thu, 23 Jun 2022 20:47:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E5=90=ACadas=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E8=B7=AF=E5=BE=84,=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=AB=98=E5=BE=B7=E8=B7=AF=E5=BE=84=E8=A7=84=E5=88=92=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../function/smp/SmallMapDirectionView.java | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java index a64f44f612..7254e72cd5 100644 --- a/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java +++ b/core/function-impl/mogo-core-function-map/src/main/java/com/mogo/eagle/core/function/smp/SmallMapDirectionView.java @@ -81,6 +81,7 @@ import mogo.telematics.pad.MessagePad; /** * 小地图的方向View * 监听自动驾驶路径结束,结束高德地图导航 + * * @author donghongyu * @date 12/14/20 4:40 PM */ @@ -722,11 +723,38 @@ public class SmallMapDirectionView } - //自动驾驶状态开启之后返回,真实路径需要确认返回时间 - //数据返回之后触发路算 + /** + * 根据全路径获取起始点和经停点进行导航路线绘制 + * 自动驾驶启动后获得数据,获取全路径的具体时间要进行路测 + * 室内某个bag包自动驾驶启动8s后返回 + */ @Override public void onAutopilotRotting(@org.jetbrains.annotations.Nullable MessagePad.GlobalPathResp globalPathResp) { List list = globalPathResp.getWayPointsList(); Log.d(TAG, "adas返回全路径:" + list.toString()); + int minCount = 2; + if (list.size() >= minCount) { + Location sLocation = (Location) list.get(0); + Location eLocation = (Location) list.get(list.size() - 1); + mStartLatlng = new NaviLatLng(sLocation.getLongitude(), sLocation.getLatitude()); + mEndLatlng = new NaviLatLng(eLocation.getLongitude(), eLocation.getLatitude()); + sList.add(mStartLatlng); + eList.add(mEndLatlng); + for (int i = 1; i < list.size() - minCount; i++) { + Location wayLoc = (Location) list.get(i); + NaviLatLng way = new NaviLatLng(wayLoc.getLongitude(), wayLoc.getLatitude()); + mWayPointList.add(way); + } + } + int strategy = 0; + try { + //再次强调,最后一个参数为true时代表多路径,否则代表单路径 + strategy = mAMapNavi.strategyConvert(true, false, false, false, false); + } catch (Exception e) { + e.printStackTrace(); + } + Log.d(TAG, "calculateDriveRoute:" + sList.toString() + "," + eList.toString() + "," + mWayPointList.toString()); + //指定路径绘制导航路线 + mAMapNavi.calculateDriveRoute(sList, eList, mWayPointList, strategy); } }