This commit is contained in:
wangcongtao
2020-12-15 19:45:35 +08:00
parent 8a9a92987d
commit 356a060ca7
8 changed files with 43 additions and 21 deletions

View File

@@ -25,9 +25,9 @@ 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.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import com.zhidaoauto.map.sdk.open.MapAutoApi;
import com.zhidaoauto.map.sdk.open.MapParams;
import com.zhidaoauto.map.sdk.open.abs.MapStatusListener;
import com.zhidaoauto.map.sdk.open.abs.OnCameraChangeListener;
import com.zhidaoauto.map.sdk.open.abs.OnMapClickListener;
@@ -82,6 +82,7 @@ public class AMapViewWrapper implements IMogoMapView,
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
private Location mLastDriveLocationShadow = null;
private EnumMapUI mCurrentUI;
public AMapViewWrapper( MapAutoView mMapView ) {
startTime = System.currentTimeMillis();
@@ -171,6 +172,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView.registerListener( this, MapAutoApi.LISTENER_TYPE_3D );
mMapView.setMOnCameraChangeListener( this );
mMapView.setOnMapStyleListener( this );
Logger.d( TAG, "styleop - initListeners - setOnMapStyleListener - view %s", mMapView );
// mMapView.setOnPolylineClickListener( this );
// mMapView.setAMapNaviViewListener( this );
@@ -257,7 +259,6 @@ public class AMapViewWrapper implements IMogoMapView,
public MapControlResult changeZoom( boolean zoom ) {
if ( checkAMapView() ) {
mDefaultZoomLevel = ( getMap().getZoomLevel() + 0.5f );
if ( zoom ) {
if ( mDefaultZoomLevel >= 20f ) {
return MapControlResult.TARGET;
@@ -290,7 +291,9 @@ public class AMapViewWrapper implements IMogoMapView,
if ( DebugConfig.isDebug() ) {
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
}
if ( mCurrentUI == EnumMapUI.Type_VR ) {
return MapControlResult.ERROR;
}
getMap().changeZoom( zoom );
return MapControlResult.SUCCESS;
}
@@ -305,6 +308,7 @@ public class AMapViewWrapper implements IMogoMapView,
case CarUp_2D:
case CarUp_3D:
case NorthUP_2D:
setUIMode( ui );
break;
case Type_VR:
mMapView.getMapAutoViewHelper().setMapStyle( MapAutoApi.MAP_STYLE_VR );
@@ -762,8 +766,27 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onChangeMapStyle( int i ) {
if ( i == MapParams.MAP_STYLE_VR ) {
MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_VR );
if ( i == MapAutoApi.MAP_STYLE_DAY
|| i == MapAutoApi.MAP_STYLE_DAY_NAV ) {
mCurrentUI = EnumMapUI.Type_Light;
} else if ( i == MapAutoApi.MAP_STYLE_NIGHT
|| i == MapAutoApi.MAP_STYLE_NIGHT_NAV ) {
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;
}
if ( mCurrentUI != null ) {
UiThreadHandler.post( () -> {
try {
MogoMapListenerHandler.getInstance().onMapModeChanged( mCurrentUI );
} catch ( Exception e ) {
e.printStackTrace();
}
} );
}
}
}

View File

@@ -91,7 +91,7 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
@Override
public IMogoMapView getMapView( Context context ) {
NavAutoApi.INSTANCE.init( context, MapParams.Companion.init()
.setDebugMode( false )
.setDebugMode( true )
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
.setZoom( 16 )

View File

@@ -77,7 +77,6 @@ public class ObjectUtils {
// .icons( descriptors )
// .period( opt.getPeriod() )
.rotateAngle( opt.getRotate() )
.marker3DIcon( opt.getIcon3DRes() )
.setFlat( opt.isFlat() )
.visible( opt.isVisible() )
.infoWindowEnable( opt.isInifoWindowEnable() )
@@ -86,6 +85,9 @@ public class ObjectUtils {
// .draggable( opt.isDraggable() )
.setInfoWindowOffset( opt.getOffsetX(), opt.getOffsetY() )
.zIndex( opt.getzIndex() );
if ( opt.getIcon3DRes() != 0 ) {
markerOptions.marker3DIcon( opt.getIcon3DRes() );
}
if ( !TextUtils.isEmpty( opt.getTitle() ) ) {
markerOptions.title( opt.getTitle() );
}
@@ -699,7 +701,7 @@ public class ObjectUtils {
target.setLonLatPoints( points );
}
target.setLineWidth( options.getWidth() );
target.setColor( options.getColor());
target.setColor( options.getColor() );
// target.zIndex( options.getWidth() );
// target.visible( options.isVisible() );
//// target.geodesic( options.isGeodesic() );