Merge branch 'dev_arch_opt_3.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_arch_opt_3.0

This commit is contained in:
xinfengkun
2023-02-01 18:34:39 +08:00
392 changed files with 11343 additions and 9874 deletions

View File

@@ -121,10 +121,6 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
// GPS 位置回调
private final LocationListener mGpsLocationListener =
location -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(ObjectUtils.fromLocation(location), 0, true);
public AMapViewWrapper(MapAutoView mMapView) {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
@@ -189,7 +185,6 @@ public class AMapViewWrapper implements IMogoMapView,
LocationClient client = mMapView.getLocationClient();
if (client != null) {
client.registerListener(this);
client.registerGpsListener(mGpsLocationListener);
}
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ZOOM);
mMapView.registerListener(this, MapAutoApi.LISTENER_TYPE_ROTATE);
@@ -704,45 +699,12 @@ public class AMapViewWrapper implements IMogoMapView,
CallerMapDevaListenerManager.INSTANCE.invokeUploadLogFile(filePath);
}
// TODO 这里需要数据中心代理
// private static class LocationTask implements Runnable {
//
// private MogoLocation location;
//
// public void setMoGoLocation(MogoLocation location) {
// this.location = location;
// }
//
// @Override
// public void run() {
// if (location != null) {
// CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(location, 1, false);
// location = null;
// }
// }
// }
// private volatile LocationTask mLocationTask;
// private final Handler mainHandler = new Handler(Looper.getMainLooper());
@Override
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
// MogoLocation currentLocation = ObjectUtils.fromLocation(location);
// if (Looper.myLooper() == Looper.getMainLooper()) {
// CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(currentLocation, 1, false);
// } else {
// if (mLocationTask == null) {
// mLocationTask = new LocationTask();
// }
// mLocationTask.setMoGoLocation(currentLocation);
// mainHandler.removeCallbacks(mLocationTask);
// mainHandler.post(mLocationTask);
// }
CallerMapLocationListenerManager.INSTANCE.setCurrentLocation(ObjectUtils.fromLocation(location));
// 将有效经纬度暂存本地提供给下一次的Http-DNS使用防止首次请求位置获取不到
if (location.getLat() > 0 && location.getLon() > 0) {
if (location.getCityCode() != null && !location.getCityCode().isEmpty()) {
if (location.getCityCode() != null && !location.getCityCode().isEmpty()) {
SharedPrefsMgr.getInstance(mMapView.getContext())
.putString(SharedPrefsConstants.LOCATION_CITY_CODE, location.getCityCode());
}
@@ -752,20 +714,6 @@ public class AMapViewWrapper implements IMogoMapView,
.putString(SharedPrefsConstants.LOCATION_LONGITUDE, String.valueOf(location.getLon()));
}
// // 同步给各个模块
// Location sysLocation = new Location(location.getProvider());
// sysLocation.setAltitude(location.getAltitude());
// sysLocation.setLatitude(location.getLat());
// sysLocation.setLongitude(location.getLon());
// sysLocation.setProvider(location.getProvider());
// sysLocation.setAccuracy(location.getAcceleration());
// sysLocation.setTime(location.duration);
// sysLocation.setBearing((float) location.getHeading());
// sysLocation.setSpeed(location.getSpeed());
// if (MogoCarLocationChangedListenerRegister.getInstance().getListener() != null) {
// MogoCarLocationChangedListenerRegister.getInstance().getListener().onCarLocationChanged2(sysLocation);
// }
if (checkAMapView() && mMapLoaded) {
// 地图初始化完成后每隔5s自动判断当前地图的模式
if (mIsFirstLocated) {
@@ -878,7 +826,7 @@ public class AMapViewWrapper implements IMogoMapView,
case 5:
return MAP_STYLE_VR_ANGLE_CROSS;
default:
throw new IllegalStateException("mode is unCorrect");
return MODE_MEDIUM_SIGHT;
}
}

View File

@@ -277,12 +277,17 @@ public class AMapWrapper implements IMogoMap {
@Override
public CenterLine getCenterLineRangeInfo(double lon, double lat, float angle, float distance) {
com.zhidaoauto.map.sdk.open.road.CenterLine info = MapDataApi.INSTANCE.getCenterLineRangeInfo(lon, lat, angle, distance);
CenterLine ret = null;
if (info != null) {
ret = new CenterLine(info.id, info.tile_id, info.road_id, info.lane_id, convert(info.points), info.angle == null ? 0f : info.angle);
try {
com.zhidaoauto.map.sdk.open.road.CenterLine info = MapDataApi.INSTANCE.getCenterLineRangeInfo(lon, lat, angle, distance);
CenterLine ret = null;
if (info != null) {
ret = new CenterLine(info.id, info.tile_id, info.road_id, info.lane_id, convert(info.points), info.angle == null ? 0f : info.angle);
}
return ret;
} catch (Throwable t) {
t.printStackTrace();
return null;
}
return ret;
}
@Override

View File

@@ -10,6 +10,10 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
/**
* 封装高德地图通过设备GPS获取到的位置信息频率1s一次坐标系为CJC20
* 这里的数据仅用于非高精度业务
*/
public class GDLocationClient implements AMapLocationListener, IMogoGDLocationClient {
private volatile static GDLocationClient gdLocationClient;