From 542391e225ce4ad3a85f61cb38d5a3c0a41ed23d Mon Sep 17 00:00:00 2001 From: lianglihui Date: Thu, 30 Dec 2021 16:49:47 +0800 Subject: [PATCH] =?UTF-8?q?8.0.15=20=20=E8=BE=93=E5=87=BA=E8=BD=A6?= =?UTF-8?q?=E5=89=8D=E5=BC=95=E5=AF=BC=E7=BA=BFlog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../routeoverlay/MogoRouteOverlayManager.java | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java index 7c04820b4d..dca1c2fa19 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/routeoverlay/MogoRouteOverlayManager.java @@ -1,6 +1,8 @@ package com.mogo.module.service.routeoverlay; import android.content.Context; +import android.location.Location; +import android.os.SystemClock; import android.util.Log; import com.mogo.eagle.core.data.autopilot.ADASTrajectoryInfo; @@ -9,10 +11,14 @@ import com.mogo.eagle.core.data.autopilot.AutopilotRouteInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStationInfo; import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo; import com.mogo.eagle.core.data.map.MogoLatLng; +import com.mogo.eagle.core.data.map.MogoLocation; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener; import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener; +import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener; import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager; import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotPlanningListenerManager; +import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager; +import com.mogo.map.navi.IMogoCarLocationChangedListener2; import com.mogo.module.common.MogoApisHandler; import org.jetbrains.annotations.NotNull; @@ -21,13 +27,14 @@ import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; -public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener{ +public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, IMoGoAutopilotStatusListener, IMoGoMapLocationListener { private static volatile MogoRouteOverlayManager sInstance; private Context mContext; private String TAG = "MogoRouteOverlayManager"; private String TAG2 = "MogoRouteOverlayManager routes"; private int STATUS_AUTOPILOT = 0;//0 非自动驾驶 ; 1 自动驾驶 private MogoLatLng mEnding; + private MogoLocation mLocation; private MogoRouteOverlayManager(Context context) { mContext = context; } @@ -35,6 +42,7 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, public void init() { CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, this); CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, this); + CallerMapLocationListenerManager.INSTANCE.addListener(TAG,this); } public static MogoRouteOverlayManager getInstance(Context context) { @@ -53,19 +61,33 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, if (trajectoryInfos == null || trajectoryInfos.size() == 0) { return; } - ADASTrajectoryInfo adasTrajectoryInfo = trajectoryInfos.get(0); - double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(); - double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); - Log.d(TAG, "size:" + trajectoryInfos.size()); - Log.d(TAG, "trajectoryInfos:" + adasTrajectoryInfo.getLat()+":"+adasTrajectoryInfo.getLon()); - Log.d(TAG, "location:" + lat+":"+lon); +// double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(); +// double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(); + StringBuilder builder = new StringBuilder(); + builder.append("{"); + builder.append(System.currentTimeMillis()).append(";"); + builder.append(mLocation.getLongitude()).append(";"); + builder.append(mLocation.getLatitude()).append(";"); + builder.append(mLocation.getAltitude()).append(";"); + builder.append(mLocation.getBearing()).append(";"); + builder.append(mLocation.getSpeed()).append(";"); +// ADASTrajectoryInfo adasTrajectoryInfo = trajectoryInfos.get(0); +// long temp = SystemClock.currentThreadTimeMillis(); +// Log.d(TAG, "temp:"+temp+" size:" + trajectoryInfos.size()); +// Log.d(TAG, "trajectoryInfos:" + adasTrajectoryInfo.getLat()+":"+adasTrajectoryInfo.getLon()); +// Log.d(TAG, "temp:"+temp+" location:" + lat+":"+lon); List mogoLatLngs = new ArrayList<>(); for (ADASTrajectoryInfo a : trajectoryInfos) { +// Log.d(TAG, "temp:"+temp+" trajectoryInfos:" + a.getLat()+":"+a.getLon()); + builder.append(a.getLon()).append(","); + builder.append(a.getLat()).append(","); mogoLatLngs.add(new MogoLatLng(a.getLat(), a.getLon())); } if (STATUS_AUTOPILOT == 1) { RouteOverlayDrawer.getInstance(mContext).drawTrajectoryList(mogoLatLngs); } + builder.append("}"); + Log.d(TAG,builder.toString()); } @Override @@ -108,4 +130,9 @@ public class MogoRouteOverlayManager implements IMoGoAutopilotPlanningListener, public void onAutopilotSNRequest() { } + + @Override + public void onLocationChanged(@Nullable MogoLocation location) { + mLocation = location; + } }