opt
This commit is contained in:
@@ -48,6 +48,7 @@ import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -381,9 +382,20 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom( boolean zoom ) {
|
||||
public MapControlResult changeZoom( boolean zoom ) {
|
||||
if ( checkAMapView() ) {
|
||||
mDefaultZoomLevel = ( int ) ( getMap().getZoomLevel() + 0.5f );
|
||||
|
||||
if ( zoom ) {
|
||||
if ( mDefaultZoomLevel >= 20 ) {
|
||||
return MapControlResult.TARGET;
|
||||
}
|
||||
} else {
|
||||
if ( mDefaultZoomLevel <= 3 ) {
|
||||
return MapControlResult.TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
if ( zoom ) {
|
||||
mDefaultZoomLevel += 2f;
|
||||
if ( mDefaultZoomLevel > 20 ) {
|
||||
@@ -397,15 +409,17 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
changeZoom( ( int ) mDefaultZoomLevel );
|
||||
}
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom( float zoom ) {
|
||||
public MapControlResult changeZoom( float zoom ) {
|
||||
Logger.d( TAG, "changeZoom %s", zoom );
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
getMap().changeZoom( zoom );
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.map.navi.MogoCalculatePath;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -180,27 +181,17 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
return;
|
||||
}
|
||||
checkAMapInstance();
|
||||
mAMap.animateCamera( CameraUpdateFactory.newLatLngBoundsRect(
|
||||
mAMap.moveCamera( CameraUpdateFactory.newLatLngBoundsRect(
|
||||
bounds,
|
||||
mBoundRect.left,
|
||||
mBoundRect.right,
|
||||
mBoundRect.top,
|
||||
mBoundRect.bottom ),
|
||||
new AMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
}
|
||||
} );
|
||||
mBoundRect.bottom ));
|
||||
UiThreadHandler.postDelayed( ()->{
|
||||
if ( after != null ) {
|
||||
after.run();
|
||||
}
|
||||
}, 2000 );
|
||||
}
|
||||
|
||||
private void checkAMapInstance() {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.MogoMap;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -59,17 +60,19 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom(boolean zoom) {
|
||||
public MapControlResult changeZoom( boolean zoom) {
|
||||
if (mClient != null) {
|
||||
mClient.changeZoom(zoom);
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom(float zoom) {
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
if (mClient != null) {
|
||||
mClient.changeZoom(zoom);
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,14 +27,14 @@ public interface IMogoMapUIController {
|
||||
/**
|
||||
* 地图缩放
|
||||
*
|
||||
* @param zoomIn true - 方法 false - 缩小
|
||||
* @param zoomIn true - 放大 false - 缩小
|
||||
*/
|
||||
void changeZoom( boolean zoomIn );
|
||||
MapControlResult changeZoom( boolean zoomIn );
|
||||
|
||||
/**
|
||||
* 修改缩放级别
|
||||
*/
|
||||
void changeZoom( float zoom );
|
||||
MapControlResult changeZoom( float zoom );
|
||||
|
||||
/**
|
||||
* 切换2D/3D模式
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-04-01
|
||||
* <p>
|
||||
* 地图控制结果
|
||||
*/
|
||||
public enum MapControlResult {
|
||||
|
||||
/**
|
||||
* 成功
|
||||
*/
|
||||
SUCCESS,
|
||||
|
||||
/**
|
||||
* 当前已经为预期结果
|
||||
*/
|
||||
TARGET,
|
||||
|
||||
/**
|
||||
* 失败
|
||||
*/
|
||||
FAIL,
|
||||
|
||||
/**
|
||||
* 错误,未执行
|
||||
*/
|
||||
ERROR
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -52,17 +53,19 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom(boolean zoom) {
|
||||
public MapControlResult changeZoom( boolean zoom) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.changeZoom(zoom);
|
||||
return mDelegate.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom(float zoom) {
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
if (mDelegate != null) {
|
||||
mDelegate.changeZoom(zoom);
|
||||
return mDelegate.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user