解决首次打开无法刷新道路事件的问题。

This commit is contained in:
wangcongtao
2020-08-06 11:02:18 +08:00
parent 256c06f36b
commit 78d4d1d58f

View File

@@ -364,6 +364,7 @@ public class MogoServices implements IMogoMapListener,
if ( msg.obj instanceof RefreshObject ) {
RefreshObject ro = ( ( RefreshObject ) msg.obj );
if ( ro.mLonLat == null ) {
invokeAutoRefreshStrategy();
return;
}
mRefreshModel.refreshData( ro.mLonLat, ro.mRadius, ro.mAmount, ro.mCallback );
@@ -617,9 +618,7 @@ public class MogoServices implements IMogoMapListener,
// 自动刷新触发
final MogoLatLng point = new MogoLatLng( location.getLatitude(), location.getLongitude() );
if ( mLastAutoRefreshLocation == null ) {
mLastAutoRefreshLocation = point;
mLoopRequest = true;
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
startFirstLocationRequest( point );
return;
}
float distance = Utils.calculateLineDistance( mLastAutoRefreshLocation, point );
@@ -633,8 +632,27 @@ public class MogoServices implements IMogoMapListener,
}
}
/**
* 首次定位成功后,执行道路事件的刷新
*
* @param point
*/
private void startFirstLocationRequest( MogoLatLng point ) {
mLastAutoRefreshLocation = point;
mLoopRequest = true;
notifyRefreshData( mLastAutoRefreshLocation, getQueryRadius(), mAutoRefreshCallback );
}
@Override
public void onCarLocationChanged2( Location latLng ) {
if ( latLng == null ) {
return;
}
// poi 定位无法获取时,使用该定位
if ( mLastAutoRefreshLocation == null ) {
MogoLatLng point = new MogoLatLng( latLng.getLatitude(), latLng.getLongitude() );
startFirstLocationRequest( point );
}
}
@Override