fix bug and add note

This commit is contained in:
zhongchao
2021-04-15 11:02:40 +08:00
parent 679e183859
commit 88886e9fcf
4 changed files with 162 additions and 178 deletions

View File

@@ -109,11 +109,6 @@ public class MogoServices implements IMogoMapListener,
return InstanceHolder.INSTANCE;
}
private Object readResolve() {
// 阻止反序列化,必须实现 Serializable 接口
return InstanceHolder.INSTANCE;
}
private static final String TAG = "MogoServices";
/**
@@ -238,7 +233,7 @@ public class MogoServices implements IMogoMapListener,
/**
* 手动刷新回调
*/
private RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() {
private final RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() {
@Override
public void onSuccess( MarkerResponse o ) {
MapMarkerManager.getInstance().onSyncMarkerResponse( o );
@@ -616,16 +611,13 @@ public class MogoServices implements IMogoMapListener,
private int getQueryRadius() {
mCameraSouthWestPosition = mUiController.getCameraSouthWestPosition();
mCameraNorthEastPosition = mUiController.getCameraNorthEastPosition();
int radius = 0;
int radius;
if ( mIsVertical ) {
radius = ( ( int ) ( getMapCameraFactWidth() / 2 ) );
} else {
radius = ( ( int ) ( getMapCameraFactHeight() / 2 ) );
}
if ( radius < 1000 ) {
return 1_000;
}
return radius;
return Math.max(radius, 1000);
}
/**
@@ -633,7 +625,7 @@ public class MogoServices implements IMogoMapListener,
*/
private boolean invokeRefreshWhenTranslationByUser( MogoLatLng latLng ) {
try {
float factor = 0.0f;
float factor;
if ( mIsVertical ) {
factor = getMapCameraFactWidth();
} else {
@@ -697,7 +689,7 @@ public class MogoServices implements IMogoMapListener,
/**
* 首次定位成功后,执行道路事件的刷新
*
* @param point
* @param point {@link MogoLatLng}
*/
private void startFirstLocationRequest( MogoLatLng point ) {
mLastAutoRefreshLocation = point;

View File

@@ -58,19 +58,21 @@ public class MogoRTKLocation {
return criteria;
}
private LocationListener locationListener = new LocationListener() {
private final LocationListener locationListener = new LocationListener() {
@Override
public void onLocationChanged( Location location ) {
if ( location != null ) {
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
cloudLocationInfo.setAlt( location.getAltitude() );
cloudLocationInfo.setHeading( location.getBearing() );
cloudLocationInfo.setLat( location.getLatitude() );
cloudLocationInfo.setLon( location.getLongitude() );
cloudLocationInfo.setSpeed( location.getSpeed() );
cloudLocationInfo.setSatelliteTime( location.getTime() );
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo );
if(location.getLatitude() != 0.0 && location.getLongitude() != 0.0){
cloudLocationInfo.setLat( location.getLatitude() );
cloudLocationInfo.setLon( location.getLongitude() );
cloudLocationInfo.setSpeed( location.getSpeed() );
cloudLocationInfo.setSatelliteTime( location.getTime() );
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo );
}
} else {
Logger.e( TAG, "location == null" );
}