[3.4.0-map-sdk] wait

This commit is contained in:
zhongchao
2023-08-28 16:52:01 +08:00
parent 7865da2347
commit b421d2dc3f
19 changed files with 48 additions and 1085 deletions

View File

@@ -41,7 +41,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapRomaListener;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
import com.mogo.map.hdcache.IHdCacheListener;
import com.mogo.map.identify.MogoIdentifyManager;
import com.mogo.map.listener.MogoMapListenerHandler;
import com.mogo.map.location.GDLocationClient;
@@ -112,10 +111,8 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
private volatile EnumMapUI mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR;
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
private IHdCacheListener hdCacheListener;
public AMapViewWrapper(MapAutoView mMapView) {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--AMapViewWrapper: init");
CallerLogger.INSTANCE.i(M_MAP + TAG, "AMapViewWrapper: init");
this.mMapView = mMapView;
initViews();
initListeners();
@@ -165,28 +162,6 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
CallerLogger.INSTANCE.d(M_MAP + TAG, "styleop - initListeners - setOnMapStyleListener - view " + mMapView);
}
private void initMapView() {
if (mMapView == null) {
return;
}
MapAutoViewHelper options = mMapView.getMapAutoViewHelper();
if (options != null) {
options.setScaleVRMode(true);
}
//todo configStartUp配置
ThreadUtils.getIoPool().submit(() -> {
if (options != null) {
// if (options.getMyLocationStyle() != null) {
// //是否显示光圈,耗时
// options.getMyLocationStyle().setDisplayAnimEnable(true);
// }
//修改自车模型,未来需区分车的类型
options.setMyLocationStyle(options.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true));
}
});
}
private Context getContext() {
return mMapView.getContext();
}
@@ -264,10 +239,7 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
@Override
public void onRoadIdInfo(@androidx.annotation.Nullable String roadId, @androidx.annotation.Nullable String s1) {
if (roadId != null && !TextUtils.isEmpty(roadId)) {
// CallerLogger.INSTANCE.d(M_MAP + TAG, "onRoadIdInfo::" + roadId);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnRoadIdGet(roadId);
} else {
//CallerLogger.INSTANCE.d(M_MAP + TAG, "onRoadIdInfo::null");
}
}
@@ -276,19 +248,20 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
}
//todo 多实例 对象替换
@Override
public void onStopLineInfo(@androidx.annotation.Nullable StopLine stopLine) {
MogoLocation carLoc = CallerChassisLocationWGS84ListenerManager.INSTANCE.getChassisLocationWGS84();
if (stopLine != null && stopLine.getRoad_id() != null && !stopLine.getRoad_id().isEmpty() && stopLine.getPoints() != null && stopLine.getPoints().size() > 0) {
ArrayList<LonLatPoint> points = stopLine.getPoints();
if (carLoc != null) {
// //CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo:stop_line" + stopLine + ", car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo:stop_line" + stopLine);
MapRoadInfo.StopLine stopInfo = convert(stopLine);
LonLatPoint p1 = points.get(0);
LonLatPoint p2 = points.get(points.size() - 1);
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.getLongitude(), p1.getLatitude(), p2.getLongitude(), p2.getLatitude()) * 10_0000;
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
//CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
CallerLogger.INSTANCE.d(M_MAP + TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnStopLineGet(stopInfo);
}
} else {
@@ -324,15 +297,19 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
@Override
public MapControlResult changeZoom(float zoom) {
CallerLogger.INSTANCE.d(M_MAP + TAG, "changeZoom : " + zoom);
getMap().changeZoom(zoom);
MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper();
if (mapAutoViewHelper != null) {
mapAutoViewHelper.setZoom((int) zoom);
}
return MapControlResult.SUCCESS;
}
@Override
public void changeZoom2(float zoom) {
CallerLogger.INSTANCE.d(M_MAP + TAG, "changeZoom2 : " + zoom);
getMap().changeZoom2(zoom);
MapAutoViewHelper mapAutoViewHelper = mMapView.getMapAutoViewHelper();
if (mapAutoViewHelper != null) {
mapAutoViewHelper.setZoomVal(zoom);
}
}
@Override
@@ -461,12 +438,18 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
@Override
public float getScalePerPixel() {
return getMap().getScalePerPixel();
if (checkAMapView()) {
return mMapView.getMapAutoViewHelper().getScalePerPixel();
}
return 0.0f;
}
@Override
public float getZoomLevel() {
return getMap().getZoomLevel();
if (checkAMapView()) {
return mMapView.getMapAutoViewHelper().getZoom();
}
return 0.0f;
}
@Override
@@ -668,7 +651,7 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
)
@Override
public void onMapInit() {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapInit: ");
CallerLogger.INSTANCE.i(M_MAP + TAG, "onMapInit: ");
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapLoaded();
}
@@ -681,14 +664,13 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
)
@Override
public void onMapLoaded() {
CallerLogger.INSTANCE.i(M_MAP + TAG, "autoop--onMapLoaded: ");
CallerLogger.INSTANCE.i(M_MAP + TAG, "onMapLoaded: ");
if (checkAMapView()) {
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().onMapChanged(ObjectUtils.fromAMap(cameraPosition.getTarget()),
cameraPosition.getZoom(),
cameraPosition.getTilt(),
cameraPosition.getBearing());
initMapView();
loadPreVehicleModel();
}
}
@@ -805,16 +787,8 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
@Override
public void stepInVrMode(boolean isDayMode) {
// try {
// int mapStyle;
// if (isDayMode) {
// mCurrentUI = EnumMapUI.MAP_STYLE_DAY_VR;
// mapStyle = MapAutoApi.MAP_STYLE_DAY_VR;
// } else {
// mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR;
// mapStyle = MapAutoApi.MAP_STYLE_NIGHT_VR;
// }
// if (mMapView != null && mMapView.getMapAutoViewHelper() != null) {
// mMapView.getMapAutoViewHelper().setMapStyle(mapStyle);
// mMapView.getMapAutoViewHelper().setMapStyle();
// }
// } catch (Exception e) {
// e.printStackTrace();
@@ -872,13 +846,11 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
if (isDayMode()) {
preVehicleStrWeiZhi =
// 添加模型到地图中
MogoIdentifyManager.getInstance()
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DIconId());
getMap().addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DIconId());
} else {
preVehicleStrWeiZhi =
// 添加模型到地图中
MogoIdentifyManager.getInstance()
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DNightIconId());
getMap().addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DNightIconId());
}
CallerLogger.INSTANCE.d(M_MAP + TAG, logMsg + preVehicleStrWeiZhi);
@@ -962,18 +934,25 @@ public class AMapViewWrapper implements IMogoMapView, //代理地图实例和接
@Override
public void animateTo(double lon, double lat, float rotateAngle, int duration, boolean isGps) {
if (mMapView.getMapAutoViewHelper() != null) {
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().animateTo(lon, lat, rotateAngle, duration, isGps);
}
}
@Override
public void animateTo(double lon, double lat, float v1, float v2, float v3, float v4, int duration, boolean isGps) {
if (mMapView.getMapAutoViewHelper() != null) {
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().animateTo(lon, lat, v1, v2, v3, v4, duration, isGps);
}
}
@Override
public void clear() {
if(checkAMapView()){
mMapView.getMapAutoViewHelper().clearPanel();
}
}
@Override
public void onRoadLoaded(@androidx.annotation.Nullable String roadInfo) {

View File

@@ -1,24 +1,19 @@
package com.mogo.map;
import android.annotation.SuppressLint;
import android.graphics.Point;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.overlay.proxy.line.IMapPolylineOverlay;
import com.mogo.map.overlay.proxy.point.IMapPointOverlay;
import com.mogo.map.overlay.wrapper.point.AMapPointWrapper;
import com.mogo.map.uicontroller.AMapUIController;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.utils.ObjectUtils;
import com.zhidaoauto.map.data.point.LonLatPoint;
import com.zhidaoauto.map.data.road.CenterLine;
import com.zhidaoauto.map.sdk.open.marker.BatchMarkerOptions;
import com.zhidaoauto.map.sdk.open.marker.Marker;
import com.zhidaoauto.map.sdk.open.marker.MarkerOptions;
import com.zhidaoauto.map.sdk.open.marker.MarkerSimpleData;
import com.zhidaoauto.map.sdk.open.poyline.Polyline;
import com.zhidaoauto.map.sdk.open.poyline.PolylineOptions;
import com.zhidaoauto.map.sdk.open.tools.MapTools;
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
@@ -48,9 +43,6 @@ public class AMapWrapper implements IMogoMap {
this.mAMap = map;
this.mMapView = mapView;
mMapUIController = controller;
// 设置实现自定义 info window
// MapAutoApi.INSTANCE.setInfoWindowAdapter(new AMapInfoWindowAdapter());
AMapUIController.getInstance().initClient(mMapUIController);
}
@Override
@@ -193,64 +185,6 @@ public class AMapWrapper implements IMogoMap {
}
}
@Override
public void clear() {
if (checkAMap()) {
mAMap.clearPanel();
}
}
@Override
public void clear(boolean isKeepMyLocationOverlay) {
if (checkAMap()) {
mAMap.clearPanel();
}
}
@Override
public void setPointToCenter(int x, int y) {
if (checkAMap()) {
LonLatPoint lonLatPoint = MapTools.INSTANCE.fromScreenLocation(new Point(x, y), mMapView.getMapController());
mAMap.setCenter(lonLatPoint);
}
}
@Override
public float getScalePerPixel() {
if (checkAMap()) {
return mAMap.getScalePerPixel();
}
return 0;
}
@Override
public void changeZoom(float zoom) {
CallerLogger.INSTANCE.d(TAG, "changeZoom %s", zoom);
if (checkAMap()) {
mAMap.setZoom((int) zoom);
}
}
@Override
public void changeZoom2(float zoom) {
CallerLogger.INSTANCE.d(TAG, "changeZoom %s", zoom);
if (checkAMap()) {
mAMap.setZoomVal(zoom);
}
}
@Override
public float getZoomLevel() {
if (checkAMap()) {
try {
return mAMap.getZoom();
} catch (Exception ignored) {
}
}
return 0;
}
private boolean checkAMap() {
mAMap = mMapView.getMapAutoViewHelper();
if (mAMap == null) {

View File

@@ -1,423 +0,0 @@
package com.mogo.map;
import android.graphics.Point;
import android.graphics.Rect;
import android.view.View;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.uicontroller.AMapUIController;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.map.uicontroller.VisualAngleMode;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-26
* <p>
* 地图控制
*/
public class MogoMapUIController implements IMogoMapUIController {
private static final String TAG = "MogoMapUIController";
private IMogoMapUIController mDelegate;
private static volatile MogoMapUIController sInstance;
private MogoMapUIController() {
initDelegate();
}
private void initDelegate() {
if (mDelegate == null) {
mDelegate = AMapUIController.getInstance();
}
}
public static MogoMapUIController getInstance() {
if (sInstance == null) {
synchronized (MogoMapUIController.class) {
if (sInstance == null) {
sInstance = new MogoMapUIController();
}
}
}
return sInstance;
}
public static synchronized void release() {
sInstance = null;
}
@Override
public MapControlResult changeZoom(float zoom) {
initDelegate();
if (mDelegate != null) {
return mDelegate.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public void changeZoom2(float zoom) {
initDelegate();
if (mDelegate != null) {
mDelegate.changeZoom2(zoom);
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
initDelegate();
if (mDelegate != null) {
CallerLogger.INSTANCE.d(TAG, "set VisualAngle: " + angelMode.name());
mDelegate.changeMapVisualAngle(angelMode, mogoLatLng);
}
}
@Override
public void setRoamTrajectory(String trajectory) {
initDelegate();
if (mDelegate != null) {
mDelegate.setRoamTrajectory(trajectory);
}
}
@Override
public void setRomaMode(int mode) {
initDelegate();
if (mDelegate != null) {
CallerLogger.INSTANCE.d(TAG, "set setRomaMode: " + mode);
mDelegate.setRomaMode(mode);
}
}
@Override
public VisualAngleMode getCurrentMapVisualAngle() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getCurrentMapVisualAngle();
}
return null;
}
@Override
public void moveToCenter(MogoLatLng latLng, boolean animate) {
initDelegate();
if (mDelegate != null) {
mDelegate.moveToCenter(latLng, animate);
}
}
@Override
public boolean isDayMode() {
initDelegate();
if (mDelegate != null) {
return mDelegate.isDayMode();
}
return false;
}
@Override
public void showMyLocation(boolean visible) {
initDelegate();
if (mDelegate != null) {
mDelegate.showMyLocation(visible);
}
}
@Override
public void showMyLocation(View view) {
initDelegate();
if (mDelegate != null) {
mDelegate.showMyLocation(view);
}
}
@Override
public float getScalePerPixel() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getScalePerPixel();
}
return 0;
}
@Override
public float getZoomLevel() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getZoomLevel();
}
return 0;
}
@Override
public MogoLatLng getCameraNorthEastPosition() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getCameraNorthEastPosition();
}
return null;
}
@Override
public MogoLatLng getCameraSouthWestPosition() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getCameraSouthWestPosition();
}
return null;
}
@Override
public MogoLatLng getWindowCenterLocation() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getWindowCenterLocation();
}
return null;
}
@Override
public void setPointToCenter(double mapCenterX, double mapCenterY) {
initDelegate();
if (mDelegate != null) {
mDelegate.setPointToCenter(mapCenterX, mapCenterY);
}
}
@Override
public Point getLocationPointInScreen(MogoLatLng latLng) {
initDelegate();
if (mDelegate != null) {
return mDelegate.getLocationPointInScreen(latLng);
}
return null;
}
@Override
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
initDelegate();
if (mDelegate != null) {
return mDelegate.getLocationMogoLatLngInScreen(point);
}
return null;
}
@Override
public void setRenderFps(int fps) {
initDelegate();
if (mDelegate != null) {
mDelegate.setRenderFps(fps);
}
}
@Override
public void showBounds(String tag, MogoLatLng carPosition, List<MogoLatLng> lonLats, Rect bound, boolean lockCarPosition) {
initDelegate();
if (mDelegate != null) {
mDelegate.showBounds(tag, carPosition, lonLats, bound, lockCarPosition);
}
}
@Override
public void forceRender() {
initDelegate();
if (mDelegate != null) {
mDelegate.forceRender();
}
}
@Override
public float calculateLineDistance(MogoLatLng p1, MogoLatLng p2) throws Exception {
initDelegate();
if (mDelegate != null) {
return mDelegate.calculateLineDistance(p1, p2);
}
return 0;
}
@Override
public boolean isCarLocked() {
initDelegate();
if (mDelegate != null) {
return mDelegate.isCarLocked();
}
return false;
}
@Override
public void setCarCursorOption(CarCursorOption option) {
initDelegate();
if (mDelegate != null) {
mDelegate.setCarCursorOption(option);
}
}
@Override
public void setCarLightsType(int type, int time) {
initDelegate();
if (mDelegate != null) {
mDelegate.setCarLightsType(type, time);
}
}
@Override
public MapCameraPosition getMapCameraPosition() {
initDelegate();
if (mDelegate != null) {
return mDelegate.getMapCameraPosition();
}
return null;
}
@Override
public void changeBearing(float bearing) {
initDelegate();
if (mDelegate != null) {
mDelegate.changeBearing(bearing);
}
}
@Override
public void changeCurrentIcon(int iconId) {
initDelegate();
if (mDelegate != null) {
mDelegate.changeCurrentIcon(iconId);
}
}
@Override
public void rtkEnable(boolean enable) {
initDelegate();
if (mDelegate != null) {
mDelegate.rtkEnable(enable);
}
}
@Override
public void destroy() {
mDelegate = null;
}
@Override
public void stepInVrMode(boolean isDayMode) {
initDelegate();
if (mDelegate != null) {
mDelegate.stepInVrMode(isDayMode);
}
}
@Override
public String getMarkerInfoResName(String speedVal) {
initDelegate();
if (mDelegate != null) {
return mDelegate.getMarkerInfoResName(speedVal);
}
return null;
}
@Override
public void setMarkerInfoResName(String speedVal, String val) {
initDelegate();
if (mDelegate != null) {
mDelegate.setMarkerInfoResName(speedVal, val);
}
}
@Override
public void setMapDAngle(float angle) {
initDelegate();
if (mDelegate != null) {
mDelegate.setMapDAngle(angle);
}
}
@Override
public void setLockMode(boolean isLock) {
initDelegate();
if (mDelegate != null) {
mDelegate.setLockMode(isLock);
}
}
@Override
public void setScrollGesturesEnable(boolean isEnable) {
initDelegate();
if (mDelegate != null) {
mDelegate.setScrollGesturesEnable(isEnable);
}
}
@Override
public void setAllGesturesEnabled(boolean isEnable) {
initDelegate();
if (mDelegate != null) {
mDelegate.setAllGesturesEnabled(isEnable);
}
}
@Override
public void setExtraGPSData(MogoLocation gnssInfo) {
initDelegate();
if (mDelegate != null) {
mDelegate.setExtraGPSData(gnssInfo);
}
}
@Override
public void setIsDrawPointCloud(Boolean isDrawPointCloud) {
initDelegate();
if (mDelegate != null) {
mDelegate.setIsDrawPointCloud(isDrawPointCloud);
}
}
@Override
public void setPointCloudSize(Float pointCloudSize) {
initDelegate();
if (mDelegate != null) {
mDelegate.setPointCloudSize(pointCloudSize);
}
}
@Override
public void setPointCloudColor(String color) {
initDelegate();
if (mDelegate != null) {
mDelegate.setPointCloudColor(color);
}
}
@Override
public String getCityCode() {
if (mDelegate != null) {
return mDelegate.getCityCode();
}
return null;
}
@Override
public void animateTo(double lon, double lat, float rotateAngle, int duration, boolean isGps) {
if (mDelegate != null) {
mDelegate.animateTo(lon, lat, rotateAngle, duration, isGps);
}
}
@Override
public void animateTo(double lon, double lat, float v1, float v2, float v3, float v4, int duration, boolean isGps) {
if (mDelegate != null) {
mDelegate.animateTo(lon, lat, v1, v2, v3, v4, duration, isGps);
}
}
}

View File

@@ -9,6 +9,7 @@ import android.widget.FrameLayout;
import androidx.annotation.Nullable;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.map.MogoLocation;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.map.uicontroller.IMogoMapUIController;
@@ -55,6 +56,7 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
if (mapAutoView.getMapStyleParams() != null) {
mapAutoView.getMapStyleParams()
.setIsWeatherEnable(false)
.setLocationIcon3DRes(HdMapBuildConfig.currentCarVrIconRes)
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_UP_CAR)
.setHDVisibileArray(new int[]{HDTypes.DIVIDER.getType(), //onSurfaceCreate设置
HDTypes.ROAD_AREA.getType(),

View File

@@ -1,7 +1,5 @@
package com.mogo.map.identify;
import android.content.Context;
import com.mogo.map.MogoMap;
import com.mogo.map.identity.IMogoIdentifyManager;
import java.util.HashMap;
@@ -16,8 +14,6 @@ import mogo.yycp.api.proto.SocketDownData;
*/
public class MogoIdentifyManager implements IMogoIdentifyManager {
private static final String TAG = "MogoIdentifyManager";
private static volatile MogoIdentifyManager sInstance;
private MogoIdentifyManager() {}
@@ -63,13 +59,4 @@ public class MogoIdentifyManager implements IMogoIdentifyManager {
}
}
@Override
public String addPreVehicleModel(int type, int modelRes) {
try {
return MogoMap.Companion.getMapInstance().getMogoMap(MogoMap.DEFAULT).addPreVehicleModel(type, modelRes);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}

View File

@@ -51,6 +51,7 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
it.setToTop()
if (options.moveToCenter) {
moveToCenter(
mapTag,
options.id,
options.longitude,
options.latitude,
@@ -258,9 +259,9 @@ internal class MoGoOverlayManagerImpl: IMoGoOverlayManager {
}
}
private fun moveToCenter(id: String, eventLon: Double, eventLat: Double, carLon: Double, carLat: Double) {
private fun moveToCenter(mapTag:String, id: String, eventLon: Double, eventLat: Double, carLon: Double, carLat: Double) {
try {
CallerMapUIServiceManager.getMapUIController()?.showBounds(
mapInstance.getMogoMap(mapTag).uiController.showBounds(
id,
MogoLatLng(carLat, carLon),
listOf(MogoLatLng(eventLat, eventLon)),

View File

@@ -1,366 +0,0 @@
package com.mogo.map.uicontroller;
import android.graphics.Point;
import android.graphics.Rect;
import android.view.View;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
import java.util.List;
/**
* @author congtaowang
* @since 2019-12-26
* <p>
* 描述
*/
public class AMapUIController implements IMogoMapUIController {
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 MapControlResult changeZoom(float zoom) {
if (mClient != null) {
return mClient.changeZoom(zoom);
}
return MapControlResult.ERROR;
}
@Override
public void changeZoom2(float zoom) {
if (mClient != null) {
mClient.changeZoom2(zoom);
}
}
@Override
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
if (mClient != null) {
mClient.changeMapVisualAngle(angelMode, mogoLatLng);
}
}
@Override
public void setRoamTrajectory(String trajectory) {
if (mClient != null) {
mClient.setRoamTrajectory(trajectory);
}
}
@Override
public void setRomaMode(int mode) {
if (mClient != null) {
mClient.setRomaMode(mode);
}
}
@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 boolean isDayMode() {
if (mClient != null) {
return mClient.isDayMode();
}
return false;
}
@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 float getScalePerPixel() {
if (mClient != null) {
return mClient.getScalePerPixel();
}
return 0;
}
@Override
public float getZoomLevel() {
if (mClient != null) {
return mClient.getZoomLevel();
}
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 boolean isCarLocked() {
if (mClient != null) {
return mClient.isCarLocked();
}
return false;
}
@Override
public void setCarCursorOption(CarCursorOption option) {
if (mClient != null) {
mClient.setCarCursorOption(option);
}
}
@Override
public void setCarLightsType(int type, int time) {
if (mClient != null) {
mClient.setCarLightsType(type, time);
}
}
@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 changeCurrentIcon(int iconId) {
if (mClient != null) {
mClient.changeCurrentIcon(iconId);
}
}
@Override
public void rtkEnable(boolean enable) {
if (mClient != null) {
mClient.rtkEnable(enable);
}
}
@Override
public void stepInVrMode(boolean isDayMode) {
if (mClient != null) {
mClient.stepInVrMode(isDayMode);
}
}
@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 setMapDAngle(float angle) {
if (mClient != null) {
mClient.setMapDAngle(angle);
}
}
@Override
public void setLockMode(boolean isLock) {
if (mClient != null) {
mClient.setLockMode(isLock);
}
}
@Override
public void setScrollGesturesEnable(boolean isEnable) {
if (mClient != null) {
mClient.setScrollGesturesEnable(isEnable);
}
}
@Override
public void setAllGesturesEnabled(boolean isEnable) {
if (mClient != null) {
mClient.setAllGesturesEnabled(isEnable);
}
}
@Override
public void setExtraGPSData(MogoLocation gnssInfo) {
if (mClient != null) {
mClient.setExtraGPSData(gnssInfo);
}
}
@Override
public void setIsDrawPointCloud(Boolean isDrawPointCloud) {
if (mClient != null) {
mClient.setIsDrawPointCloud(isDrawPointCloud);
}
}
@Override
public void setPointCloudSize(Float pointCloudSize) {
if (mClient != null) {
mClient.setPointCloudSize(pointCloudSize);
}
}
@Override
public void setPointCloudColor(String color) {
if (mClient != null) {
mClient.setPointCloudColor(color);
}
}
@Override
public String getCityCode() {
if (mClient != null) {
return mClient.getCityCode();
}
return null;
}
@Override
public void animateTo(double lon, double lat, float rotateAngle, int duration, boolean isGps) {
if (mClient != null) {
mClient.animateTo(lon, lat, rotateAngle, duration, isGps);
}
}
@Override
public void animateTo(double lon, double lat, float v1, float v2, float v3, float v4, int duration, boolean isGps) {
if (mClient != null) {
mClient.animateTo(lon, lat, v1, v2, v3, v4, duration, isGps);
}
}
}