「Change」
1、增加白天夜间模式切换 进入白天模式 CallerMoGoUiSettingManager.stepInDayMode() 退出白天模式 CallerMoGoUiSettingManager.stepOutDayMode() 监听换肤模式切换,需要实现IMoGoSkinModeChangeListener接口 CallerSkinModeListenerManager.INSTANCE.addListener(TAG, this); 移除换肤模式切换 2、增加切换白天、黑夜模式变换状态栏文字颜色 Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -21,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.enums.TrafficTypeEnum;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.data.map.MapRoadInfo;
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng;
|
||||
@@ -103,7 +104,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
.naviCursorRes(R.drawable.ic_amap_navi_cursor)
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
private EnumMapUI mCurrentUI;
|
||||
private EnumMapUI mCurrentUI = EnumMapUI.MAP_STYLE_NIGHT_VR;
|
||||
private VisualAngleMode mVisualAngleMode = MODE_MEDIUM_SIGHT;
|
||||
|
||||
private float mDefaultZoomLevel = 16.0f;
|
||||
@@ -112,7 +113,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
private boolean mIsFirstLocated = true;
|
||||
private boolean mIsDelayed = false;
|
||||
|
||||
|
||||
private volatile String mRoadId = null;
|
||||
|
||||
public AMapViewWrapper(MapAutoView mMapView) {
|
||||
@@ -314,25 +314,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapMode(EnumMapUI ui) {
|
||||
if (ui == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallerLogger.INSTANCE.d(TAG, "设置的样式 :" + ui);
|
||||
if (checkAMapView()) {
|
||||
mMapView.getMapAutoViewHelper().setScaleVRMode(true);
|
||||
if (ui == EnumMapUI.MAP_STYLE_DAY_VR) {
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY_VR);
|
||||
} else if (ui == EnumMapUI.MAP_STYLE_NIGHT_VR) {
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT_VR);
|
||||
} else {
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_NIGHT_VR);
|
||||
CallerLogger.INSTANCE.e(TAG, "暂时不支持此模式 :" + ui);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapVisualAngle(VisualAngleMode angelMode, MogoLatLng mogoLatLng) {
|
||||
@@ -401,10 +382,26 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是VR模式
|
||||
*
|
||||
* @return true-是,false=不是
|
||||
*/
|
||||
private boolean isVrMold() {
|
||||
return mCurrentUI == EnumMapUI.MAP_STYLE_NIGHT_VR || mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是白天模式
|
||||
*
|
||||
* @return true-是,false-不是
|
||||
*/
|
||||
private boolean isDayMold() {
|
||||
return mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR
|
||||
|| mCurrentUI == EnumMapUI.MAP_STYLE_DAY
|
||||
|| mCurrentUI == EnumMapUI.MAP_STYLE_DAY_NAV;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation(View view) {
|
||||
if (DebugConfig.isDebug()) {
|
||||
@@ -714,6 +711,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
Trace.endSection();
|
||||
initMapView();
|
||||
initMyLocation();
|
||||
loadPreVehicleModel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -807,6 +805,8 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
mCurrentUI = EnumMapUI.MAP_STYLE_DAY_VR;
|
||||
}
|
||||
|
||||
loadPreVehicleModel();
|
||||
|
||||
if (mCurrentUI != null) {
|
||||
UiThreadHandler.post(() -> {
|
||||
try {
|
||||
@@ -896,23 +896,15 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
CallerMapDataCollectorManager.INSTANCE.setIsInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openVrMode(boolean zoomGestureEnable) {
|
||||
try {
|
||||
mMapView.getMapAutoViewHelper().setZoomGesturesEnabled(zoomGestureEnable);
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(MapAutoApi.MAP_STYLE_DAY_VR);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
mMapView.getMapAutoViewHelper().setMapStyle(mapStyle);
|
||||
@@ -941,4 +933,52 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
return MapAutoApi.INSTANCE.getAngle(startLon, startLat, endLon, endLat);
|
||||
}
|
||||
|
||||
|
||||
private void loadPreVehicleModel() {
|
||||
CallerLogger.INSTANCE.d(TAG, "添加感知模型到地图中……");
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI, "添加感知模型到地图中……preVehicleStrWeiZhi=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE, "添加感知模型到地图中……preVehicleStrPeople=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE, "添加感知模型到地图中……preVehicleStrBicycle=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TA_CHE, "添加感知模型到地图中……preVehicleStrTaChe=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO, "添加感知模型到地图中……preVehicleStrMoto=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_BUS, "添加感知模型到地图中……preVehicleStrBus=");
|
||||
|
||||
addPreVehicleModelWeiZhi(TrafficTypeEnum.TYPE_TRAFFIC_ID_TRUCK, "添加感知模型到地图中……preVehicleStrTruck=");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加模型到地图中
|
||||
*
|
||||
* @param typeTrafficId 障碍物类型ID
|
||||
* @param logMsg 日志消息
|
||||
*/
|
||||
private void addPreVehicleModelWeiZhi(TrafficTypeEnum typeTrafficId, String logMsg) {
|
||||
String preVehicleStrWeiZhi;
|
||||
// 根据当前的地图皮肤模式动态替换
|
||||
if (isDayMold()) {
|
||||
preVehicleStrWeiZhi =
|
||||
// 添加模型到地图中
|
||||
MogoMarkerManager.getInstance(getContext())
|
||||
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DIconId());
|
||||
} else {
|
||||
preVehicleStrWeiZhi =
|
||||
// 添加模型到地图中
|
||||
MogoMarkerManager.getInstance(getContext())
|
||||
.addPreVehicleModel(typeTrafficId.getType(), typeTrafficId.getTraffic3DNightIconId());
|
||||
}
|
||||
|
||||
CallerLogger.INSTANCE.d(TAG, logMsg + preVehicleStrWeiZhi);
|
||||
|
||||
if (preVehicleStrWeiZhi == null) {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
CallerLogger.INSTANCE.w(TAG, "添加感知模型到地图中失败,尝试重复添加……");
|
||||
addPreVehicleModelWeiZhi(typeTrafficId, logMsg);
|
||||
}, 1000L);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user