@@ -436,7 +436,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
Logger.d(TAG, "move to center %s", latLng);
|
||||
if (latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d) {
|
||||
if (latLng == null || latLng.lat == 0.0d || latLng.lon == 0.0d) {
|
||||
Logger.e(TAG, "latlng = null or is illegal");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,24 +53,24 @@ public class MogoMapUtils {
|
||||
|
||||
if ( latLngBounds.getNortheast() == null ) {
|
||||
dLat = Math.abs( carPosition.lat - latLngBounds.getSouthwest().getLatitude() );
|
||||
dLon = Math.abs( carPosition.lng - latLngBounds.getSouthwest().getLongitude() );
|
||||
dLon = Math.abs( carPosition.lon - latLngBounds.getSouthwest().getLongitude() );
|
||||
} else if ( latLngBounds.getSouthwest() == null ) {
|
||||
dLat = Math.abs( carPosition.lat - latLngBounds.getNortheast().getLatitude() );
|
||||
dLon = Math.abs( carPosition.lng - latLngBounds.getNortheast().getLongitude() );
|
||||
dLon = Math.abs( carPosition.lon - latLngBounds.getNortheast().getLongitude() );
|
||||
} else {
|
||||
final double dLat1 = Math.abs( carPosition.lat - latLngBounds.getSouthwest().getLatitude() );
|
||||
final double dLon1 = Math.abs( carPosition.lng - latLngBounds.getSouthwest().getLongitude() );
|
||||
final double dLon1 = Math.abs( carPosition.lon - latLngBounds.getSouthwest().getLongitude() );
|
||||
final double dLat2 = Math.abs( carPosition.lat - latLngBounds.getNortheast().getLatitude() );
|
||||
final double dLon2 = Math.abs( carPosition.lng - latLngBounds.getNortheast().getLongitude() );
|
||||
final double dLon2 = Math.abs( carPosition.lon - latLngBounds.getNortheast().getLongitude() );
|
||||
dLat = dLat1 > dLat2 ? dLat1 : dLat2;
|
||||
dLon = dLon1 > dLon2 ? dLon1 : dLon2;
|
||||
}
|
||||
|
||||
west = carPosition.lat - dLat;
|
||||
south = carPosition.lng + dLon;
|
||||
south = carPosition.lon + dLon;
|
||||
|
||||
east = carPosition.lat + dLat;
|
||||
north = carPosition.lng - dLon;
|
||||
north = carPosition.lon - dLon;
|
||||
|
||||
if ( south == 0.0 || west == 0.0 || east == 0.0 || north == 0.0 ) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user