dev
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user