[Fix]
修复定位坐标系突然从GPS变成WGS84问题,原因是因为ALocationClient.mLastLocation被updateLocation修改了成了WGS84坐标系的经纬度了,我们项目中使用的是LocationListener.onLocationChanged回掉的GPS坐标系,所以导致有时候IMoGoMapLocationListener回调的onLocationChanged,经纬度异常 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -88,7 +88,12 @@ object CallerMapLocationListenerManager : CallerBase() {
|
||||
*/
|
||||
fun invokeMapLocationChangeListener(location: MogoLocation?) {
|
||||
//LogUtils.dTag(TAG, "mapStyleMode:$location")
|
||||
Log.w("DHY-location", "${location?.longitude},${location?.latitude} CallerMapLocationListenerManager-invokeMapLocationChangeListener")
|
||||
val longitude = "${location?.longitude}"
|
||||
if (longitude.length>12){
|
||||
Log.e("DHY-location", "${location?.longitude},${location?.latitude} CallerMapLocationListenerManager-invokeMapLocationChangeListener")
|
||||
}else{
|
||||
Log.w("DHY-location", "${location?.longitude},${location?.latitude} CallerMapLocationListenerManager-invokeMapLocationChangeListener")
|
||||
}
|
||||
mLocation = location
|
||||
mMapStyleChangeListeners.forEach {
|
||||
val tag = it.key
|
||||
|
||||
@@ -751,8 +751,9 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
|
||||
Log.w("DHY-location", location.getLon() + "," + location.getLat() + " AMapViewWrapper-onLocationChanged:");
|
||||
Log.w("DHY-location", location.getLon() + "," + location.getLat() + " AMapViewWrapper-onLocationChanged:location");
|
||||
MogoLocation mLastLocation = ObjectUtils.fromLocation(location);
|
||||
Log.w("DHY-location", mLastLocation.getLongitude() + "," + mLastLocation.getLatitude() + " AMapViewWrapper-onLocationChanged:mLastLocation");
|
||||
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation));
|
||||
|
||||
Location sysLocation = new Location(location.getProvider());
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( @NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location ) {
|
||||
Log.w("DHY-location", location.getLon() + "," + location.getLat() + " ALocationClient-onLocationChanged");
|
||||
Log.w("DHY-location", location.getLon() + "," + location.getLat() + " ALocationClient-onLocationChanged:location");
|
||||
if ( mIsDestroyed ) {
|
||||
destroyWarming();
|
||||
return;
|
||||
@@ -126,6 +126,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
}
|
||||
Trace.beginSection( "timer.onLocationChanged" );
|
||||
mLastLocation = ObjectUtils.fromLocation( location );
|
||||
Log.w("DHY-location", mLastLocation.getLongitude() + "," + mLastLocation.getLatitude() + " ALocationClient-onLocationChanged:mLastLocation");
|
||||
UiThreadHandler.post(() -> CallerMapLocationListenerManager.INSTANCE.invokeMapLocationChangeListener(mLastLocation));
|
||||
|
||||
Set< IMogoLocationListener > listeners = MogoLocationListenerRegister.getInstance().getListeners();
|
||||
@@ -152,16 +153,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
return;
|
||||
}
|
||||
if (locationToUpdate instanceof RTKAutopilotLocationBean) {
|
||||
MogoLocation last = getLastKnowLocation();
|
||||
RTKAutopilotLocationBean current = (RTKAutopilotLocationBean) locationToUpdate;
|
||||
boolean isNeedUpdate = (last == null || last.getLatitude() != current.getLat() || last.getLongitude() != current.getLon());
|
||||
if (!isNeedUpdate) {
|
||||
return;
|
||||
}
|
||||
if (last != null) {
|
||||
last.setLatitude(current.getLat());
|
||||
last.setLongitude(current.getLon());
|
||||
}
|
||||
if (mClient != null) {
|
||||
mClient.updateRTKAutoPilotLocation(current);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user