[Update]Map按照新架构重构
This commit is contained in:
@@ -0,0 +1,386 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-26
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
private static final String TAG = "AMapUIController";
|
||||
|
||||
private static volatile AMapUIController sInstance;
|
||||
|
||||
private IMogoMapUIController mClient;
|
||||
|
||||
private AMapUIController() {
|
||||
}
|
||||
|
||||
public static AMapUIController getInstance() {
|
||||
if (sInstance == null) {
|
||||
synchronized (AMapUIController.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AMapUIController();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void initClient(IMogoMapUIController client) {
|
||||
this.mClient = client;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.setTrafficEnabled(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom(boolean zoom) {
|
||||
if (mClient != null) {
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom(float zoom) {
|
||||
if (mClient != null) {
|
||||
return mClient.changeZoom(zoom);
|
||||
}
|
||||
return MapControlResult.ERROR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapMode(EnumMapUI mode) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapVisualAngle(angelMode, mogoLatLng);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisualAngleMode getCurrentMapVisualAngle() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCurrentMapVisualAngle();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng, boolean animate) {
|
||||
if (mClient != null) {
|
||||
mClient.moveToCenter(latLng, animate);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.showMyLocation(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation(View view) {
|
||||
if (mClient != null) {
|
||||
mClient.showMyLocation(view);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverLockMode() {
|
||||
if (mClient != null) {
|
||||
mClient.recoverLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseLockMode() {
|
||||
if (mClient != null) {
|
||||
mClient.loseLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
if (mClient != null) {
|
||||
mClient.setLockZoom(var1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview(Rect bounds) {
|
||||
if (mClient != null) {
|
||||
mClient.displayOverview(bounds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
if (mClient != null) {
|
||||
return mClient.getScalePerPixel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
if (mClient != null) {
|
||||
return mClient.getZoomLevel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRoadWidth(double lon, double lat, float angle, boolean isGpsLocation, boolean isRTK) {
|
||||
if (mClient != null) {
|
||||
return mClient.getRoadWidth(lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraNorthEastPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraSouthWestPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getWindowCenterLocation() {
|
||||
if (mClient != null) {
|
||||
return mClient.getWindowCenterLocation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointToCenter(double mapCenterX, double mapCenterY) {
|
||||
if (mClient != null) {
|
||||
mClient.setPointToCenter(mapCenterX, mapCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getLocationPointInScreen(MogoLatLng latLng) {
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationPointInScreen(latLng);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationMogoLatLngInScreen(point);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setRenderFps(int fps) {
|
||||
if (mClient != null) {
|
||||
mClient.setRenderFps(fps);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition) {
|
||||
if (mClient != null) {
|
||||
mClient.showBounds(tag, carPosition, lonLats, bound, lockCarPosition);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceRender() {
|
||||
if (mClient != null) {
|
||||
mClient.forceRender();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception {
|
||||
if (mClient != null) {
|
||||
return mClient.calculateLineDistance(p1, p2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
if (mClient != null) {
|
||||
return mClient.getCurrentUiMode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation(Location location) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMyLocation(location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCarLocked() {
|
||||
if (mClient != null) {
|
||||
return mClient.isCarLocked();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption(CarCursorOption option) {
|
||||
if (mClient != null) {
|
||||
mClient.setCarCursorOption(option);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCameraPosition getMapCameraPosition() {
|
||||
if (mClient != null) {
|
||||
return mClient.getMapCameraPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeBearing(float bearing) {
|
||||
if (mClient != null) {
|
||||
mClient.changeBearing(bearing);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapViewAngle(int type) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapViewAngle(type);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCurrentIcon(int iconId) {
|
||||
if (mClient != null) {
|
||||
mClient.changeCurrentIcon(iconId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTileId(double lon, double lat) {
|
||||
return MapAutoApi.INSTANCE.getTileID(lon, lat, 13); // 13为默认获取瓦片层级级别
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpeedLimmit(double lon, double lat, float angle) {
|
||||
return mClient.getSpeedLimmit(lon, lat, angle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emphasizeMyLocation() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rtkEnable(boolean enable) {
|
||||
if (mClient != null) {
|
||||
mClient.rtkEnable(enable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncLocation2Map(JSONObject data) {
|
||||
if (mClient != null) {
|
||||
mClient.syncLocation2Map(data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncLocation2Map(MessagePad.GnssInfo gnssInfo) {
|
||||
if (mClient != null) {
|
||||
mClient.syncLocation2Map(gnssInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openVrMode(boolean zoomGestureEnable) {
|
||||
if (mClient != null) {
|
||||
mClient.openVrMode(zoomGestureEnable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isGpsLocation, boolean isRTK) {
|
||||
if (mClient != null) {
|
||||
return mClient.matchRoad(id, lon, lat, angle, isGpsLocation, isRTK);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMarkerInfoResName(String speedVal) {
|
||||
if (mClient != null) {
|
||||
return mClient.getMarkerInfoResName(speedVal);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMarkerInfoResName(String speedVal, String val) {
|
||||
if (mClient != null) {
|
||||
mClient.setMarkerInfoResName(speedVal, val);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearRoadCacheById(String id) {
|
||||
if (mClient != null) {
|
||||
mClient.clearRoadCacheById(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMapDAngle(float angle) {
|
||||
if (mClient != null) {
|
||||
mClient.setMapDAngle(angle);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user