1. 定位按钮加入设置地图中心点的功能。
This commit is contained in:
@@ -22,16 +22,9 @@ public class MapCenterPointStrategy {
|
||||
|
||||
public static final MapCenterPoint DEFAULT = new MapCenterPoint( 0.677734D, 0.5733333D );
|
||||
|
||||
public static void init() {
|
||||
// 普通场景,使用高德内部值
|
||||
{
|
||||
Map< Integer, MapCenterPoint > common = new HashMap<>();
|
||||
common.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
common.put( CarSeries.CAR_SERIES_E84X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
common.put( CarSeries.CAR_SERIES_E84XCD, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
common.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.5D, 0.666666666D ) );
|
||||
sStrategies.put( Scene.COMMON, common );
|
||||
}
|
||||
private static MapCenterPoint sLastPoint = DEFAULT;
|
||||
|
||||
public static void init() {
|
||||
|
||||
{
|
||||
// 选点场景,定位中心点
|
||||
@@ -112,6 +105,22 @@ public class MapCenterPointStrategy {
|
||||
categoryV2XEvent.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.6963541D, 0.65D ) );
|
||||
sStrategies.put( Scene.CATEGORY_V2X_EVENT, categoryV2XEvent );
|
||||
}
|
||||
|
||||
try {
|
||||
sLastPoint = sStrategies.get( Scene.AIMLESS ).get( CarSeries.getSeries() );
|
||||
} catch ( Exception e ) {
|
||||
sLastPoint = DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
public static void restoreLastScene( IMogoMapUIController controller ) {
|
||||
if ( sLastPoint == null ) {
|
||||
return;
|
||||
}
|
||||
if ( controller == null ) {
|
||||
return;
|
||||
}
|
||||
controller.setPointToCenter( sLastPoint.x, sLastPoint.y );
|
||||
}
|
||||
|
||||
public static void addScene( int scene, Map< Integer, MapCenterPoint > config ) {
|
||||
@@ -138,6 +147,7 @@ public class MapCenterPointStrategy {
|
||||
if ( !sStrategies.containsKey( scene ) ) {
|
||||
Logger.w( TAG, "no strategy for scene: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
sLastPoint = DEFAULT;
|
||||
return;
|
||||
}
|
||||
Map< Integer, MapCenterPoint > points = sStrategies.get( scene );
|
||||
@@ -145,14 +155,17 @@ public class MapCenterPointStrategy {
|
||||
if ( !points.containsKey( car ) ) {
|
||||
Logger.w( TAG, "no strategy for series: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
sLastPoint = DEFAULT;
|
||||
return;
|
||||
}
|
||||
MapCenterPoint point = points.get( car );
|
||||
if ( point == null ) {
|
||||
Logger.w( TAG, "no strategy config for series: %s, use DEFAULT", scene );
|
||||
controller.setPointToCenter( DEFAULT.x, DEFAULT.y );
|
||||
sLastPoint = DEFAULT;
|
||||
return;
|
||||
}
|
||||
sLastPoint = point;
|
||||
controller.setPointToCenter( point.x, point.y );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user