This commit is contained in:
unknown
2021-01-05 10:11:49 +08:00
73 changed files with 1185 additions and 342 deletions

View File

@@ -67,7 +67,7 @@ dependencies {
implementation project(':foudations:mogo-commons')
}
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.5.3'
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.5.7'
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-7.4.5-log-1'
}

View File

@@ -85,6 +85,8 @@ public class AMapViewWrapper implements IMogoMapView,
private Location mLastDriveLocationShadow = null;
private EnumMapUI mCurrentUI;
private boolean mIsLightStyle = false;
private boolean mMapLoaded = false;
public AMapViewWrapper( MapAutoView mMapView ) {
startTime = System.currentTimeMillis();
@@ -327,10 +329,12 @@ public class AMapViewWrapper implements IMogoMapView,
case Type_Light:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_DAY );
mIsLightStyle = true;
break;
case Type_Night:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( false );
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_NIGHT );
mIsLightStyle = false;
break;
case Type_AUTO_LIGHT_Night:
mMapView.getMapAutoViewHelper().setAutoSwitchStyle( true );
@@ -342,7 +346,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter( MogoLatLng latLng ) {
moveToCenter( latLng, true );
}
private void setUIMode( EnumMapUI ui ) {
@@ -573,6 +577,10 @@ public class AMapViewWrapper implements IMogoMapView,
if ( !checkAMapView() ) {
return;
}
if ( mCurrentUI == EnumMapUI.Type_VR ) {
Logger.w( TAG, "vr 模式下忽略该设置" );
return;
}
Logger.i( TAG, "showBounds:%s -%s-%s- %b ", tag, carPosition.toString(), bound.toShortString(), lockCarPosition );
try {
if ( DebugConfig.isDebug() ) {
@@ -691,7 +699,12 @@ public class AMapViewWrapper implements IMogoMapView,
}
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
MapStyleController.getInstance().onLocationChanged( location, this );
if ( checkAMapView() && mMapLoaded ) {
// 避免设置之后被其他初始化给重置为其他模式
UiThreadHandler.postDelayed( () -> {
MapStyleController.getInstance().onLocationChanged( location, this );
}, 5_000L );
}
}
@Override
@@ -706,6 +719,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onMapLoaded() {
Logger.i( TAG, "autoop--onMapLoaded: " );
MogoMapListenerHandler.getInstance().onMapLoaded();
mMapLoaded = true;
CameraPosition cameraPosition = mMapView.getMapAutoViewHelper().getCameraPosition();
if ( cameraPosition != null ) {
Trace.beginSection( "timer.onCameraChangeFinish" );
@@ -715,9 +729,6 @@ public class AMapViewWrapper implements IMogoMapView,
cameraPosition.getBearing() );
Trace.endSection();
}
getMap().getUIController().setAnchorRate( 0.01f );
getMap().getUIController().setAnchorScale( 1.2f, 2.7f );
}
@Override
@@ -776,6 +787,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onChangeMapStyle( int i ) {
EnumMapUI last = mCurrentUI;
if ( i == MapAutoApi.MAP_STYLE_DAY
|| i == MapAutoApi.MAP_STYLE_DAY_NAV ) {
mCurrentUI = EnumMapUI.Type_Light;
@@ -789,6 +803,14 @@ public class AMapViewWrapper implements IMogoMapView,
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
mCurrentUI = EnumMapUI.CarUp_3D;
}
// vr 模式切换到普通模式下,保持之前的白天模式 wtf.
if ( last == EnumMapUI.Type_VR && mCurrentUI != last ) {
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
return;
}
}
if ( mCurrentUI != null ) {
UiThreadHandler.post( () -> {
try {
@@ -817,7 +839,11 @@ public class AMapViewWrapper implements IMogoMapView,
} else {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
changeZoom( 16 );
changeMapMode( EnumMapUI.Type_Night );
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
} else {
changeMapMode( EnumMapUI.Type_Night );
}
Logger.d( TAG, "自动切换为2D模式" );
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.map.impl.custom;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.CoordinatesTransformer;
import com.mogo.map.IMogoMapApiBuilder;
import com.mogo.map.IMogoMapView;
@@ -92,14 +93,20 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public IMogoMapView getMapView( Context context ) {
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
.setDebugMode( true )
.setDebugMode( DebugConfig.isDebug() )
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 16 )
.setPointToCenter( 0.734375f, 0.5f )
.setStyleMode( MapParams.MAP_STYLE_NIGHT ), NavParams.Companion.init() );
MapAutoView mapAutoView = new MapAutoView( context );
IMogoMapView mapView = new AMapViewWrapper( mapAutoView );
MapAutoView mapAutoView = new MapAutoView(context);
Logger.w(TAG, "mapAutoView==" + mapAutoView);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
return mapView;
}

View File

@@ -7,7 +7,7 @@ class HttpConstants {
companion object {
const val DEV_BASE_URL_OWNER = "http://dzt-test.zhidaozhixing.com/"
const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaohulian.com/"
const val RELEASE_BASE_URL_OWNER = "http://dzt.zhidaozhixing.com/"
const val SHOW_BASE_URL_OWNER = "http://dzt-show.zhidaozhixing.com/"
fun getBaseUrl(): String {