[dev_arch_opt_3.0]
[Change] [ 1、删除旧版地图本定位注册 ] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -7,13 +7,11 @@ import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.map.IMogoMapService;
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager;
|
||||
import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.location.GDLocationClient;
|
||||
import com.mogo.map.location.IMogoGDLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
@@ -27,11 +25,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
@Route(path = MogoServicePaths.PATH_SERVICES_MAP)
|
||||
public class MogoMapService implements IMogoMapService {
|
||||
|
||||
@Override
|
||||
public IMogoLocationClient getSingletonLocationClient(Context context) {
|
||||
return MogoLocationClient.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMarkerManager getMarkerManager(Context context) {
|
||||
return MogoMarkerManager.getInstance(context);
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.content.Context;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService;
|
||||
import com.mogo.map.location.IMogoGDLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
@@ -17,15 +16,6 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
* 地图对外接口
|
||||
*/
|
||||
public interface IMogoMapService extends IProvider {
|
||||
|
||||
/**
|
||||
* 获取定位服务实例,全局唯一
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
IMogoLocationClient getSingletonLocationClient(Context context);
|
||||
|
||||
/**
|
||||
* marker 操作
|
||||
*
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.mogo.eagle.core.function.api.map.IMogoMapService
|
||||
import com.mogo.eagle.core.function.api.map.marker.IMogoMarkerService
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.map.location.IMogoGDLocationClient
|
||||
import com.mogo.map.location.IMogoLocationClient
|
||||
import com.mogo.map.marker.IMogoMarkerManager
|
||||
import com.mogo.map.overlay.IMogoOverlayManager
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController
|
||||
@@ -23,11 +22,6 @@ object CallerMapUIServiceManager {
|
||||
return serviceProvider?.mapUIController
|
||||
}
|
||||
|
||||
//todo 改造,module-map中监听location定位回调,调用至地图更新,解除map-api对caller的依赖关系
|
||||
fun getSingletonLocationClient(context: Context): IMogoLocationClient? {
|
||||
return serviceProvider?.getSingletonLocationClient(context)
|
||||
}
|
||||
|
||||
fun getMarkerManager(context: Context): IMogoMarkerManager? {
|
||||
return serviceProvider?.getMarkerManager(context)
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.map.listener;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarkerClickListenerRegister;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-29
|
||||
* <p>
|
||||
* 主模块需要注册监听的事件
|
||||
*/
|
||||
public interface IMogoHosListenerRegister extends
|
||||
IMogoMapListenerRegister,
|
||||
IMogoMarkerClickListenerRegister {
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.mogo.map.listener;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-29
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoHosListenerRegister implements IMogoHosListenerRegister {
|
||||
|
||||
private static volatile MogoHosListenerRegister sInstance;
|
||||
|
||||
private MogoHosListenerRegister() {
|
||||
}
|
||||
|
||||
public static MogoHosListenerRegister getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoHosListenerRegister.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoHosListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerHostMapListener(String tag, IMogoMapListener listener ) {
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterHostMapListener(String tag) {
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().unregisterHostMapListener(tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMarkerClickListener( String tag,IMogoMarkerClickListener listener ) {
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().registerMarkerClickListener(tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMarkerClickListener(String tag) {
|
||||
MogoMarkersHandler.Companion.getMogoMarkersHandler().unregisterMarkerClickListener(tag);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-19
|
||||
* <p>
|
||||
* 定位接口
|
||||
*/
|
||||
public interface IMogoLocationClient extends IMogoLocationListenerRegister {
|
||||
|
||||
/**
|
||||
* 开始定位
|
||||
*/
|
||||
void start();
|
||||
|
||||
/**
|
||||
* 开始定位
|
||||
*
|
||||
* @param interval 默认定位间隔
|
||||
*/
|
||||
void start( long interval );
|
||||
|
||||
/**
|
||||
* 停止定位
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* 返回上一次有效定位
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoLocation getLastKnowLocation();
|
||||
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* 更正最新的位置
|
||||
* @param locationToUpdate
|
||||
*/
|
||||
void updateLocation(Object locationToUpdate);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-19
|
||||
* <p>
|
||||
* 定位回调
|
||||
*/
|
||||
public interface IMogoLocationListener {
|
||||
|
||||
/**
|
||||
* 定位发生改变
|
||||
*
|
||||
* @param location 新定位点
|
||||
*/
|
||||
void onLocationChanged( MogoLocation location );
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 地图监听注册管理
|
||||
*/
|
||||
public interface IMogoLocationListenerRegister {
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void addLocationListener( IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
void removeLocationListener( IMogoLocationListener listener );
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-24
|
||||
* <p>
|
||||
* 地图监听注册管理
|
||||
*/
|
||||
public class MogoLocationListenerRegister implements IMogoLocationListenerRegister {
|
||||
|
||||
private static volatile MogoLocationListenerRegister sInstance;
|
||||
|
||||
private MogoLocationListenerRegister() {
|
||||
}
|
||||
|
||||
public static MogoLocationListenerRegister getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationListenerRegister.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationListenerRegister();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private final Set< IMogoLocationListener > sListeners = new HashSet<>( 10 );
|
||||
|
||||
/**
|
||||
* 注册定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.add( listener );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销定位回调
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( sListeners ) {
|
||||
sListeners.remove( listener );
|
||||
}
|
||||
}
|
||||
|
||||
public Set< IMogoLocationListener > getListeners() {
|
||||
return sListeners;
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapDevaListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast;
|
||||
@@ -981,7 +980,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
bean.setLat(lat);
|
||||
// 使用外部定位数据修改自车位置
|
||||
mMapView.getLocationClient().updateRTKAutoPilotLocation(bean);
|
||||
CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getContext()).updateLocation(bean);
|
||||
CallerMapDataCollectorManager.INSTANCE.setIsInit();
|
||||
}
|
||||
|
||||
@@ -1121,7 +1119,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
locationClient.updateLocation(lonLatPoint);//更新新自动驾驶RTK相关数据
|
||||
|
||||
CallerMapUIServiceManager.INSTANCE.getSingletonLocationClient(getContext()).updateLocation(lonLatPoint);
|
||||
CallerMapDataCollectorManager.INSTANCE.setIsInit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.map.location.ALocationClient;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.uicontroller.AMapUIController;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
@@ -32,17 +28,10 @@ public class CustomMapApiBuilder {
|
||||
return sApiBuilder;
|
||||
}
|
||||
|
||||
public IMogoLocationClient getLocationClient(Context context) {
|
||||
return new ALocationClient(context);
|
||||
}
|
||||
|
||||
public IMogoMapUIController getMapUIController() {
|
||||
return AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClientDelegate(Context context) {
|
||||
return getApiBuilder().getLocationClient(context);
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getMapUIControllerDelegate() {
|
||||
return getApiBuilder().getMapUIController();
|
||||
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocationListenerRegister;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-19
|
||||
* <p>
|
||||
*/
|
||||
public class MogoLocationClient implements IMogoLocationClient {
|
||||
|
||||
private static volatile MogoLocationClient sInstance;
|
||||
|
||||
public MogoLocationClient( Context context ) {
|
||||
mDelegate = CustomMapApiBuilder.getLocationClientDelegate( context );
|
||||
}
|
||||
|
||||
public static MogoLocationClient getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationClient.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationClient( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private IMogoLocationClient mDelegate;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start( long interval ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.start( interval );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
MogoLocationListenerRegister.getInstance().addLocationListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
MogoLocationListenerRegister.getInstance().removeLocationListener( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLocation getLastKnowLocation() {
|
||||
if ( mDelegate != null ) {
|
||||
return mDelegate.getLastKnowLocation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLocation(Object locationToUpdate) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.updateLocation(locationToUpdate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 道路数据缓存
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class RoadCacheWrapper {
|
||||
private List<LonLatPoint> road;
|
||||
private double lastDistanceDiff;
|
||||
private int roadLength = -1;
|
||||
|
||||
private float laneWidth = -1;
|
||||
|
||||
public RoadCacheWrapper(List<LonLatPoint> road) {
|
||||
setRoad(road);
|
||||
}
|
||||
|
||||
public List<LonLatPoint> getRoad() {
|
||||
return road;
|
||||
}
|
||||
|
||||
public void setRoad(List<LonLatPoint> road) {
|
||||
this.road = road;
|
||||
if(road!=null) {
|
||||
roadLength = road.size();
|
||||
}
|
||||
}
|
||||
|
||||
public double getLastDistanceDiff() {
|
||||
return lastDistanceDiff;
|
||||
}
|
||||
|
||||
public void setLastDistanceDiff(double lastDistanceDiff) {
|
||||
this.lastDistanceDiff = lastDistanceDiff;
|
||||
}
|
||||
|
||||
public double getLastLat(){
|
||||
if (roadLength != -1) {
|
||||
return road.get(roadLength - 1).getLatitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public double getLastLon(){
|
||||
if (roadLength != -1) {
|
||||
return road.get(roadLength - 1).getLongitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getLaneWidth() {
|
||||
return laneWidth;
|
||||
}
|
||||
|
||||
public void setLaneWidth(float laneWidth) {
|
||||
this.laneWidth = laneWidth;
|
||||
}
|
||||
|
||||
public boolean inCache(double lon, double lat) {
|
||||
if (roadLength > 0) {
|
||||
LonLatPoint start = road.get(0);
|
||||
LonLatPoint end = road.get(roadLength - 1);
|
||||
boolean latInRoad = false;
|
||||
boolean lonInRoad = false;
|
||||
if (start.getLatitude() > end.getLatitude()) {
|
||||
latInRoad = lat <= start.getLatitude() && lat >= end.getLatitude();
|
||||
}else{
|
||||
latInRoad = lat >= start.getLatitude() && lat <= end.getLatitude();
|
||||
}
|
||||
|
||||
if (start.getLongitude() > end.getLongitude()) {
|
||||
lonInRoad = lon <= start.getLongitude() && lon >= end.getLongitude();
|
||||
}else{
|
||||
lonInRoad = lon >= start.getLongitude() && lon <= end.getLongitude();
|
||||
}
|
||||
|
||||
return latInRoad && lonInRoad;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package com.mogo.map.location;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Trace;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapLocationListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.utils.ObjectUtils;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationClient;
|
||||
import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
import com.zhidaoauto.map.sdk.open.location.RTKAutopilotLocationBean;
|
||||
import com.zhidaoauto.map.sdk.open.query.LonLatPoint;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-19
|
||||
* <p>
|
||||
* 自研定位
|
||||
*/
|
||||
public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
private static final String TAG = "ALocationClient";
|
||||
|
||||
private MogoLocation mLastLocation;
|
||||
private final LocationListener mListener = new InternalLocationListener();
|
||||
|
||||
private boolean mIsDestroyed = false;
|
||||
|
||||
public ALocationClient( Context context ) {
|
||||
mClient = new LocationClient( context );
|
||||
mClient.registerListener( mListener );
|
||||
mLastLocation = ObjectUtils.fromLocation( mClient.getLastKnownMogoLocation() );
|
||||
if ( mLastLocation == null ) {
|
||||
mLastLocation = new MogoLocation();
|
||||
}
|
||||
}
|
||||
|
||||
private LocationClient mClient;
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
start( 2_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start( long interval ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( mClient != null ) {
|
||||
mClient.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( mClient != null && mClient.isAGpsStarted() ) {
|
||||
mClient.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addLocationListener( IMogoLocationListener listener ) {
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeLocationListener( IMogoLocationListener listener ) {
|
||||
// do not impl.
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLocation getLastKnowLocation() {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return null;
|
||||
}
|
||||
return mLastLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void destroy() {
|
||||
mIsDestroyed = true;
|
||||
if ( mClient != null ) {
|
||||
mClient.unRegisterListener( mListener );
|
||||
mClient.destory();
|
||||
}
|
||||
mClient = null;
|
||||
mLastLocation = null;
|
||||
}
|
||||
|
||||
private class InternalLocationListener implements LocationListener {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) {
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
}
|
||||
if ( location == null ||
|
||||
location.getLat() == 0.0D ||
|
||||
location.getLon() == 0.0D ) {
|
||||
return;
|
||||
}
|
||||
Trace.beginSection( "timer.onLocationChanged" );
|
||||
mLastLocation = ObjectUtils.fromLocation( location );
|
||||
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation, 0, false));
|
||||
|
||||
Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners();
|
||||
synchronized ( listeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = listeners.iterator();
|
||||
while ( listenerIterator.hasNext() ) {
|
||||
listenerIterator.next().onLocationChanged( mLastLocation.clone() );
|
||||
}
|
||||
}
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
private void destroyWarming() {
|
||||
CallerLogger.INSTANCE.w( TAG, "location client has destroyed." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLocation(Object locationToUpdate) {
|
||||
if (locationToUpdate == null) {
|
||||
return;
|
||||
}
|
||||
if (locationToUpdate instanceof MogoLocation) {
|
||||
return;
|
||||
}
|
||||
// if (locationToUpdate instanceof RTKAutopilotLocationBean) {
|
||||
// RTKAutopilotLocationBean current = (RTKAutopilotLocationBean) locationToUpdate;
|
||||
// if (mClient != null) {
|
||||
// mClient.updateRTKAutoPilotLocation(current);
|
||||
// }
|
||||
// }
|
||||
if (locationToUpdate instanceof com.zhidaoauto.map.sdk.open.query.LonLatPoint) {
|
||||
LonLatPoint current = (LonLatPoint) locationToUpdate;
|
||||
if (mClient != null) {
|
||||
mClient.updateLocation(current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user