[2.13.0] 各个业务端将定位监听接口改为 CallerMapLocationListenerManager IMoGoMapLocationListener
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import android.location.Location;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
@@ -11,5 +11,5 @@ public interface IBusPassengerControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(Location location);
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.och.bus.passenger.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
@@ -11,7 +10,6 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -22,8 +20,10 @@ import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.commons.module.status.StatusDescriptor;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
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;
|
||||
@@ -32,8 +32,6 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResponse;
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerRoutesResult;
|
||||
@@ -70,7 +68,7 @@ import static com.mogo.och.bus.passenger.constant.BusPassengerConst.STATION_STAT
|
||||
public class BusPassengerModel {
|
||||
private static final String TAG = BusPassengerModel.class.getSimpleName();
|
||||
|
||||
private List<Location> mRoutePoints = new ArrayList<>();
|
||||
private List<MogoLocation> mRoutePoints = new ArrayList<>();
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final BusPassengerModel INSTANCE = new BusPassengerModel();
|
||||
@@ -88,14 +86,13 @@ public class BusPassengerModel {
|
||||
private IBusPassegerDriverStatusCallback mDriverStatusCallback; //出车收车状态
|
||||
private IBusPassengerRouteLineInfoCallback mRouteLineInfoCallback; // bus路线信息更新
|
||||
|
||||
// private double mLongitude, mLatitude;
|
||||
private Location mLocation = null;
|
||||
private MogoLocation mLocation = null;
|
||||
|
||||
private BusPassengerRoutesResult routesResult = null;
|
||||
|
||||
List<BusPassengerStation> mStations = new ArrayList<>();
|
||||
private int mNextStationIndex = 0;// 要到达站的index
|
||||
private List<Location> mTwoStationsRouts = new ArrayList<>();
|
||||
private List<MogoLocation> mTwoStationsRouts = new ArrayList<>();
|
||||
private int mPreRouteIndex = 0;
|
||||
|
||||
private static final int MSG_QUERY_BUS_P_STATION = 1001;
|
||||
@@ -252,11 +249,8 @@ public class BusPassengerModel {
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener );
|
||||
// 达到起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener( TAG, mCarLocationChangedListener2);
|
||||
// 定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, mMapLocationListener,false);
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
|
||||
@@ -265,11 +259,8 @@ public class BusPassengerModel {
|
||||
private void releaseListeners() {
|
||||
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
// 注销到达起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
// 注销定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG,false);
|
||||
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
@@ -302,15 +293,9 @@ public class BusPassengerModel {
|
||||
}
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
private final IMoGoMapLocationListener mMapLocationListener = new IMoGoMapLocationListener() {
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
//位置变化时,通过围栏判断是否到达x点
|
||||
// TODO: 2022/3/31
|
||||
// mLongitude = location.getLongitude();
|
||||
// mLatitude = location.getLatitude();
|
||||
public void onLocationChanged(@Nullable MogoLocation location, int from, boolean isGps) {
|
||||
mLocation = location;
|
||||
for (IBusPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
|
||||
callback.onCarLocationChanged(location);
|
||||
@@ -406,7 +391,7 @@ public class BusPassengerModel {
|
||||
|
||||
public void updateRoutePoints(List<MessagePad.Location> routePoints){
|
||||
mRoutePoints.clear();
|
||||
List<Location> latLngModels = CoordinateCalculateRouteUtil
|
||||
List<MogoLocation> latLngModels = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcjLocations(mContext,routePoints);
|
||||
mRoutePoints.addAll(latLngModels);
|
||||
calculateTwoStationsRoute();
|
||||
@@ -454,14 +439,14 @@ public class BusPassengerModel {
|
||||
calculateTwoStationsRoute();
|
||||
}
|
||||
if (mTwoStationsRouts.size() > 0 && mLocation != null){
|
||||
Map<Integer,List<Location>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
Map<Integer,List<MogoLocation>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompareNew(mPreRouteIndex,mTwoStationsRouts,mLocation);
|
||||
for (int index: lastPointsMap.keySet()) {
|
||||
mPreRouteIndex = index;
|
||||
break;
|
||||
}
|
||||
|
||||
for (List<Location> lastPoints: lastPointsMap.values()){
|
||||
for (List<MogoLocation> lastPoints: lastPointsMap.values()){
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1){ //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
|
||||
@@ -9,6 +9,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -109,7 +110,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (location != null){
|
||||
runOnUIThread(() -> mView.onCarLocationChanged(location));
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
@@ -337,7 +338,7 @@ public class BusPassengerRouteFragment extends
|
||||
lastBearing = bearing;
|
||||
}
|
||||
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
updateSpeedView(location.getSpeed());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import android.location.Location;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
@@ -11,7 +11,7 @@ public interface IBusControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(Location location);
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
//开始开启自动驾驶
|
||||
void startOpenAutopilot();
|
||||
}
|
||||
|
||||
@@ -7,11 +7,11 @@ import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_ARRIVING;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.location.Location;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
@@ -19,25 +19,24 @@ import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.commons.module.status.StatusDescriptor;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
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.CallerAutoPilotManager;
|
||||
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.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
@@ -149,29 +148,24 @@ public class BusOrderModel {
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
loginService = (LoginService) ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation();
|
||||
// 2021/10/20 衡阳小巴业务,使用LenovoPad时需要此app自己获取坐标并上传
|
||||
String productFlavor = DebugConfig.getProductFlavor();
|
||||
if (productFlavor != null && productFlavor.contains("fPadLenovoOchBus")) {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
// 定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG, mMapLocationListener, false);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
//开启自驾后 异常信息返回
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener);
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
|
||||
OCHSocketMessageManager.INSTANCE.registerSocketMessageListener(//监听运营消息
|
||||
OCHSocketMessageManager.INSTANCE.getMsgMonitorType(),
|
||||
mMogoOnMessageListener);
|
||||
//开启自驾后 异常信息返回
|
||||
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener);
|
||||
|
||||
OCHSocketMessageManager.INSTANCE.registerSocketMessageListener(//监听核销乘客
|
||||
OCHSocketMessageManager.INSTANCE.getMsgWriteOffPassengerType(),
|
||||
mWriteOffPassengeOnMessageListener);
|
||||
}
|
||||
OCHSocketMessageManager.INSTANCE.registerSocketMessageListener(//监听运营消息
|
||||
OCHSocketMessageManager.INSTANCE.getMsgMonitorType(),
|
||||
mMogoOnMessageListener);
|
||||
|
||||
OCHSocketMessageManager.INSTANCE.registerSocketMessageListener(//监听核销乘客
|
||||
OCHSocketMessageManager.INSTANCE.getMsgWriteOffPassengerType(),
|
||||
mWriteOffPassengeOnMessageListener);
|
||||
|
||||
//2022.1.28
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
@@ -335,11 +329,8 @@ public class BusOrderModel {
|
||||
//startOrStopQueryPassengerWriteOff(false);
|
||||
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
// 注销到达起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
// 注销定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG,false);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
@@ -382,11 +373,9 @@ public class BusOrderModel {
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
private final IMoGoMapLocationListener mMapLocationListener = new IMoGoMapLocationListener() {
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG,"location = "+location.getLongitude()+","+location.getLatitude());
|
||||
public void onLocationChanged(@Nullable MogoLocation location, int from, boolean isGps) {
|
||||
mLongitude = location.getLongitude();
|
||||
mLatitude = location.getLatitude();
|
||||
if (mControllerStatusCallback != null) {
|
||||
@@ -401,7 +390,7 @@ public class BusOrderModel {
|
||||
};
|
||||
|
||||
//根据围栏判断,是否到达站点
|
||||
private void judgeArrivedStation(Location location) {
|
||||
private void judgeArrivedStation(MogoLocation location) {
|
||||
|
||||
if (backgroundCurrentStationIndex + 1 > stationList.size() - 1) {
|
||||
CallerLogger.INSTANCE.e(M_BUS + TAG, "到站数组越界");
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -236,7 +237,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (null != location) {
|
||||
runOnUIThread(() -> mView.updateSpeedView(location.getSpeed()));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.location.Location;
|
||||
import com.amap.api.maps.CoordinateConverter;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -26,7 +27,20 @@ public class CoordinateCalculateRouteUtil {
|
||||
|
||||
float sumLength = 0;
|
||||
|
||||
if (points.get(1) instanceof Location){
|
||||
if (points.get(1) instanceof MogoLocation){
|
||||
//计算全路径总距离
|
||||
for (int i = 0;i + 1< points.size();i++){
|
||||
MogoLocation locationPre = (MogoLocation) points.get(i);
|
||||
MogoLocation location = (MogoLocation) points.get(i+1);
|
||||
double preLat = locationPre.getLatitude();
|
||||
double preLon = locationPre.getLongitude();
|
||||
double laLat = location.getLatitude();
|
||||
double laLon = location.getLongitude();
|
||||
|
||||
float length = CoordinateUtils.calculateLineDistance(laLon,laLat,preLon,preLat);
|
||||
sumLength += length;
|
||||
}
|
||||
}else if (points.get(1) instanceof Location){
|
||||
//计算全路径总距离
|
||||
for (int i = 0;i + 1< points.size();i++){
|
||||
Location locationPre = (Location) points.get(i);
|
||||
@@ -172,12 +186,12 @@ public class CoordinateCalculateRouteUtil {
|
||||
}
|
||||
|
||||
|
||||
public static List<Location> coordinateConverterWgsToGcjLocations(Context mContext, List<MessagePad.Location> models) {
|
||||
public static List<MogoLocation> coordinateConverterWgsToGcjLocations(Context mContext, List<MessagePad.Location> models) {
|
||||
//转成MogoLatLng集合
|
||||
List<Location> list = new ArrayList<>();
|
||||
List<MogoLocation> list = new ArrayList<>();
|
||||
for (MessagePad.Location m : models) {
|
||||
LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m);
|
||||
Location location = new Location("gcj_provider");
|
||||
MogoLocation location = new MogoLocation();
|
||||
location.setBearing((float) m.getHeading());
|
||||
location.setLatitude(mogoLatLng.latitude);
|
||||
location.setLongitude(mogoLatLng.longitude);
|
||||
@@ -186,11 +200,11 @@ public class CoordinateCalculateRouteUtil {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<Location> coordinateConverterLatlngToLocation(List<LatLng> models) {
|
||||
public static List<MogoLocation> coordinateConverterLatlngToLocation(List<LatLng> models) {
|
||||
//转成MogoLatLng集合
|
||||
List<Location> list = new ArrayList<>();
|
||||
List<MogoLocation> list = new ArrayList<>();
|
||||
for (LatLng m : models) {
|
||||
Location location = new Location("gcj_provider");
|
||||
MogoLocation location = new MogoLocation();
|
||||
location.setLatitude(m.latitude);
|
||||
location.setLongitude(m.longitude);
|
||||
list.add(location);
|
||||
@@ -198,10 +212,10 @@ public class CoordinateCalculateRouteUtil {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<LatLng> coordinateConverterLocationToLatLng(Context mContext, List<Location> models) {
|
||||
public static List<LatLng> coordinateConverterLocationToLatLng(Context mContext, List<MogoLocation> models) {
|
||||
//转成MogoLatLng集合
|
||||
List<LatLng> list = new ArrayList<>();
|
||||
for (Location m : models) {
|
||||
for (MogoLocation m : models) {
|
||||
LatLng mogoLatLng = coordinateConverterWgsToGcj(mContext, m.getLongitude(),m.getLatitude());
|
||||
list.add(mogoLatLng);
|
||||
}
|
||||
@@ -215,21 +229,21 @@ public class CoordinateCalculateRouteUtil {
|
||||
* @param realLocation
|
||||
* @return
|
||||
*/
|
||||
public static Map<Integer,List<Location>> getRemainPointListByCompareNew(int preIndex,
|
||||
List<Location> mRoutePoints,
|
||||
Location realLocation) {
|
||||
Map<Integer,List<Location>> routePonits = new HashMap<>();
|
||||
List<Location> latePoints = new ArrayList<>(); // 剩余轨迹集合
|
||||
public static Map<Integer,List<MogoLocation>> getRemainPointListByCompareNew(int preIndex,
|
||||
List<MogoLocation> mRoutePoints,
|
||||
MogoLocation realLocation) {
|
||||
Map<Integer,List<MogoLocation>> routePonits = new HashMap<>();
|
||||
List<MogoLocation> latePoints = new ArrayList<>(); // 剩余轨迹集合
|
||||
int currentIndex = 0; //记录疑似点
|
||||
if (mRoutePoints.size() > preIndex){
|
||||
//基础点
|
||||
Location baseLatLng = mRoutePoints.get(preIndex);
|
||||
MogoLocation baseLatLng = mRoutePoints.get(preIndex);
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
|
||||
realLocation.getLatitude()
|
||||
,baseLatLng.getLongitude(),baseLatLng.getLongitude());// lon,lat, prelon, prelat
|
||||
|
||||
for (int i= preIndex; i < mRoutePoints.size(); i++){
|
||||
Location latLng = mRoutePoints.get(i);
|
||||
MogoLocation latLng = mRoutePoints.get(i);
|
||||
//todo 先看index对应点的方向和realLocation方向是否一致, 方向角度不能过90度
|
||||
if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90){
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLocation.getLongitude(),
|
||||
@@ -244,12 +258,12 @@ public class CoordinateCalculateRouteUtil {
|
||||
}
|
||||
Logger.d( "calculateRouteSumLength", "点:"+currentIndex+"-------是最近的点------ ");
|
||||
if (currentIndex == mRoutePoints.size()-1){
|
||||
Location location = mRoutePoints.get(currentIndex);
|
||||
MogoLocation location = mRoutePoints.get(currentIndex);
|
||||
// LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
latePoints.add(location);
|
||||
}else {
|
||||
List<Location> locations = mRoutePoints.subList(currentIndex,mRoutePoints.size()-1);
|
||||
for (Location location: locations) {
|
||||
List<MogoLocation> locations = mRoutePoints.subList(currentIndex,mRoutePoints.size()-1);
|
||||
for (MogoLocation location: locations) {
|
||||
// LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
|
||||
latePoints.add(location);
|
||||
}
|
||||
@@ -260,16 +274,16 @@ public class CoordinateCalculateRouteUtil {
|
||||
return routePonits;
|
||||
}
|
||||
|
||||
public static int getArrivedPointIndexNew(int preIndex, List<Location> mRoutePoints,
|
||||
public static int getArrivedPointIndexNew(int preIndex, List<MogoLocation> mRoutePoints,
|
||||
double realLon,double realLat) {
|
||||
int currentIndex = preIndex; //记录疑似点 //基础点
|
||||
Location baseLatLng = mRoutePoints.get(0);
|
||||
MogoLocation baseLatLng = mRoutePoints.get(0);
|
||||
float baseDiffDis = CoordinateUtils.calculateLineDistance(realLon,
|
||||
realLat
|
||||
, baseLatLng.getLongitude(), baseLatLng.getLongitude());// lon,lat, prelon, prelat
|
||||
|
||||
for (int i = 0; i < mRoutePoints.size(); i++) {
|
||||
Location latLng = mRoutePoints.get(i);
|
||||
MogoLocation latLng = mRoutePoints.get(i);
|
||||
//todo 先看index对应点的方向和realLocation方向是否一致, 方向角度不能过90度
|
||||
// if (Math.abs(realLocation.getBearing() - latLng.getBearing()) <= 90) {
|
||||
float diff = CoordinateUtils.calculateLineDistance(realLon,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.sweeper.callback;
|
||||
|
||||
import android.location.Location;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
@@ -11,7 +11,7 @@ public interface ISweeperControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(Location location);
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
//开始开启自动驾驶
|
||||
void startOpenAutopilot();
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
@@ -22,10 +23,13 @@ import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotPlanningListener;
|
||||
import com.mogo.eagle.core.function.api.map.listener.IMoGoMapLocationListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
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.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
@@ -127,18 +131,14 @@ public class SweeperOrderModel {
|
||||
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
// 2021/10/20 衡阳小巴业务,使用LenovoPad时需要此app自己获取坐标并上传
|
||||
String productFlavor = DebugConfig.getProductFlavor();
|
||||
if (productFlavor != null && productFlavor.contains("fPadLenovoOchBus")) {
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
// 定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG,mMapLocationListener,false);
|
||||
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
}
|
||||
|
||||
//2022.1.28
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
@@ -261,11 +261,8 @@ public class SweeperOrderModel {
|
||||
public void release() {
|
||||
startOrStopOrderLoop(false);
|
||||
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
// 注销到达起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
// 注销定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG,false);
|
||||
|
||||
//自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.removeListener(moGoAutopilotPlanningListener);
|
||||
@@ -289,11 +286,9 @@ public class SweeperOrderModel {
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
private final IMoGoMapLocationListener mMapLocationListener = new IMoGoMapLocationListener() {
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
// CallerLogger.INSTANCE.d(M_BUS + TAG,"location = "+location.getLongitude()+","+location.getLatitude());
|
||||
public void onLocationChanged(@Nullable MogoLocation location, int from, boolean isGps) {
|
||||
mLongitude = location.getLongitude();
|
||||
mLatitude = location.getLatitude();
|
||||
if (mControllerStatusCallback != null) {
|
||||
@@ -308,7 +303,7 @@ public class SweeperOrderModel {
|
||||
};
|
||||
|
||||
//根据围栏判断,是否到达起点
|
||||
private void judgeStartStation(Location location) {
|
||||
private void judgeStartStation(MogoLocation location) {
|
||||
|
||||
if (backgroundCurrentStationIndex + 1 > stationList.size() - 1) {
|
||||
return;
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -238,7 +239,7 @@ public class SweeperPresenter extends Presenter<SweeperFragment>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (null != location) {
|
||||
runOnUIThread(() -> mView.updateSpeedView(location.getSpeed()));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.taxi.passenger.callback;
|
||||
|
||||
import android.location.Location;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
@@ -11,5 +11,5 @@ public interface IOCHTaxiPassengerControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(Location location);
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.och.taxi.passenger.model;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Looper;
|
||||
|
||||
@@ -23,12 +22,15 @@ import com.mogo.commons.module.status.StatusDescriptor;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
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.api.v2x.LimitingVelocityListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager;
|
||||
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.eagle.core.function.call.v2x.CallLimitingVelocityListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -36,8 +38,6 @@ import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.map.AmapNaviToDestinationModel;
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback;
|
||||
@@ -61,7 +61,6 @@ import com.mogo.och.taxi.passenger.callback.ITaxiPassengerVeloctityCallback;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerConst;
|
||||
import com.mogo.och.taxi.passenger.constant.TaxiPassengerOrderStatusEnum;
|
||||
import com.mogo.och.taxi.passenger.network.TaxiPassengerServiceManager;
|
||||
import com.mogo.aicloud.services.socket.IMogoLifecycleListener;
|
||||
import com.mogo.och.taxi.passenger.utils.TaxiPassengerAnalyticsManager;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -123,7 +122,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
|
||||
private double mLongitude, mLatitude;
|
||||
|
||||
private List<Location> mLocationsModels = new ArrayList<>();
|
||||
private List<MogoLocation> mLocationsModels = new ArrayList<>();
|
||||
|
||||
private TaxiPassengerModel() {
|
||||
}
|
||||
@@ -233,11 +232,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
IntentManager.getInstance().registerIntentListener( ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener );
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
// 达到起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener( TAG, mCarLocationChangedListener2);
|
||||
// 定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG,mMapLocationListener,false);
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG,moGoAutopilotPlanningListener);
|
||||
@@ -249,11 +245,8 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
private void releaseListeners() {
|
||||
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
// 注销到达起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
// 注销定位监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG,false);
|
||||
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010);
|
||||
@@ -416,7 +409,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
}
|
||||
|
||||
// TODO: 2021/9/12
|
||||
public void calculateTravelDistance(Location carLocation){
|
||||
public void calculateTravelDistance(MogoLocation carLocation){
|
||||
if (checkCurrentOCHOrder() && mCurrentOCHOrder.endSiteGcjPoint.size()>0) {
|
||||
double endLon = mCurrentOCHOrder.endSiteGcjPoint.get(0);
|
||||
double endLat = mCurrentOCHOrder.endSiteGcjPoint.get(1);
|
||||
@@ -455,10 +448,9 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
private final IMoGoMapLocationListener mMapLocationListener = new IMoGoMapLocationListener() {
|
||||
@Override
|
||||
public void onCarLocationChanged2( Location location ) {
|
||||
public void onLocationChanged(@Nullable MogoLocation location, int from, boolean isGps) {
|
||||
//位置变化时,通过围栏判断是否到达x点
|
||||
if (location != null && checkCurrentOCHOrder()) {
|
||||
if (getCurOrderStatus() == TaxiPassengerOrderStatusEnum.OnTheWayToEnd) {
|
||||
@@ -467,7 +459,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
}
|
||||
mLongitude = location.getLongitude();
|
||||
mLatitude = location.getLatitude();
|
||||
// CallerLogger.INSTANCE.e(M_TAXI_P + TAG,"mLongitude = "+mLongitude+", mLatitude = "+mLatitude);
|
||||
// CallerLogger.INSTANCE.e(M_TAXI_P + TAG,"mLongitude = "+mLongitude+", mLatitude = "+mLatitude);
|
||||
for (IOCHTaxiPassengerControllerStatusCallback callback :mControllerStatusCallbackMap.values()){
|
||||
callback.onCarLocationChanged(location);
|
||||
}
|
||||
@@ -583,7 +575,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
};
|
||||
|
||||
public void startToRouteAndWipe(List<MessagePad.Location> models) {
|
||||
List<Location> locationsModels = CoordinateCalculateRouteUtil
|
||||
List<MogoLocation> locationsModels = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcjLocations(mContext,models);
|
||||
mLocationsModels.clear();
|
||||
mLocationsModels.addAll(locationsModels);
|
||||
@@ -724,7 +716,7 @@ public class TaxiPassengerModel implements IOCHTaxiPassengerNaviChangedCallback
|
||||
mAutopilotPlanningCallback.setLineMarker(data.data);
|
||||
}
|
||||
mLocationsModels.clear();
|
||||
List<Location> locationsModels = CoordinateCalculateRouteUtil.
|
||||
List<MogoLocation> locationsModels = CoordinateCalculateRouteUtil.
|
||||
coordinateConverterLatlngToLocation(data.data);
|
||||
mLocationsModels.addAll(locationsModels);
|
||||
startOrStopRouteAndWipe(true);
|
||||
|
||||
@@ -10,6 +10,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.map.CallerSmpManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
@@ -119,7 +120,7 @@ public class BaseTaxiPassengerPresenter extends Presenter<TaxiPassengerBaseFragm
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
// 速度不用展示
|
||||
// LeftMenuOpen.INSTANCE.callCallBack(-1,-1,location.getSpeed());
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -140,7 +141,7 @@ public class TaxiPassengerServingOrderPresenter extends Presenter<TaxiPassengerS
|
||||
private static final long TIMEINTERVAL = 4000;
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (location != null){
|
||||
runOnUIThread(() -> mView.onCarLocationChanged(location));
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
|
||||
@@ -22,6 +22,7 @@ import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -351,7 +352,7 @@ public class TaxiPassengerServingOrderFragment extends
|
||||
|
||||
}
|
||||
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
updateSpeedView(location.getSpeed());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.taxi.callback;
|
||||
|
||||
import android.location.Location;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
@@ -11,7 +11,7 @@ public interface ITaxiControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
// 自车定位
|
||||
void onCarLocationChanged(Location location);
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
//开始开启自动驾驶
|
||||
void startOpenAutopilot();
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_TAX
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.net.ConnectivityManager;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -27,18 +26,19 @@ import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
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.CallerAutoPilotManager;
|
||||
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.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager;
|
||||
import com.mogo.och.common.module.biz.common.socketmessage.data.OCHOperationalMessage;
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager;
|
||||
@@ -128,11 +128,11 @@ public class TaxiModel {
|
||||
|
||||
private volatile boolean isRestartAutopilot = false;
|
||||
|
||||
private List<Location> mRoutePoints = new ArrayList<>();
|
||||
private List<MogoLocation> mRoutePoints = new ArrayList<>();
|
||||
private int mPreRouteIndex = 0;
|
||||
|
||||
private double mLongitude, mLatitude;
|
||||
private Location mLocation = null;
|
||||
private MogoLocation mLocation = null;
|
||||
|
||||
private LoginService loginService;
|
||||
|
||||
@@ -220,11 +220,9 @@ public class TaxiModel {
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.addListener(TAG, mGoAutopilotStatusListener);
|
||||
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener);
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
// 达到起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.registerCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
|
||||
//定位监听, 传false是高德坐标系
|
||||
CallerMapLocationListenerManager.INSTANCE.addListener(TAG,mMapLocationLIstener,false);
|
||||
|
||||
//2021.11.1 自动驾驶路线规划接口
|
||||
CallerAutopilotPlanningListenerManager.INSTANCE.addListener(TAG, moGoAutopilotPlanningListener);
|
||||
@@ -258,11 +256,8 @@ public class TaxiModel {
|
||||
private void releaseListeners() {
|
||||
MogoStatusManager.getInstance().unregisterStatusChangedListener(TAG, StatusDescriptor.VR_MODE, mMogoStatusChangedListener);
|
||||
|
||||
// 注销到达起始站围栏监听
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getRegisterCenterApi()
|
||||
.unregisterCarLocationChangedListener(TAG, mCarLocationChangedListener2);
|
||||
// 注销地图监听
|
||||
CallerMapLocationListenerManager.INSTANCE.removeListener(TAG,false);
|
||||
|
||||
OCHSocketMessageManager.INSTANCE.releaseSocketMessageListener(OCHSocketMessageManager.INSTANCE.getMsgMonitorType());
|
||||
|
||||
@@ -993,7 +988,7 @@ public class TaxiModel {
|
||||
}
|
||||
|
||||
//根据围栏判断,是否到达起点
|
||||
private void judgeStartStation(Location location) {
|
||||
private void judgeStartStation(MogoLocation location) {
|
||||
if (mCurrentOCHOrder == null || mCurrentOCHOrder.startSiteGcjPoint == null
|
||||
|| mCurrentOCHOrder.startSiteGcjPoint.size() < 2) {
|
||||
return;
|
||||
@@ -1050,10 +1045,9 @@ public class TaxiModel {
|
||||
};
|
||||
|
||||
// 自车定位
|
||||
private final IMogoCarLocationChangedListener2 mCarLocationChangedListener2 = new IMogoCarLocationChangedListener2() {
|
||||
|
||||
private final IMoGoMapLocationListener mMapLocationLIstener = new IMoGoMapLocationListener() {
|
||||
@Override
|
||||
public void onCarLocationChanged2(Location location) {
|
||||
public void onLocationChanged(@Nullable MogoLocation location, int from, boolean isGps) {
|
||||
//位置变化时,通过围栏判断是否到达x点
|
||||
if (location != null && checkCurrentOCHOrder()) {
|
||||
if (getCurOrderStatus() == TaxiOrderStatusEnum.OnTheWayToStart) {
|
||||
@@ -1074,7 +1068,7 @@ public class TaxiModel {
|
||||
}
|
||||
};
|
||||
|
||||
private void judgeEndStation(Location location) {
|
||||
private void judgeEndStation(MogoLocation location) {
|
||||
if (mCurrentOCHOrder == null || mCurrentOCHOrder.endSiteGcjPoint == null
|
||||
|| mCurrentOCHOrder.endSiteGcjPoint.size() < 2) {
|
||||
return;
|
||||
@@ -1376,14 +1370,14 @@ public class TaxiModel {
|
||||
return;
|
||||
}
|
||||
if (mRoutePoints.size() > 0 && mLocation != null){
|
||||
Map<Integer,List<Location>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
Map<Integer,List<MogoLocation>> lastPointsMap = CoordinateCalculateRouteUtil
|
||||
.getRemainPointListByCompareNew(mPreRouteIndex,mRoutePoints, mLocation);
|
||||
|
||||
for (int index: lastPointsMap.keySet()) {
|
||||
mPreRouteIndex = index;
|
||||
break;
|
||||
}
|
||||
for (List<Location> lastPoints: lastPointsMap.values()){
|
||||
for (List<MogoLocation> lastPoints: lastPointsMap.values()){
|
||||
float lastSumLength = 0;
|
||||
if (lastPoints.size() == 1) { //只是最后一个点,计算当前位置和最后一个点的距离
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
@@ -1437,7 +1431,7 @@ public class TaxiModel {
|
||||
public void onSuccess(QueryOrderRouteResp data) {
|
||||
if (data != null && data.data != null && mRoutePoints.size() == 0) {
|
||||
mRoutePoints.clear();
|
||||
List<Location> routePoints = CoordinateCalculateRouteUtil
|
||||
List<MogoLocation> routePoints = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterLatlngToLocation(data.data);
|
||||
mRoutePoints.addAll(routePoints);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
@@ -313,7 +314,7 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(Location location) {
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
if (null != location){
|
||||
runOnUIThread(() -> {
|
||||
mView.updateSpeedView(location.getSpeed());
|
||||
|
||||
Reference in New Issue
Block a user