增加接口
/**
     * 获取车道中心线信息
     */
    fun getCenterLineInfo(lon: Double, lat: Double, angle: Float): CenterLine?

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-03-28 18:47:55 +08:00
parent c82c3234ba
commit 4849ec413f
18 changed files with 277 additions and 656 deletions

View File

@@ -1,6 +1,5 @@
package com.mogo.map;
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_DEVA;
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_300;
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_CROSS;
import static com.mogo.map.uicontroller.VisualAngleMode.MAP_STYLE_VR_ANGLE_TOP;
@@ -22,6 +21,7 @@ import android.view.View;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.eagle.core.data.config.HdMapBuildConfig;
import com.mogo.eagle.core.data.map.CenterLine;
import com.mogo.eagle.core.data.map.MapRoadInfo;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.data.map.MogoLocation;
@@ -94,7 +94,6 @@ public class AMapViewWrapper implements IMogoMapView,
OnMapTouchListener,
OnMarkClickListener,
OnMapStyleListener,
MapStyleController.IMapStyleAutoChangedListener,
OnMapViewVisualAngleChangeListener,
OnRoadInfoListener {
@@ -108,14 +107,10 @@ public class AMapViewWrapper implements IMogoMapView,
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
.build();
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
private EnumMapUI mCurrentCarUIMode;
private EnumMapUI mCurrentUI;
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
private int mLockZoom = 16;
private long startTime;
private float mDefaultZoomLevel = 16.0f;
private boolean mIsCarLocked = false;
private boolean mIsLightStyle = false;
private boolean mMapLoaded = false;
private boolean mIsFirstLocated = true;
@@ -125,7 +120,6 @@ public class AMapViewWrapper implements IMogoMapView,
private volatile String mRoadId = null;
public AMapViewWrapper(MapAutoView mMapView) {
startTime = System.currentTimeMillis();
CallerLogger.INSTANCE.i(TAG, "autoop--AMapViewWrapper: init");
this.mMapView = mMapView;
initViews();
@@ -151,7 +145,6 @@ public class AMapViewWrapper implements IMogoMapView,
}
//修改自车模型,未来需区分车的类型
options.setMyLocationStyle(options.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true));
// MapAutoApi.INSTANCE.getMyLocationStyle().myLocationIcon(HdMapBuildConfig.currentCarVrIconRes, true);
}
}
@@ -179,7 +172,7 @@ public class AMapViewWrapper implements IMogoMapView,
if (roadId != null && !TextUtils.isEmpty(roadId)) {
CallerLogger.INSTANCE.d(TAG, "onRoadIdInfo::" + roadId);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnRoadIdGet(roadId);
} else {
} else {
CallerLogger.INSTANCE.d(TAG, "onRoadIdInfo::null");
}
}
@@ -213,10 +206,10 @@ public class AMapViewWrapper implements IMogoMapView,
LonLatPoint p2 = points.get(points.size() - 1);
double distanceOfCarToStopLine = MapDataApi.INSTANCE.getNearstFromPointToSegment(carLoc.getLongitude(), carLoc.getLatitude(), p1.longitude, p1.latitude, p2.longitude, p2.latitude) * 10_0000;
stopInfo.setDistanceOfCarToStopLine(distanceOfCarToStopLine);
CallerLogger.INSTANCE.d(TAG, "onStopLineInfo: --- distance: "+ distanceOfCarToStopLine);
CallerLogger.INSTANCE.d(TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
CallerMapRoadListenerManager.INSTANCE.invokeListenersOnStopLineGet(stopInfo);
}
} else {
} else {
if (carLoc != null) {
CallerLogger.INSTANCE.d(TAG, "onStopLineInfo::null, car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
}
@@ -373,32 +366,6 @@ public class AMapViewWrapper implements IMogoMapView,
if (checkAMapView()) {
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
// TODO 这里临时修改关闭2D
// switch (ui) {
// case CarUp_2D:
// case CarUp_3D:
// case NorthUP_2D:
// setUIMode(ui);
// break;
// case Type_VR:
// mMapView.getMapAutoViewHelper().setScaleVRMode(true);
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_VR);
// return;
// case Type_Light:
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY);
// mIsLightStyle = true;
// break;
// case Type_Night:
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(false);
// mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT);
// mIsLightStyle = false;
// break;
// case Type_AUTO_LIGHT_Night:
// mMapView.getMapAutoViewHelper().setAutoSwitchStyle(true);
// break;
// }
}
}
@@ -504,7 +471,6 @@ public class AMapViewWrapper implements IMogoMapView,
}
CallerLogger.INSTANCE.d(TAG, "锁车");
mMapView.getMapAutoViewHelper().setLockMode(true);
mIsCarLocked = true;
}
}
@@ -515,12 +481,6 @@ public class AMapViewWrapper implements IMogoMapView,
}
CallerLogger.INSTANCE.d(TAG, "解锁锁车");
mMapView.getMapAutoViewHelper().setLockMode(false);
mIsCarLocked = false;
}
@Override
public void setLockZoom(int var1) {
mLockZoom = var1;
}
@Override
@@ -653,12 +613,6 @@ public class AMapViewWrapper implements IMogoMapView,
return MogoMapUtils.calculateLineDistance(ObjectUtils.fromMogo(p1), ObjectUtils.fromMogo(p2));
}
@Override
public EnumMapUI getCurrentUiMode() {
return mCurrentCarUIMode;
}
@Override
public void changeMyLocation(Location location) {
}
@@ -739,10 +693,15 @@ public class AMapViewWrapper implements IMogoMapView,
}
@Override
public int getSpeedLimmit(double lon, double lat, float angle) {
public int getLimitSpeed(double lon, double lat, float angle) {
return MapDataApi.INSTANCE.getLimitSpeed(lon, lat, angle);
}
@Override
public CenterLine getCenterLineInfo(double lon, double lat, float angle) {
return ObjectUtils.transformCenterLine(MapDataApi.INSTANCE.getCenterLineInfo(lon, lat, angle));
}
@Override
public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.MogoLocation location) {
MogoLocation mLastLocation = ObjectUtils.fromLocation(location);
@@ -786,7 +745,6 @@ public class AMapViewWrapper implements IMogoMapView,
mIsFirstLocated = true;
mIsDelayed = false;
CallerLogger.INSTANCE.d(TAG, "同步定位:" + GsonUtils.toJson(location));
MapStyleController.getInstance().onLocationChanged(location, this);
}
}
}
@@ -940,26 +898,6 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().setMapViewPerspective(MapAutoApi.MAP_PERSPECTIVE_UP_CAR);
}
@Override
public void onStyleAutoChanged(boolean isVrMode) {
if (isVrMode) {
if (mCurrentUI != EnumMapUI.Type_VR) {
CallerLogger.INSTANCE.d(TAG, "自动切换为vr模式");
changeMapMode(EnumMapUI.Type_VR);
}
} else {
if (mCurrentUI == EnumMapUI.Type_VR) {
CallerLogger.INSTANCE.d(TAG, "自动切换为2D模式");
if (mIsLightStyle) {
changeMapMode(EnumMapUI.Type_Light);
} else {
changeMapMode(EnumMapUI.Type_Night);
}
}
}
}
private boolean mRtkEnable = false;
@Override