增加控制地图「白天」「夜间」模式

Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
donghongyu
2022-04-11 16:38:39 +08:00
parent 0f66542bca
commit 63f3f8d8c8
22 changed files with 155 additions and 528 deletions

View File

@@ -21,10 +21,6 @@ import com.mogo.module.common.entity.MarkerShareMusic;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.enums.EventTypeEnum;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author congtaowang
* @since 2020/10/28
@@ -65,10 +61,6 @@ public class MarkerDrawer {
return drawMapMarkerImpl(markerShowEntity, false, zIndex, 0, listener);
}
public IMogoMarker drawMapMarkerImpl(MarkerShowEntity markerShowEntity, boolean matchRoadSide, int zIndex, IMogoMarkerClickListener listener) {
return drawMapMarkerImpl(markerShowEntity, matchRoadSide, zIndex, 0, listener);
}
/**
* add marker, { 如果是需要在3D模式下显示则需要设置 {@link MogoMarkerOptions icon3DRes 资源id}}
*
@@ -120,63 +112,6 @@ public class MarkerDrawer {
return marker;
}
/**
* S = (A ∩ B) B
* A ∩ B)作为旧列表需要保留的部分
*
* @param newList
* @return
*/
public Map<String, IMogoMarker> purgeMarkerData(List newList, String markerType) {
Map<String, IMogoMarker> existMap = new HashMap<>();
List<IMogoMarker> allCarsList = MogoMarkerManager.getInstance(AbsMogoApplication.getApp()).getMarkers(markerType);
if (allCarsList == null || allCarsList.isEmpty()) {
return existMap;
}
if (newList == null || newList.isEmpty()) {
return existMap;
}
Map<String, IMogoMarker> allMap = new HashMap<>();
for (IMogoMarker marker : allCarsList) {
String sn = getPrimaryKeyFromMarker(marker);
allMap.put(sn, marker);
}
for (Object entity : newList) {
String sn = getPrimaryKeyFromEntity(entity);
if (allMap.containsKey(sn)) {
if (!isNewVehicleType(entity, allMap.get(sn))) {
existMap.put(sn, allMap.get(sn));
}
}
}
for (String sn : allMap.keySet()) {
if (!existMap.containsKey(sn)) {
IMogoMarker dirtyMarker = allMap.get(sn);
allCarsList.remove(dirtyMarker);
if (dirtyMarker != null) {
dirtyMarker.destroy();
}
}
}
allMap.clear();
return existMap;
}
/**
* @param maxAmount 展示的最大数量
* @param list
* @return
*/
public int getAppropriateSize(int maxAmount, List list) {
if (list == null) {
return 0;
}
return Math.min(maxAmount, list.size());
}
private boolean isNewVehicleType(Object object, IMogoMarker marker) {
if (object instanceof MarkerOnlineCar
&& marker != null
@@ -229,16 +164,6 @@ public class MarkerDrawer {
return "";
}
public String getCarSnFromMarker(IMogoMarker marker) {
if (marker == null || marker.getObject() == null || marker.isDestroyed()) {
return null;
}
if (!(marker.getObject() instanceof MarkerShowEntity)) {
return null;
}
return getCarSnFromEntity(((MarkerShowEntity) marker.getObject()).getBindObj());
}
/**
* 距离半径计算方式
*

View File

@@ -152,9 +152,9 @@ public class MogoServices implements IMogoMapListener,
private boolean mLastStatusIsVr = false;
@Override
public void onMapModeChanged(EnumMapUI ui) {
public void onMapModeChanged(EnumMapUI mCurrentUI) {
clearAllData();
if (ui == EnumMapUI.Type_VR) {
if (mCurrentUI == EnumMapUI.MAP_STYLE_NIGHT_VR || mCurrentUI == EnumMapUI.MAP_STYLE_DAY_VR) {
if (!mLastStatusIsVr) {
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode(TAG, true);
if (DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_LENOVO) {

View File

@@ -2,9 +2,7 @@ package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import com.mogo.module.service.ServiceConst;
import com.mogo.module.service.receiver.AccStatusReceiver;
import com.mogo.module.service.receiver.MogoReceiver;
@@ -27,7 +25,6 @@ public class IntentHandlerFactory {
mHandlers.put( Intent.ACTION_POWER_DISCONNECTED, AccStatusIntentHandler.getInstance() );
mHandlers.put( AccStatusReceiver.ACTION_NWD_ACC, AccStatusIntentHandler.getInstance() );
mHandlers.put( MogoReceiver.ACTION_VOICE_READY, new AIAssistIntentHandler() );
mHandlers.put( ConnectivityManager.CONNECTIVITY_ACTION, new NetworkChangedIntentHandler() );
}
private static final class InstanceHolder {

View File

@@ -13,10 +13,7 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.autopilot.AutopilotCarStateInfo;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
import com.mogo.eagle.core.data.map.MogoLatLng;
import com.mogo.eagle.core.function.api.map.IMogoMapFrameController;
import com.mogo.eagle.core.function.call.base.CallerBase;
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
@@ -252,20 +249,9 @@ public class MockIntentHandler implements IntentHandler {
intent3.putExtra("EXTRA_REQUEST_AUTO_STATE", 0);
context.sendBroadcast(intent3);
break;
case 32:// 控制实时路况
MogoMapUIController.getInstance().setTrafficEnabled(true);
break;
case 33:// 测试小智语音
AIAssist.getInstance(context).speakTTSVoice("庞帆说这个是一个 hard coding.");
break;
case 34:// 修改地图模式VR OR 2D
int type = intent.getIntExtra("type", 0);
if (type != 0) {
CallerBase.getApiInstance(IMogoMapFrameController.class, MogoServicePaths.PATH_MAP_FRAME_CONTROLLER).changeToVRMode();
} else {
CallerBase.getApiInstance(IMogoMapFrameController.class, MogoServicePaths.PATH_MAP_FRAME_CONTROLLER).changeTo2dMode();
}
break;
case 36:// 测试打点功能
MogoLatLng center = MogoMapUIController.getInstance()
.getWindowCenterLocation();
@@ -393,10 +379,6 @@ public class MockIntentHandler implements IntentHandler {
}
});
break;
case 45:// 测试开启鹰眼模式
MogoMapUIController.getInstance()
.openVrMode(false);
break;
case 46:// 模拟鹰眼模式下绘制车辆周边的数据
mTimeTickHandler.sendEmptyMessageDelayed(1, 0L);
break;

View File

@@ -1,31 +0,0 @@
package com.mogo.module.service.intent;
import android.content.Context;
import android.content.Intent;
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
import com.mogo.map.MogoMapUIController;
public
/**
* @author congtaowang
* @since 2020/8/17
*
* 描述
*/
class NetworkChangedIntentHandler implements IntentHandler {
private static final String TAG = "NetworkChangedIntentHandler";
@Override
public void handle( Context context, Intent intent ) {
if ( NetworkUtils.isConnected( context ) ) {
try {
MogoMapUIController.getInstance()
.setTrafficEnabled( true );
} catch ( Exception e ) {
e.printStackTrace();
}
}
}
}