merge branch

This commit is contained in:
tongchenfei
2021-01-07 19:33:30 +08:00
77 changed files with 1349 additions and 495 deletions

View File

@@ -239,7 +239,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
public void onDestroy() {
if ( mMapView != null ) {
mMapView.onDestroy();
AMapUIController.getInstance().release();
AMapUIController.release();
AMapWrapper.release();
Logger.d( TAG, "map onDestroy" );
}

View File

@@ -47,11 +47,16 @@ public class AMapUIController implements IMogoMapUIController {
}
public void initClient(IMogoMapUIController client) {
Logger.d( "whatthefuck-AMapUIController", "init %s", this );
this.mClient = client;
}
public synchronized void release() {
public synchronized void destroy(){
mClient = null;
}
public static synchronized void release() {
sInstance.destroy();
sInstance = null;
}
@@ -80,6 +85,7 @@ public class AMapUIController implements IMogoMapUIController {
@Override
public void changeMapMode(EnumMapUI mode) {
Logger.d( "whatthefuck-AMapUIController", "%s", this );
if (mClient != null) {
mClient.changeMapMode(mode);
}

View File

@@ -17,7 +17,9 @@ class MogoMapApi {
public static IMogoMapApiBuilder getApiBuilder() {
if ( sApiBuilder == null ) {
synchronized ( AutoNaviClient.class ) {
sApiBuilder = ARouter.getInstance().navigation( IMogoMapApiBuilder.class );
if ( sApiBuilder == null ) {
sApiBuilder = ARouter.getInstance().navigation( IMogoMapApiBuilder.class );
}
}
}
return sApiBuilder;

View File

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

View File

@@ -26,6 +26,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
@@ -70,7 +71,7 @@ public class AMapViewWrapper implements IMogoMapView,
private IMogoMap mIMap;
private AMapMarkerClickHandler mMarkerClickHandler;
private EnumMapUI mCurrentUIMode;
private EnumMapUI mCurrentCarUIMode;
private boolean mIsCarLocked = false;
private int mLockZoom = 16;
@@ -85,6 +86,10 @@ public class AMapViewWrapper implements IMogoMapView,
private Location mLastDriveLocationShadow = null;
private EnumMapUI mCurrentUI;
private boolean mIsLightStyle = false;
private boolean mMapLoaded = false;
private boolean mIsFirstLocated = true;
private boolean mIsDelayed = false;
public AMapViewWrapper( MapAutoView mMapView ) {
startTime = System.currentTimeMillis();
@@ -216,8 +221,6 @@ public class AMapViewWrapper implements IMogoMapView,
if ( mMapView != null ) {
mMapView.onCreate( bundle );
Logger.d( TAG, "map onCreate" );
initMapView();
initMyLocation();
}
}
@@ -241,6 +244,12 @@ public class AMapViewWrapper implements IMogoMapView,
public void onDestroy() {
if ( mMapView != null ) {
mMapView.onDestroy();
mMapView.setOnMarkClickListener( null );
mMapView.setOnMapLoadedListener( null );
mMapView.setOnMapTouchListener( null );
mMapView.setOnMapClickListener( null );
mMapView.getLocationClient().unRegisterListener( this );
mMapView.setMOnCameraChangeListener( null );
Logger.d( TAG, "map onDestroy" );
}
}
@@ -297,13 +306,13 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public MapControlResult changeZoom( float zoom ) {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return MapControlResult.ERROR;
}
Logger.d( TAG, "changeZoom %s", zoom );
if ( DebugConfig.isDebug() ) {
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
}
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return MapControlResult.ERROR;
}
getMap().changeZoom( zoom );
return MapControlResult.SUCCESS;
}
@@ -313,6 +322,7 @@ public class AMapViewWrapper implements IMogoMapView,
if ( ui == null ) {
return;
}
Logger.d( TAG, "设置的样式 = %s", ui );
if ( checkAMapView() ) {
switch ( ui ) {
case CarUp_2D:
@@ -326,10 +336,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 );
@@ -341,11 +353,11 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter( MogoLatLng latLng ) {
moveToCenter( latLng, true );
}
private void setUIMode( EnumMapUI ui ) {
this.mCurrentUIMode = ui;
this.mCurrentCarUIMode = ui;
if ( mMapView.getMapAutoViewHelper() != null ) {
switch ( ui ) {
case CarUp_2D:
@@ -353,6 +365,9 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_CAR );
break;
case NorthUP_2D:
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
mMapView.getMapAutoViewHelper().setMapViewPerspective( MapAutoApi.MAP_PERSPECTIVE_UP_NORTH );
break;
}
@@ -369,6 +384,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
Logger.d( TAG, "move to center %s", latLng );
if ( latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d ) {
Logger.e( TAG, "latlng = null or is illegal" );
@@ -384,6 +402,11 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void showMyLocation( boolean visible ) {
Logger.d( TAG, "showMyLocation1 %s", visible );
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) {
return;
}
@@ -436,6 +459,9 @@ public class AMapViewWrapper implements IMogoMapView,
// if ( DebugConfig.isDebug() ) {
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
// }
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
Logger.d( TAG, "锁车" );
// mMapView.getMapAutoViewHelper().setZoom(mLockZoom);
mMapView.getMapAutoViewHelper().setLockMode( true );
@@ -445,8 +471,8 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void loseLockMode() {
if ( DebugConfig.isDebug() ) {
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
Logger.d( TAG, "解锁锁车" );
mMapView.getMapAutoViewHelper().setLockMode( false );
@@ -501,6 +527,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
if ( checkAMapView() ) {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
mMapView.getMapAutoViewHelper().setPointToCenter( ( float ) mapCenterX, ( float ) mapCenterY );
}
@@ -572,11 +601,12 @@ 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() ) {
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
}
LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition );
if ( !lockCarPosition ) {
loseLockMode();
@@ -606,7 +636,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public EnumMapUI getCurrentUiMode() {
return mCurrentUIMode;
return mCurrentCarUIMode;
}
@Override
@@ -620,6 +650,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void setCarCursorOption( CarCursorOption option ) {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return;
}
if ( mCarCursorOption != null && mCarCursorOption != DEFAULT_OPTION ) {
mCarCursorOption.destroy();
}
@@ -690,7 +723,23 @@ public class AMapViewWrapper implements IMogoMapView,
}
NaviClient.getInstance( getContext() ).syncCarLocation( sysLocation );
MapStyleController.getInstance().onLocationChanged( location, this );
if ( checkAMapView() && mMapLoaded ) {
// 地图初始化完成后每隔5s自动判断当前地图的模式
if ( mIsFirstLocated ) {
if ( !mIsDelayed ) {
mIsDelayed = true;
UiThreadHandler.postDelayed( () -> {
Logger.d( TAG, "倒计时结束" );
mIsFirstLocated = false;
}, 5_000L );
}
} else {
mIsFirstLocated = true;
mIsDelayed = false;
Logger.d( TAG, "同步定位" );
MapStyleController.getInstance().onLocationChanged( location, this );
}
}
}
@Override
@@ -705,6 +754,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" );
@@ -714,9 +764,8 @@ public class AMapViewWrapper implements IMogoMapView,
cameraPosition.getBearing() );
Trace.endSection();
}
getMap().getUIController().setAnchorRate( 0.01f );
getMap().getUIController().setAnchorScale( 1.2f, 2.7f );
initMapView();
initMyLocation();
}
@Override
@@ -737,17 +786,17 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapStatusChanged( int type, int value ) {
Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
// Logger.i( TAG, "mapop--onMapStatusChanged-: " + type + "," + value );
}
@Override
public void onCameraChange( int type, int value ) {
Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
// Logger.i( TAG, "mapop--onCameraChange-: " + type + "," + value );
}
@Override
public void onCameraChangeFinish( @Nullable CameraPosition cameraPosition ) {
Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
// Logger.i( TAG, "mapop--onCameraChangeFinish-: " + cameraPosition + "cost:" + ( System.currentTimeMillis() - startTime ) );
if ( cameraPosition != null ) {
Trace.beginSection( "timer.onCameraChangeFinish" );
MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.getTarget() ),
@@ -773,8 +822,15 @@ public class AMapViewWrapper implements IMogoMapView,
}
//目前切换完vr之后会立即回调其他样式这里做一个判断
// private boolean mVrModeAutoChangedFlag = false;
@Override
public void onChangeMapStyle( int i ) {
EnumMapUI last = mCurrentUI;
Logger.d( TAG, "currentMapStyle = %s", i );
if ( i == MapAutoApi.MAP_STYLE_DAY
|| i == MapAutoApi.MAP_STYLE_DAY_NAV ) {
mCurrentUI = EnumMapUI.Type_Light;
@@ -783,11 +839,30 @@ public class AMapViewWrapper implements IMogoMapView,
mCurrentUI = EnumMapUI.Type_Night;
} else if ( i == MapAutoApi.MAP_STYLE_VR ) {
mCurrentUI = EnumMapUI.Type_VR;
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) {
mCurrentUI = EnumMapUI.CarUp_2D;
} else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
mCurrentUI = EnumMapUI.CarUp_3D;
}
// else if ( i == MapAutoApi.MAP_PERSPECTIVE_2D ) {
// mCurrentUI = EnumMapUI.CarUp_2D;
// } else if ( i == MapAutoApi.MAP_PERSPECTIVE_3D ) {
// mCurrentUI = EnumMapUI.CarUp_3D;
// }
if ( last == mCurrentUI ) {
Logger.d( TAG, "currentUI is same as last = %s", mCurrentUI );
return;
}
// vr 模式切换到普通模式下,保持之前的白天模式 wtf.
if ( last == EnumMapUI.Type_VR && mCurrentUI != last ) {
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
return;
}
// if ( mVrModeAutoChangedFlag ) {
// mVrModeAutoChangedFlag = false;
// return;
// }
}
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
if ( mCurrentUI != null ) {
UiThreadHandler.post( () -> {
try {
@@ -809,16 +884,32 @@ public class AMapViewWrapper implements IMogoMapView,
public void onStyleAutoChanged( boolean isVrMode ) {
if ( isVrMode ) {
if ( mCurrentUI != EnumMapUI.Type_VR ) {
changeZoom( 20 );
changeMapMode( EnumMapUI.Type_VR );
Logger.d( TAG, "自动切换为vr模式" );
// mVrModeAutoChangedFlag = true;
changeMapMode( EnumMapUI.Type_VR );
}
} else {
if ( mCurrentUI == EnumMapUI.Type_VR ) {
changeZoom( 16 );
changeMapMode( EnumMapUI.Type_Night );
Logger.d( TAG, "自动切换为2D模式" );
if ( mIsLightStyle ) {
changeMapMode( EnumMapUI.Type_Light );
} else {
changeMapMode( EnumMapUI.Type_Night );
}
}
}
}
private boolean mRtkEnable = false;
@Override
public void rtkEnable( boolean enable ) {
try {
mRtkEnable = !mRtkEnable;
TipToast.shortTip( mRtkEnable ? "已开启gps道路匹配" : "已开启rtk道路匹配" );
mMapView.getLocationClient().rtkEnable( mRtkEnable );
} catch ( Exception e ) {
Logger.e( TAG, e, "rtkEnable" );
}
}
}

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,16 +93,14 @@ 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 )
.setStyleDir( "sdcard/shmdata_asset/mogo_style" )
.setCachePath( "sdcard/tiles" )
.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);
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
return mapView;
}

View File

@@ -61,7 +61,6 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
marker.setMObject( this );
MarkerWrapperClickHelper.getInstance().setMogoMarkerMap( marker.getId(), this );
}
marker.setSaveBitmapEnable( true );
setObject( mogoMarkerOptions.getObject() );
this.mMogoMarkerOptions = mogoMarkerOptions;
mMogoMarkerOptions.addObserver( this );
@@ -141,12 +140,12 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
if ( icons == null || icons.isEmpty() ) {
return;
}
ArrayList<BitmapDescriptor> descriptors = new ArrayList<>();
ArrayList< BitmapDescriptor > descriptors = new ArrayList<>();
for ( Bitmap icon : icons ) {
if ( icon == null || icon.isRecycled() ) {
continue;
}
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap(icon));
descriptors.add( BitmapDescriptorFactory.INSTANCE.fromBitmap( icon ) );
}
if ( descriptors.isEmpty() ) {
return;
@@ -265,16 +264,16 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
@Override
public void setOnMarkerClickListener( IMogoMarkerClickListener listener ) {
mMogoMarkerClickListener = listener;
if ( mMarker != null ) {
mMarker.setOnMarkClickListener( new OnMarkClickListener() {
@Override
public void onMarkClick( @NotNull Marker marker ) {
if ( mMogoMarkerClickListener != null ) {
mMogoMarkerClickListener.onMarkerClicked( AMapMarkerWrapper.this );
}
}
} );
}
// if ( mMarker != null ) {
// mMarker.setOnMarkClickListener( new OnMarkClickListener() {
// @Override
// public void onMarkClick( @NotNull Marker marker ) {
// if ( mMogoMarkerClickListener != null ) {
// mMogoMarkerClickListener.onMarkerClicked( AMapMarkerWrapper.this );
// }
// }
// } );
// }
}
@Override
@@ -505,9 +504,14 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
@Override
public void use3DResource( int model3D ) {
try {
mMarker.setMarkerOptions( mMarker.getMarkeOptions().marker3DIcon( model3D ) );
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor("#00FF00").marker3DIcon( model3D ) );
} catch ( Exception e ) {
Logger.e( TAG, e, "use3DResource" );
}
}
@Override
public void setAnchorColor( String anchorColor ) {
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor( anchorColor ) );
}
}

View File

@@ -7,14 +7,12 @@ import android.view.View;
import android.view.animation.Interpolator;
import com.mogo.map.MogoLatLng;
import com.mogo.map.MogoMap;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.uicontroller.CarCursorOption;
import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.map.uicontroller.IMogoMapUIController;
import com.mogo.map.uicontroller.MapCameraPosition;
import com.mogo.map.uicontroller.MapControlResult;
import com.mogo.utils.logger.Logger;
import java.util.List;
@@ -291,4 +289,11 @@ public class AMapUIController implements IMogoMapUIController {
public void setAnchorRate( float rate ) {
}
@Override
public void rtkEnable( boolean enable ) {
if ( mClient != null ) {
mClient.rtkEnable( enable );
}
}
}

View File

@@ -1,6 +1,7 @@
package com.mogo.map.impl.custom.utils;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.text.TextUtils;
import android.view.View;
@@ -89,6 +90,11 @@ public class ObjectUtils {
}
if (opt.getIcon3DRes() != 0) {
markerOptions.marker3DIcon(opt.getIcon3DRes());
try {
Color.parseColor(opt.getAnchorColor());
markerOptions.anchorColor( opt.getAnchorColor() );
} catch ( Exception e ) {
}
}
if (!TextUtils.isEmpty(opt.getTitle())) {
markerOptions.title(opt.getTitle());

View File

@@ -349,4 +349,12 @@ public interface IMogoMarker {
default void use3DResource( @RawRes int model3D ) {
}
/**
* 设置3D车模颜色
* @param anchorColor
*/
default void setAnchorColor(String anchorColor){
}
}

View File

@@ -75,6 +75,7 @@ public class MogoMarkerOptions extends Observable {
private @RawRes
int mIcon3DRes = 0;
private String mAnchorColor;
private boolean mIs3DMode = false;
@@ -233,6 +234,11 @@ public class MogoMarkerOptions extends Observable {
return this;
}
public MogoMarkerOptions anchorColor( String anchorColor ) {
this.mAnchorColor = anchorColor;
return this;
}
public double getLatitude() {
return latitude;
}
@@ -334,6 +340,10 @@ public class MogoMarkerOptions extends Observable {
return mIcon3DRes;
}
public String getAnchorColor() {
return mAnchorColor;
}
@Override
public String toString() {
return "MogoMarkerOptions{" +

View File

@@ -238,7 +238,20 @@ public interface IMogoMapUIController {
}
default void testGpsData(){
default void testGpsData() {
}
/**
* 自研地图是否匹配道路
*
* @param enable
*/
default void rtkEnable( boolean enable ) {
}
default void destroy(){
}
}

View File

@@ -23,7 +23,7 @@ import java.util.List;
* 描述
*/
public class MogoMapUIController implements IMogoMapUIController {
private static final String TAG = "MogoMapUIController";
private IMogoMapUIController mDelegate;
@@ -31,13 +31,13 @@ public class MogoMapUIController implements IMogoMapUIController {
private static volatile MogoMapUIController sInstance;
private MogoMapUIController() {
mDelegate = MogoMapDelegateFactory.getMapUIControllerDelegate();
initDelegate();
}
public static MogoMapUIController getInstance() {
if (sInstance == null) {
synchronized (MogoMapUIController.class) {
if (sInstance == null) {
if ( sInstance == null ) {
synchronized ( MogoMapUIController.class ) {
if ( sInstance == null ) {
sInstance = new MogoMapUIController();
}
}
@@ -49,53 +49,54 @@ public class MogoMapUIController implements IMogoMapUIController {
this.mDelegate = mDelegate;
}
public synchronized void release() {
public static synchronized void release() {
sInstance = null;
}
@Override
public void setTrafficEnabled(boolean visible) {
if (mDelegate != null) {
mDelegate.setTrafficEnabled(visible);
public void setTrafficEnabled( boolean visible ) {
if ( mDelegate != null ) {
mDelegate.setTrafficEnabled( visible );
}
}
@Override
public MapControlResult changeZoom( boolean zoom) {
if (mDelegate != null) {
return mDelegate.changeZoom(zoom);
public MapControlResult changeZoom( boolean zoom ) {
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
}
return MapControlResult.ERROR;
}
@Override
public MapControlResult changeZoom(float zoom) {
if (mDelegate != null) {
return mDelegate.changeZoom(zoom);
public MapControlResult changeZoom( float zoom ) {
if ( mDelegate != null ) {
return mDelegate.changeZoom( zoom );
}
return MapControlResult.ERROR;
}
@Override
public void changeMapMode(EnumMapUI mode) {
if (mDelegate != null) {
public void changeMapMode( EnumMapUI mode ) {
if ( mDelegate != null ) {
Logger.d( "whatthefuck-MogoMapUIController", "%s", this );
Logger.d( TAG, "set type: %s", mode.name() );
mDelegate.changeMapMode(mode);
mDelegate.changeMapMode( mode );
}
}
@Override
public void moveToCenter(MogoLatLng latLng, boolean animate) {
if (mDelegate != null) {
mDelegate.moveToCenter(latLng, animate);
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
if ( mDelegate != null ) {
mDelegate.moveToCenter( latLng, animate );
}
}
@Override
public void showMyLocation(boolean visible) {
if (mDelegate != null) {
mDelegate.showMyLocation(visible);
public void showMyLocation( boolean visible ) {
if ( mDelegate != null ) {
mDelegate.showMyLocation( visible );
}
}
@@ -115,7 +116,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public void recoverLockMode() {
if (mDelegate != null) {
if ( mDelegate != null ) {
mDelegate.recoverLockMode();
}
}
@@ -128,22 +129,22 @@ public class MogoMapUIController implements IMogoMapUIController {
}
@Override
public void setLockZoom(int var1) {
if (mDelegate != null) {
mDelegate.setLockZoom(var1);
public void setLockZoom( int var1 ) {
if ( mDelegate != null ) {
mDelegate.setLockZoom( var1 );
}
}
@Override
public void displayOverview( Rect bounds ) {
if (mDelegate != null) {
mDelegate.displayOverview(bounds);
if ( mDelegate != null ) {
mDelegate.displayOverview( bounds );
}
}
@Override
public float getScalePerPixel() {
if (mDelegate != null) {
if ( mDelegate != null ) {
return mDelegate.getScalePerPixel();
}
return 0;
@@ -151,7 +152,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public float getZoomLevel() {
if (mDelegate != null) {
if ( mDelegate != null ) {
return mDelegate.getZoomLevel();
}
return 0;
@@ -159,7 +160,7 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraNorthEastPosition() {
if (mDelegate != null) {
if ( mDelegate != null ) {
return mDelegate.getCameraNorthEastPosition();
}
return null;
@@ -167,38 +168,39 @@ public class MogoMapUIController implements IMogoMapUIController {
@Override
public MogoLatLng getCameraSouthWestPosition() {
if (mDelegate != null) {
if ( mDelegate != null ) {
return mDelegate.getCameraSouthWestPosition();
}
return null;
}
@Override public MogoLatLng getWindowCenterLocation() {
if (mDelegate != null) {
@Override
public MogoLatLng getWindowCenterLocation() {
if ( mDelegate != null ) {
return mDelegate.getWindowCenterLocation();
}
return null;
}
@Override
public void setPointToCenter(double mapCenterX, double mapCenterY) {
if (mDelegate != null) {
mDelegate.setPointToCenter(mapCenterX, mapCenterY);
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
if ( mDelegate != null ) {
mDelegate.setPointToCenter( mapCenterX, mapCenterY );
}
}
@Override
public Point getLocationPointInScreen( MogoLatLng latLng ) {
if (mDelegate != null) {
return mDelegate.getLocationPointInScreen(latLng);
if ( mDelegate != null ) {
return mDelegate.getLocationPointInScreen( latLng );
}
return null;
}
@Override
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
if (mDelegate != null) {
return mDelegate.getLocationMogoLatLngInScreen(point);
public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
if ( mDelegate != null ) {
return mDelegate.getLocationMogoLatLngInScreen( point );
}
return null;
}
@@ -218,7 +220,7 @@ public class MogoMapUIController implements IMogoMapUIController {
}
@Override
public void showBounds(String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
if ( mDelegate != null ) {
mDelegate.showBounds( tag, carPosition, lonLats, bound, lockCarPosition );
}
@@ -283,4 +285,23 @@ public class MogoMapUIController implements IMogoMapUIController {
mDelegate.changeBearing( bearing );
}
}
@Override
public void rtkEnable( boolean enable ) {
if ( mDelegate != null ) {
mDelegate.rtkEnable( enable );
}
}
@Override
public void destroy() {
mDelegate = null;
release();
}
private void initDelegate() {
if ( mDelegate == null ) {
mDelegate = MogoMapDelegateFactory.getMapUIControllerDelegate();
}
}
}

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 {