package com.mogo.map; import android.graphics.Point; import com.mogo.map.impl.amap.uicontroller.AMapUIController; import com.mogo.map.uicontroller.EnumMapUI; import com.mogo.map.uicontroller.IMogoMapUIController; /** * @author congtaowang * @since 2019-12-26 *
* 描述 */ public class MogoMapUIController implements IMogoMapUIController { private IMogoMapUIController mDelegate; private static volatile MogoMapUIController sInstance; private MogoMapUIController() { mDelegate = AMapUIController.getInstance(); } public static MogoMapUIController getInstance() { if (sInstance == null) { synchronized (MogoMapUIController.class) { if (sInstance == null) { sInstance = new MogoMapUIController(); } } } return sInstance; } public synchronized void release() { sInstance = null; } @Override public void setTrafficEnabled(boolean visible) { if (mDelegate != null) { mDelegate.setTrafficEnabled(visible); } } @Override public void changeZoom(boolean zoom) { if (mDelegate != null) { mDelegate.changeZoom(zoom); } } @Override public void changeZoom(float zoom) { if (mDelegate != null) { mDelegate.changeZoom(zoom); } } @Override public void changeMapMode(EnumMapUI mode) { if (mDelegate != null) { mDelegate.changeMapMode(mode); } } @Override public void moveToCenter(MogoLatLng latLng) { if (mDelegate != null) { mDelegate.moveToCenter(latLng); } } @Override public void showMyLocation(boolean visible) { if (mDelegate != null) { mDelegate.showMyLocation(visible); } } @Override public void recoverLockMode() { if (mDelegate != null) { mDelegate.recoverLockMode(); } } @Override public void displayOverview() { if (mDelegate != null) { mDelegate.displayOverview(); } } @Override public float getScalePerPixel() { if (mDelegate != null) { return mDelegate.getScalePerPixel(); } return 0; } @Override public float getZoomLevel() { if (mDelegate != null) { return mDelegate.getZoomLevel(); } return 0; } @Override public MogoLatLng getCameraNorthEastPosition() { if (mDelegate != null) { return mDelegate.getCameraNorthEastPosition(); } return null; } @Override public MogoLatLng getCameraSouthWestPosition() { if (mDelegate != null) { return mDelegate.getCameraSouthWestPosition(); } return null; } @Override public MogoLatLng getWindowCenterLocation() { if (mDelegate != null) { return mDelegate.getWindowCenterLocation(); } return null; } @Override public void setPointToCenter(double mapCenterX, double mapCenterY) { if (mDelegate != null) { mDelegate.setPointToCenter(mapCenterX, mapCenterY); } } @Override public Point getLocationPointInScreen( MogoLatLng latLng ) { if (mDelegate != null) { return mDelegate.getLocationPointInScreen(latLng); } return null; } }