This commit is contained in:
wangcongtao
2020-10-26 14:52:23 +08:00
parent e3f303c2ca
commit 8cc40f1d79
18 changed files with 294 additions and 112 deletions

View File

@@ -23,7 +23,7 @@ android {
externalNativeBuild {
ndk {
// 设置支持的SO库架构
abiFilters "armeabi-v7a"
abiFilters "armeabi-v7a", 'arm64-v8a'
}
}
}

View File

@@ -55,7 +55,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-online-13'
implementation 'com.zhidaoauto.machine:map:1.0.0-online-14'
}
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()

View File

@@ -23,7 +23,7 @@ public class CustomMapView implements IMogoMapViewCreator {
@Override
public IMogoMapView create( Context context ) {
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( DebugConfig.isDebug() )
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 16 )

View File

@@ -36,47 +36,54 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
super( context, attrs, defStyleAttr );
}
private boolean mIsFirstDisplayVRMode = true;
private boolean mIsVrMode = false;
@Override
protected void addDleMaps() {
if ( !MogoMapDelegateFactory.isUseCustom() ) {
mAMapView = new AMapBaseMapView().create( getContext() );
if ( mAMapView != null ) {
final View mapView = mAMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mAMapView;
} else {
mCustomMapView = new CustomMapView().create( getContext() );
if ( mCustomMapView != null ) {
final View mapView = mCustomMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mCustomMapView;
}
mCustomMapView = new CustomMapView().create( getContext() );
if ( mCustomMapView != null ) {
final View mapView = mCustomMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mAMapView = new AMapBaseMapView().create( getContext() );
if ( mAMapView != null ) {
final View mapView = mAMapView.getMapView();
if ( mapView != null ) {
addView( mapView, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) );
} else {
Logger.e( TAG, "create MapView instance failed." );
}
} else {
Logger.e( TAG, "create IMogoMapView instance failed." );
}
mMapView = mAMapView;
mCustomMapView.getMapView().setVisibility( View.GONE );
MogoMap.getInstance().init( getContext(), mMapView.getMap() );
}
@Override
public void display2DMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
mIsVrMode = false;
mMapView = mAMapView;
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
MogoMap.getInstance().init( getContext(), mAMapView.getMap() );
MogoMapUIController.getInstance().setDelegate( AMapUIController.getInstance() );
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
mCustomMapView.onPause();
mCustomMapView.getMapView().setVisibility( View.GONE );
mAMapView.onResume();
@@ -85,19 +92,21 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
@Override
public void displayVRMap( boolean invokeCreateAuto, boolean invokeResumeAuto ) {
if ( mIsFirstDisplayVRMode ) {
mCustomMapView.onCreate( null );
mIsFirstDisplayVRMode = false;
}
mIsVrMode = true;
mMapView = mCustomMapView;
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
MogoMap.getInstance().init( getContext(), mCustomMapView.getMap() );
MogoMapUIController.getInstance().setDelegate( com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance() );
MogoMarkerManager.getInstance( getContext() ).removeMarkers();
mCustomMapView.onResume();
mCustomMapView.getMapView().setVisibility( View.VISIBLE );
mAMapView.onPause();
mAMapView.getMapView().setVisibility( View.GONE );
}
public boolean isVrMode() {
return mIsVrMode;
}
@Override
public void onCreate( Bundle bundle ) {
super.onCreate( bundle );

View File

@@ -2,6 +2,7 @@ package com.mogo.module.common.map;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
@@ -18,7 +19,8 @@ public class MapCenterPointStrategy {
private static final String TAG = "MapCenterPointStrategy";
private static Map< Integer, Map< String, MapCenterPoint > > sStrategies = new HashMap<>();
private static Map< Integer, Map< String, MapCenterPoint > > sCommonStrategies = new HashMap<>();
private static Map< Integer, Map< String, MapCenterPoint > > sVrStrategies = new HashMap<>();
public static final MapCenterPoint DEFAULT = new MapCenterPoint( 0.677734D, 0.5733333D );
@@ -32,7 +34,7 @@ public class MapCenterPointStrategy {
choosePoint.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) );
sStrategies.put( Scene.CHOOSE_POINT, choosePoint );
sCommonStrategies.put( Scene.CHOOSE_POINT, choosePoint );
}
{
@@ -43,7 +45,7 @@ public class MapCenterPointStrategy {
navi.put( "e8xx", new MapCenterPoint( 0.734375D, 0.573333333333D ) );
navi.put( "f80x", new MapCenterPoint( 0.705208333D, 0.575D ) );
navi.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.575D ) );
sStrategies.put( Scene.NAVI, navi );
sCommonStrategies.put( Scene.NAVI, navi );
}
{
@@ -54,7 +56,7 @@ public class MapCenterPointStrategy {
naviWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.734375D, 0.73936170212766D ) );
naviWithRoadEvent.put( "f80x", new MapCenterPoint( 0.705208333D, 0.683333333333D ) );
naviWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.683333333333D ) );
sStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
sCommonStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
}
{
@@ -65,7 +67,7 @@ public class MapCenterPointStrategy {
aimless.put( "e8xx", new MapCenterPoint( 0.734375D, 0.5D ) );
aimless.put( "f80x", new MapCenterPoint( 0.705208333D, 0.5D ) );
aimless.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.5D ) );
sStrategies.put( Scene.AIMLESS, aimless );
sCommonStrategies.put( Scene.AIMLESS, aimless );
}
{
@@ -76,7 +78,7 @@ public class MapCenterPointStrategy {
aimlessWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.734375D, 0.68617 ) );
aimlessWithRoadEvent.put( "f80x", new MapCenterPoint( 0.705208333D, 0.599074074D ) );
aimlessWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.705208333D, 0.599074074D ) );
sStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
sCommonStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
}
{
@@ -87,7 +89,7 @@ public class MapCenterPointStrategy {
calculatePath.put( "e8xx", new MapCenterPoint( 0.733398D, 0.610833D ) );
calculatePath.put( "f80x", new MapCenterPoint( 0.703125D, 0.6083333D ) );
calculatePath.put( "f8xx", new MapCenterPoint( 0.703125D, 0.6083333D ) );
sStrategies.put( Scene.CALCULATE_PATH, calculatePath );
sCommonStrategies.put( Scene.CALCULATE_PATH, calculatePath );
}
{
@@ -98,7 +100,7 @@ public class MapCenterPointStrategy {
categorySearch.put( "e8xx", new MapCenterPoint( 0.733398D, 0.5D ) );
categorySearch.put( "f80x", new MapCenterPoint( 0.733594D, 0.5D ) );
categorySearch.put( "f8xx", new MapCenterPoint( 0.733594D, 0.5D ) );
sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
sCommonStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
}
{
@@ -109,19 +111,103 @@ public class MapCenterPointStrategy {
categoryV2XEvent.put( "e8xx", new MapCenterPoint( 0.677734375D, 0.7D ) );
categoryV2XEvent.put( "f80x", new MapCenterPoint( 0.6963541D, 0.65D ) );
categoryV2XEvent.put( "f8xx", new MapCenterPoint( 0.6963541D, 0.65D ) );
sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
sCommonStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
}
// --vr mode
{
// 选点场景,定位中心点
Map< String, MapCenterPoint > choosePoint = new HashMap<>();
choosePoint.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) );
choosePoint.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) );
sVrStrategies.put( Scene.CHOOSE_POINT, choosePoint );
}
{
// 导航场景,定位视图右下角偏下
Map< String, MapCenterPoint > navi = new HashMap<>();
navi.put( "d80x", new MapCenterPoint( 0.5D, 0.573333333333D ) );
navi.put( "em4", new MapCenterPoint( 0.5D, 0.573333333333D ) );
navi.put( "e8xx", new MapCenterPoint( 0.5D, 0.573333333333D ) );
navi.put( "f80x", new MapCenterPoint( 0.5D, 0.575D ) );
navi.put( "f8xx", new MapCenterPoint( 0.5D, 0.575D ) );
sVrStrategies.put( Scene.NAVI, navi );
}
{
// 导航场景 vs 道路事件展示场景,定位视图右下角偏下
Map< String, MapCenterPoint > naviWithRoadEvent = new HashMap<>();
naviWithRoadEvent.put( "d80x", new MapCenterPoint( 0.5D, 0.73936170212766D ) );
naviWithRoadEvent.put( "em4", new MapCenterPoint( 0.5D, 0.73936170212766D ) );
naviWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.5D, 0.73936170212766D ) );
naviWithRoadEvent.put( "f80x", new MapCenterPoint( 0.5D, 0.683333333333D ) );
naviWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.5D, 0.683333333333D ) );
sVrStrategies.put( Scene.NAVI_WITH_ROAD_EVENT, naviWithRoadEvent );
}
{
// 巡航场景
Map< String, MapCenterPoint > aimless = new HashMap<>();
aimless.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) );
aimless.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) );
aimless.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
aimless.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) );
aimless.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) );
sVrStrategies.put( Scene.AIMLESS, aimless );
}
{
// 巡航场景 vs 道路事件展示场景
Map< String, MapCenterPoint > aimlessWithRoadEvent = new HashMap<>();
aimlessWithRoadEvent.put( "d80x", new MapCenterPoint( 0.5D, 0.68617 ) );
aimlessWithRoadEvent.put( "em4", new MapCenterPoint( 0.5D, 0.68617 ) );
aimlessWithRoadEvent.put( "e8xx", new MapCenterPoint( 0.5D, 0.68617 ) );
aimlessWithRoadEvent.put( "f80x", new MapCenterPoint( 0.5D, 0.599074074D ) );
aimlessWithRoadEvent.put( "f8xx", new MapCenterPoint( 0.5D, 0.599074074D ) );
sVrStrategies.put( Scene.AIMLESS_WITH_ROAD_EVENT, aimlessWithRoadEvent );
}
{
// 规划路线,定位视图右边
Map< String, MapCenterPoint > calculatePath = new HashMap<>();
calculatePath.put( "d80x", new MapCenterPoint( 0.5D, 0.610833D ) );
calculatePath.put( "em4", new MapCenterPoint( 0.5D, 0.610833D ) );
calculatePath.put( "e8xx", new MapCenterPoint( 0.5D, 0.610833D ) );
calculatePath.put( "f80x", new MapCenterPoint( 0.5D, 0.6083333D ) );
calculatePath.put( "f8xx", new MapCenterPoint( 0.5D, 0.6083333D ) );
sVrStrategies.put( Scene.CALCULATE_PATH, calculatePath );
}
{
// 分类搜索,定位视图右边
Map< String, MapCenterPoint > categorySearch = new HashMap<>();
categorySearch.put( "d80x", new MapCenterPoint( 0.5D, 0.5D ) );
categorySearch.put( "em4", new MapCenterPoint( 0.5D, 0.5D ) );
categorySearch.put( "e8xx", new MapCenterPoint( 0.5D, 0.5D ) );
categorySearch.put( "f80x", new MapCenterPoint( 0.5D, 0.5D ) );
categorySearch.put( "f8xx", new MapCenterPoint( 0.5D, 0.5D ) );
sVrStrategies.put( Scene.CATEGORY_SEARCH, categorySearch );
}
{
// V2X场景视图右边
Map< String, MapCenterPoint > categoryV2XEvent = new HashMap<>();
categoryV2XEvent.put( "d80x", new MapCenterPoint( 0.5, 0.7D ) );
categoryV2XEvent.put( "em4", new MapCenterPoint( 0.5, 0.7D ) );
categoryV2XEvent.put( "e8xx", new MapCenterPoint( 0.5, 0.7D ) );
categoryV2XEvent.put( "f80x", new MapCenterPoint( 0.5, 0.65D ) );
categoryV2XEvent.put( "f8xx", new MapCenterPoint( 0.5, 0.65D ) );
sVrStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
}
}
public static void addScene( int scene, Map< String, MapCenterPoint > config ) {
if ( sStrategies.containsKey( scene ) ) {
Logger.w( TAG, "scene has already defined, append config..." );
}
if ( sStrategies.get( scene ) != null ) {
sStrategies.get( scene ).putAll( config );
} else {
sStrategies.put( scene, config );
}
public static void resetByChangeMode(){
setMapCenterPointByScene( MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController(),
Scene.AIMLESS);
}
/**
@@ -134,12 +220,16 @@ public class MapCenterPointStrategy {
if ( controller == null ) {
return;
}
if ( !sStrategies.containsKey( scene ) ) {
Map<Integer, Map<String, MapCenterPoint>> strategies = sCommonStrategies;
if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) {
strategies = sVrStrategies;
}
if ( !strategies.containsKey( scene ) ) {
Logger.w( TAG, "no strategy for scene: %s, use DEFAULT", scene );
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
return;
}
Map< String, MapCenterPoint > points = sStrategies.get( scene );
Map< String, MapCenterPoint > points = strategies.get( scene );
String car = DebugConfig.getProductFlavor();
if ( !points.containsKey( car ) ) {
Logger.w( TAG, "no strategy for series: %s, use DEFAULT", scene );

View File

@@ -399,12 +399,14 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
tvEnterVrMode.setOnClickListener((v)->{
// 进入vr模式
enterVrMode();
mApis.getMapFrameControllerApi().changeToVRMode();
});
tvExitVrMode = findViewById(R.id.module_ext_exit_vr_mode);
tvExitVrMode.setOnClickListener((v)->{
// 退出vr模式
exitVrMode();
mApis.getMapFrameControllerApi().changeTo2dMode();
});
dealWeatherContainer();
@@ -734,8 +736,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
} else if (opera_type == 1) {
mCameraMode.setSelected(true);
}
mCameraMode.setText(getString(mCameraMode.isSelected() ?
R.string.mode_car_up : R.string.mode_north_up));
mCameraMode.setText(getString(mCameraMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up));
} else if( key_type == 10021 ){
try {
onStopNavi();

View File

@@ -1,6 +1,7 @@
package com.mogo.module.map;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.utils.logger.Logger;
public
@@ -86,6 +87,12 @@ class MapControlCommandHandler {
break;
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
break;
case VoiceConstants.CMD_MAP_OPEN_VR_UN_WAKEUP:
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeToVRMode();
break;
case VoiceConstants.CMD_MAP_CLOSE_VR_UN_WAKEUP:
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode();
break;
default:
break;

View File

@@ -14,6 +14,7 @@ import com.mogo.map.MogoMapView;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.map.MapCenterPointStrategy;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.map.IMogoMapFrameController;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
@@ -55,15 +56,45 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
@Override
public void changeTo2dMode() {
if ( !isVrMode() ) {
return;
}
mMogoMapView.display2DMap( false, true );
afterMapModeChanged();
MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
}
@Override
public void changeToVRMode() {
if ( isVrMode() ) {
return;
}
mMogoMapView.displayVRMap( mIsFirstLoadCustomMap, true );
if ( mIsFirstLoadCustomMap ) {
initMapView();
mMogoMap = mMogoMapView.getMap();
if ( mMogoMap.getUIController() != null ) {
mMogoMap.getUIController().showMyLocation( true );
mMogoMap.getUIController().recoverLockMode();// 启动锁车
}
mIsFirstLoadCustomMap = false;
}
afterMapModeChanged();
MogoApisHandler.getInstance().getApis().getAdasControllerApi().closeADAS();
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
}
private void afterMapModeChanged() {
MapCenterPointStrategy.resetByChangeMode();
final EnumMapUI mapUI = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getCurrentSkinMode();
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().changeMapMode( mapUI );
MogoApisHandler.getInstance().getApis().getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 0 );
}
@Override
public boolean isVrMode() {
return mMogoMapView.isVrMode();
}
@Override
@@ -137,32 +168,34 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
}
private void initMapView() {
if ( mMogoMap != null ) {
IMogoUiSettings uiSettings = mMogoMap.getUiSettings();
if ( uiSettings != null ) {
//设置所有手势是否可用
uiSettings.setAllGesturesEnabled( true );
//设置指南针是否可见。
uiSettings.setCompassEnabled( false );
//设置室内地图楼层切换控件是否可见。
uiSettings.setIndoorSwitchEnabled( true );
//设置定位按钮是否可见。
uiSettings.setMyLocationButtonEnabled( false );
//设置旋转手势是否可用。
uiSettings.setRotateGesturesEnabled( false );
//设置比例尺控件是否可见
uiSettings.setScaleControlsEnabled( true );
//设置拖拽手势是否可用。
uiSettings.setScrollGesturesEnabled( true );
//设置倾斜手势是否可用。
uiSettings.setTiltGesturesEnabled( true );
//设置缩放按钮是否可见。
uiSettings.setZoomControlsEnabled( false );
//设置双指缩放手势是否可用。
uiSettings.setZoomGesturesEnabled( true );
if ( mMogoMap.getUIController() != null ) {
mMogoMap.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
}
mMogoMap = mMogoMapView.getMap();
if ( mMogoMap == null ) {
return;
}
IMogoUiSettings uiSettings = mMogoMap.getUiSettings();
if ( uiSettings != null ) {
//设置所有手势是否可用
uiSettings.setAllGesturesEnabled( true );
//设置指南针是否可见。
uiSettings.setCompassEnabled( false );
//设置室内地图楼层切换控件是否可见。
uiSettings.setIndoorSwitchEnabled( true );
//设置定位按钮是否可见。
uiSettings.setMyLocationButtonEnabled( false );
//设置旋转手势是否可用。
uiSettings.setRotateGesturesEnabled( false );
//设置比例尺控件是否可见
uiSettings.setScaleControlsEnabled( true );
//设置拖拽手势是否可用。
uiSettings.setScrollGesturesEnabled( true );
//设置倾斜手势是否可用。
uiSettings.setTiltGesturesEnabled( true );
//设置缩放按钮是否可见。
uiSettings.setZoomControlsEnabled( false );
//设置双指缩放手势是否可用。
uiSettings.setZoomGesturesEnabled( true );
if ( mMogoMap.getUIController() != null ) {
mMogoMap.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
}
}
}
@@ -172,11 +205,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().destroy();
}
@Override
public IMogoMapUIController getUIController() {
return mMogoMap.getUIController();
}
@Override
public void onDestroyView() {
super.onDestroyView();

View File

@@ -44,6 +44,14 @@ class MapFrameController implements IMogoMapFrameController {
}
@Override
public boolean isVrMode() {
if ( mController != null ) {
return mController.isVrMode();
}
return false;
}
@Override
public void destroy() {
mController = null;

View File

@@ -73,7 +73,7 @@ public class MapPresenter extends Presenter< MapView > implements
return;
}
mStatusManager.setDisplayOverview( TAG, false );
mView.getUIController().recoverLockMode();
mMogoMapService.getMapUIController().recoverLockMode();
}
};
private AutoNaviBroadcastIntentHandler mAutoNaviReceiver;
@@ -86,24 +86,24 @@ public class MapPresenter extends Presenter< MapView > implements
@Override
public void onTrafficModeChanged( boolean open ) {
mView.getUIController().setTrafficEnabled( open );
mMogoMapService.getMapUIController().setTrafficEnabled( open );
}
@Override
public void onCameraModeChanged( EnumMapUI mode ) {
mView.getUIController().changeMapMode( mode );
mMogoMapService.getMapUIController().changeMapMode( mode );
mApis.getAdasControllerApi().changeAdasControlMode( mode );
}
@Override
public void onDayNightModeChanged( EnumMapUI mode ) {
mView.getUIController().changeMapMode( mode );
mMogoMapService.getMapUIController().changeMapMode( mode );
mApis.getAdasControllerApi().changeAdasControlMode( mode );
}
@Override
public void onMapUiModeChanged( EnumMapUI mapUI ) {
mView.getUIController().changeMapMode( mapUI );
mMogoMapService.getMapUIController().changeMapMode( mapUI );
}
@Override
@@ -113,7 +113,7 @@ public class MapPresenter extends Presenter< MapView > implements
}
if ( mStatusManager.isMainPageOnResume() ) {
mStatusManager.setDisplayOverview( TAG, false );
mView.getUIController().recoverLockMode();
mMogoMapService.getMapUIController().recoverLockMode();
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
UiThreadHandler.removeCallbacks( mLockCarRunnable );
} else {
@@ -121,7 +121,7 @@ public class MapPresenter extends Presenter< MapView > implements
UiThreadHandler.postDelayed( () -> {
try {
mStatusManager.setDisplayOverview( TAG, false );
mView.getUIController().recoverLockMode();
mMogoMapService.getMapUIController().recoverLockMode();
AIAssist.getInstance( getContext() ).speakTTSVoice( "已为您继续导航" );
UiThreadHandler.removeCallbacks( mLockCarRunnable );
} catch ( Exception e ) {
@@ -200,14 +200,14 @@ public class MapPresenter extends Presenter< MapView > implements
if ( !mStatusManager.isMainPageOnResume() ) {
mStatusManager.setUserInteractionStatus( TAG, true, false );
mStatusManager.setDisplayOverview( TAG, true );
mView.getUIController().displayOverview( mDisplayOverviewBounds );
mMogoMapService.getMapUIController().displayOverview( mDisplayOverviewBounds );
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
} else {
mLauncher.backToLauncher( getContext() );
UiThreadHandler.postDelayed( () -> {
mStatusManager.setUserInteractionStatus( TAG, true, false );
mStatusManager.setDisplayOverview( TAG, true );
mView.getUIController().displayOverview( mDisplayOverviewBounds );
mMogoMapService.getMapUIController().displayOverview( mDisplayOverviewBounds );
AIAssist.getInstance( getContext() ).speakTTSVoice( "展示全程路线" );
}, 2_000L );
}
@@ -218,7 +218,7 @@ public class MapPresenter extends Presenter< MapView > implements
@Override
public void onZoomMap( boolean zoomIn ) {
boolean isLocked = mMogoMapService.getMapUIController().isCarLocked();
MapControlResult result = mView.getUIController().changeZoom( zoomIn );
MapControlResult result = mMogoMapService.getMapUIController().changeZoom( zoomIn );
if ( !CustomNaviInterrupter.getInstance().interrupt() ) {
if ( result == MapControlResult.TARGET ) {
UiThreadHandler.postDelayed( () -> {
@@ -234,7 +234,7 @@ public class MapPresenter extends Presenter< MapView > implements
if ( isLocked ) {
// 保持锁车状态
UiThreadHandler.postDelayed( () -> {
mView.getUIController().setLockZoom( ( ( int ) mMogoMapService.getMapUIController().getZoomLevel() ) );
mMogoMapService.getMapUIController().setLockZoom( ( ( int ) mMogoMapService.getMapUIController().getZoomLevel() ) );
mMogoMapService.getMapUIController().recoverLockMode();//缩放地图会导致锁车发生改变,这里强制锁车
}, 1_000 );
} else {

View File

@@ -10,11 +10,4 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
* 地图view
*/
public interface MapView extends IView {
/**
* 地图控制接口
*
* @return
*/
IMogoMapUIController getUIController();
}

View File

@@ -57,6 +57,20 @@ public class VoiceConstants {
public static final String CMD_MAP_2D_UN_WAKEUP = "CMD_MAP_2D_UN_WAKEUP";
public static final String[] CMD_MAP_2D_TRIGGER_WORDS = {"二地模式"};
/**
* 打开vr
*/
public static final String CMD_MAP_OPEN_VR = "com.ileja.navi.mode.vr.open";
public static final String CMD_MAP_OPEN_VR_UN_WAKEUP = "CMD_MAP_OPEN_VR_UN_WAKEUP";
public static final String[] CMD_MAP_OPEN_VR_TRIGGER_WORDS = {"打开VR模式", "VR模式", "切换到VR模式"};
/**
* 关闭vr
*/
public static final String CMD_MAP_CLOSE_VR = "com.ileja.navi.mode.vr.close";
public static final String CMD_MAP_CLOSE_VR_UN_WAKEUP = "CMD_MAP_CLOSE_VR_UN_WAKEUP";
public static final String[] CMD_MAP_CLOSE_VR_TRIGGER_WORDS = {"关闭VR模式", "切换到地图模式"};
/**
* 3D模式
*/
@@ -191,6 +205,8 @@ public class VoiceConstants {
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS );
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_NIGHT_MODE_TRIGGER_WORDS );
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_AUTO_LIGHT_NIGHT_MODE_TRIGGER_WORDS );
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_OPEN_VR_UN_WAKEUP, VoiceConstants.CMD_MAP_OPEN_VR_TRIGGER_WORDS );
sUnRegisterVoiceCmds.put( VoiceConstants.CMD_MAP_CLOSE_VR_UN_WAKEUP, VoiceConstants.CMD_MAP_CLOSE_VR_TRIGGER_WORDS );
// 唤醒
sCmds.add( VoiceConstants.CMD_MAP_ZOOM_IN );

View File

@@ -54,6 +54,7 @@ import com.mogo.module.service.refresh.CustomRefreshStrategy;
import com.mogo.module.service.refresh.RefreshObject;
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
import com.mogo.module.service.websocket.LocationResult;
import com.mogo.module.service.websocket.OnePerSecondSendContent;
import com.mogo.service.adas.IMogoADASController;
import com.mogo.service.adas.entity.ADASRecognizedResult;
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
@@ -428,7 +429,7 @@ public class MogoServices implements IMogoMapListener,
AutoPilotRemoteController.getInstance().start();
mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, 0 );
// mThreadHandler.sendEmptyMessageDelayed( ServiceConst.MSG_SEND_CAR_LOCATION_AND_ADAS_RECOGNIZED_RESULT_2_SERVER, 0 );
}
private void initLocationServiceProcess( Context context ) {
@@ -445,8 +446,9 @@ public class MogoServices implements IMogoMapListener,
private void startSendCarLocationAndAdasRecognizedResult2Server() {
Location lastCarLocation = mLastCarLocation;
LocationResult locationResult = null;
if ( lastCarLocation != null ) {
LocationResult locationResult = new LocationResult();
locationResult = new LocationResult();
locationResult.alt = lastCarLocation.getAltitude();
locationResult.heading = lastCarLocation.getBearing();
locationResult.lat = lastCarLocation.getLatitude();
@@ -454,10 +456,15 @@ public class MogoServices implements IMogoMapListener,
locationResult.satelliteTime = lastCarLocation.getTime();
locationResult.systemTime = System.currentTimeMillis();
locationResult.speed = lastCarLocation.getSpeed();
locationResult.sn = com.mogo.commons.network.Utils.getSn();
locationResult.mortonCode = MortonCode.wrapEncodeMorton( locationResult.lon, locationResult.lat );
}
List< ADASRecognizedResult > recognizedResults = MarkerServiceHandler.getADASController().getLastADASRecognizedResult();
OnePerSecondSendContent content = new OnePerSecondSendContent();
content.self = locationResult;
content.adas = recognizedResults;
//todo 通过 websocket 发送内容
Logger.d( TAG, GsonUtil.jsonFromObject( content ) );
}
private void initWorkThread() {

View File

@@ -4,6 +4,8 @@ import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.ServiceConst;
import com.mogo.utils.LaunchUtils;
import com.mogo.utils.TipToast;
@@ -26,6 +28,7 @@ public class AppOperationIntentHandler implements IntentHandler {
public AppOperationIntentHandler() {
sAppPackages.put( "车聊聊", "com.zhidao.imdemo" );
sAppPackages.put( "VR模式", "" );
}
@Override
@@ -35,6 +38,12 @@ public class AppOperationIntentHandler implements IntentHandler {
String app = object.optString( "object" );
String operation = object.optString( "operation" );
if ( TextUtils.equals( "打开", operation ) ) {
if ( TextUtils.equals( "VR模式", app ) ) {
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isMainPageOnResume() ) {
MarkerServiceHandler.getApis().getMapFrameControllerApi().changeToVRMode();
}
return;
}
if ( TextUtils.isEmpty( sAppPackages.get( app ) ) ) {
return;
}
@@ -43,6 +52,13 @@ public class AppOperationIntentHandler implements IntentHandler {
} catch ( Exception e ) {
TipToast.shortTip( "应用程序未安装" );
}
} else if ( TextUtils.equals( "关闭", operation ) ) {
if ( TextUtils.equals( "VR模式", app ) ) {
if ( MarkerServiceHandler.getApis().getStatusManagerApi().isMainPageOnResume() ) {
MarkerServiceHandler.getApis().getMapFrameControllerApi().changeTo2dMode();
}
return;
}
}
} catch ( Exception e ) {
e.printStackTrace();

View File

@@ -35,7 +35,6 @@ import com.mogo.module.service.utils.ViewUtils;
import com.mogo.service.adas.IMogoADASControlStatusChangedListener;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.service.module.IMogoBizActionDoneListener;
import com.mogo.utils.AppUtils;
import com.mogo.utils.ResourcesHelper;
import com.mogo.utils.ThreadPoolService;
import com.mogo.utils.UiThreadHandler;
@@ -216,8 +215,10 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
mogoMarker.setToTop();
}
}
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
MarkerServiceHandler.getMapUIController().moveToCenter( mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated() );
if ( !MarkerServiceHandler.getApis().getMapFrameControllerApi().isVrMode() ) {
MarkerServiceHandler.getMogoStatusManager().setUserInteractionStatus( TAG, true, false );
MarkerServiceHandler.getMapUIController().moveToCenter( mogoMarker.getPosition(), DebugConfig.isRoadEventAnimated() );
}
}
private void updateCarUserInfoWindow( IMogoMarker marker ) {

View File

@@ -23,4 +23,6 @@ interface IMogoMapFrameController extends IProvider, IDestroyable {
* 切换到自研vr
*/
void changeToVRMode();
boolean isVrMode();
}

View File

@@ -71,7 +71,7 @@ class AdasObjectUtils {
result.color = rectBean.getColor();
result.speed = rectBean.getSpeed();
result.cardId = rectBean.getCarId();
result.mortonCode = MortonCode.encodeMorton( result.lon, result.lat );
result.mortonCode = MortonCode.wrapEncodeMorton( result.lon, result.lat );
return result;
}
}

View File

@@ -9,6 +9,7 @@ import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.utils.CarSeries;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.adas.IMogoADASController;
@@ -163,6 +164,9 @@ public class MogoADASController implements IMogoADASController {
if ( !SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getBoolean( getSpGuide(), false ) ) {
return;
}
if ( MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().isVrMode() ) {
return;
}
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
init( AbsMogoApplication.getApp() );
AutopilotServiceManage.getInstance().registerAutopilotServiceStatusListener( new IAutopilotServiceStatusListener() {