@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
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;
|
||||
@@ -34,31 +33,30 @@ import com.zhidaoauto.map.sdk.open.NavAutoApi;
|
||||
import com.zhidaoauto.map.sdk.open.NavParams;
|
||||
import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/12/9
|
||||
*
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MapApiPath.PATH )
|
||||
class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
@Route(path = MapApiPath.PATH)
|
||||
public class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
|
||||
private static final String TAG = "CustomMapApiBuilder";
|
||||
|
||||
@Override
|
||||
public IMogoGeoSearch getGeoSearch( Context context ) {
|
||||
return new GeocodeSearchClient( context );
|
||||
public IMogoGeoSearch getGeoSearch(Context context) {
|
||||
return new GeocodeSearchClient(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoInputtipsSearch getInputtipsSearch( Context context, MogoInputtipsQuery query ) {
|
||||
return new InputtipsSearch( context, query );
|
||||
public IMogoInputtipsSearch getInputtipsSearch(Context context, MogoInputtipsQuery query) {
|
||||
return new InputtipsSearch(context, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationClient getLocationClient( Context context ) {
|
||||
return new ALocationClient( context );
|
||||
public IMogoLocationClient getLocationClient(Context context) {
|
||||
return new ALocationClient(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,13 +65,13 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNavi getNavi( Context context ) {
|
||||
return NaviClient.getInstance( context );
|
||||
public IMogoNavi getNavi(Context context) {
|
||||
return NaviClient.getInstance(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPoiSearch getPoiSearchClient( Context context, MogoPoiSearchQuery query ) {
|
||||
return new PoiSearchClient( context, query );
|
||||
public IMogoPoiSearch getPoiSearchClient(Context context, MogoPoiSearchQuery query) {
|
||||
return new PoiSearchClient(context, query);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,31 +80,31 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoAimless getAimless( Context context ) {
|
||||
public IMogoAimless getAimless(Context context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMapView( Context context ) {
|
||||
public void createMapView(Context context) {
|
||||
// do not implements.
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapView getMapView( Context context ) {
|
||||
Log.d(TAG,"setDebugMode==true");
|
||||
public IMogoMapView getMapView(Context context) {
|
||||
Log.d(TAG, "setDebugMode==true");
|
||||
|
||||
MapParams mapParams = MapParams.Companion.init();
|
||||
mapParams.setDebugMode( false )
|
||||
MapParams mapParams = MapParams.Companion.init();
|
||||
mapParams.setDebugMode(false)
|
||||
// .setDataFileSource(1) //todo 1-使用本地地图数据,0-使用在线地图数据
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setCoordinateType(MapParams.COORDINATETYPE_GCJ02)
|
||||
.setPerspectiveMode(MapParams.MAP_PERSPECTIVE_2D)
|
||||
// .setZoom( 20 )
|
||||
// .setPointToCenter( 0.734375f, 0.5f )
|
||||
.setPointToCenter( 0.5f, 0.5f ) //todo 2D模式下需要注意ADAS部分遮挡
|
||||
.setStyleMode( MapParams.MAP_STYLE_VR );
|
||||
.setPointToCenter(0.5f, 0.5f) //todo 2D模式下需要注意ADAS部分遮挡
|
||||
.setStyleMode(MapParams.MAP_STYLE_VR);
|
||||
|
||||
|
||||
NavAutoApi.INSTANCE.init( context, mapParams, NavParams.Companion.init());
|
||||
NavAutoApi.INSTANCE.init(context, mapParams, NavParams.Companion.init());
|
||||
MapAutoView mapAutoView = new MapAutoView(context);
|
||||
IMogoMapView mapView = new AMapViewWrapper(mapAutoView);
|
||||
return mapView;
|
||||
@@ -123,8 +121,8 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getResIdByIconType( Context context, int iconType ) {
|
||||
return IconTypeUtils.getResIdByIconType( context, iconType );
|
||||
public int getResIdByIconType(Context context, int iconType) {
|
||||
return IconTypeUtils.getResIdByIconType(context, iconType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -133,7 +131,7 @@ class CustomMapApiBuilder implements IMogoMapApiBuilder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "init" );
|
||||
public void init(Context context) {
|
||||
Logger.d(TAG, "init");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,113 +28,75 @@ class MogoMapDelegateFactory {
|
||||
|
||||
private static final String TAG = "MogoMapDelegateFactory";
|
||||
|
||||
// private static boolean useCustom = false;
|
||||
//
|
||||
// public static boolean isUseCustom() {
|
||||
// return useCustom;
|
||||
// }
|
||||
|
||||
private static IMogoMapApiBuilder sApiBuilder;
|
||||
|
||||
private static IMogoMapApiBuilder getApiBuilder() {
|
||||
if ( sApiBuilder == null ) {
|
||||
synchronized ( MogoMapDelegateFactory.class ) {
|
||||
if ( sApiBuilder == null ) {
|
||||
sApiBuilder = ARouter.getInstance().navigation( IMogoMapApiBuilder.class );
|
||||
if (sApiBuilder == null) {
|
||||
synchronized (MogoMapDelegateFactory.class) {
|
||||
if (sApiBuilder == null) {
|
||||
sApiBuilder = ARouter.getInstance().navigation(IMogoMapApiBuilder.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
return sApiBuilder;
|
||||
}
|
||||
|
||||
public static IMogoGeoSearch getGeoSearchDelegate( Context context ) {
|
||||
return getApiBuilder().getGeoSearch( context );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoGeoSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.GeocodeSearchClient( context );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.GeocodeSearchClient( context );
|
||||
public static IMogoGeoSearch getGeoSearchDelegate(Context context) {
|
||||
return getApiBuilder().getGeoSearch(context);
|
||||
}
|
||||
|
||||
public static IMogoInputtipsSearch getInputtipsSearchDelegate( Context context, MogoInputtipsQuery query ) {
|
||||
return getApiBuilder().getInputtipsSearch( context, query );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoInputtipsSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.InputtipsSearch( context, query );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.InputtipsSearch( context, query );
|
||||
public static IMogoInputtipsSearch getInputtipsSearchDelegate(Context context, MogoInputtipsQuery query) {
|
||||
return getApiBuilder().getInputtipsSearch(context, query);
|
||||
}
|
||||
|
||||
public static IMogoLocationClient getLocationClientDelegate( Context context ) {
|
||||
return getApiBuilder().getLocationClient( context );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoLocationClient" );
|
||||
// return new com.mogo.map.impl.custom.location.ALocationClient( context );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.location.ALocationClient( context );
|
||||
public static IMogoLocationClient getLocationClientDelegate(Context context) {
|
||||
return getApiBuilder().getLocationClient(context);
|
||||
}
|
||||
|
||||
public static IMogoMapUIController getMapUIControllerDelegate() {
|
||||
return getApiBuilder().getMapUIController();
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoMapUIController" );
|
||||
// return com.mogo.map.impl.custom.uicontroller.AMapUIController.getInstance();
|
||||
// }
|
||||
// return com.mogo.map.impl.amap.uicontroller.AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
public static IMogoNavi getNaviDelegate( Context context ) {
|
||||
public static IMogoNavi getNaviDelegate(Context context) {
|
||||
|
||||
if ( DebugConfig.isUseCustomNavi() ) {
|
||||
return getApiBuilder().getNavi( context );
|
||||
// return com.mogo.map.impl.amap.navi.NaviClient.getInstance( context );
|
||||
} else if ( AppUtils.isAppInstalled( context, "com.autonavi.amapauto" ) ) {
|
||||
return AutoNaviClient.getInstance( context );
|
||||
if (DebugConfig.isUseCustomNavi()) {
|
||||
return getApiBuilder().getNavi(context);
|
||||
} else if (AppUtils.isAppInstalled(context, "com.autonavi.amapauto")) {
|
||||
return AutoNaviClient.getInstance(context);
|
||||
}
|
||||
return getApiBuilder().getNavi( context );
|
||||
// return com.mogo.map.impl.amap.navi.NaviClient.getInstance( context );
|
||||
return getApiBuilder().getNavi(context);
|
||||
}
|
||||
|
||||
public static IMogoPoiSearch getPoiSearchClientDelegate( Context context, MogoPoiSearchQuery query ) {
|
||||
return getApiBuilder().getPoiSearchClient( context, query );
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoPoiSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.PoiSearchClient( context, query );
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.PoiSearchClient( context, query );
|
||||
public static IMogoPoiSearch getPoiSearchClientDelegate(Context context, MogoPoiSearchQuery query) {
|
||||
return getApiBuilder().getPoiSearchClient(context, query);
|
||||
}
|
||||
|
||||
public static IMogoRoadSearch getRoadSearchDelegate() {
|
||||
return getApiBuilder().getRoadSearch();
|
||||
// if ( useCustom ) {
|
||||
// Logger.d( TAG, "use custom IMogoRoadSearch" );
|
||||
// return new com.mogo.map.impl.custom.search.RoadSearchClient();
|
||||
// }
|
||||
// return new com.mogo.map.impl.amap.search.RoadSearchClient();
|
||||
}
|
||||
|
||||
|
||||
public static IMogoAimless getAimless( Context context ) {
|
||||
return getApiBuilder().getAimless( context );
|
||||
public static IMogoAimless getAimless(Context context) {
|
||||
return getApiBuilder().getAimless(context);
|
||||
}
|
||||
|
||||
public static void createMapViewInstance( Context context ) {
|
||||
getApiBuilder().createMapView( context );
|
||||
public static void createMapViewInstance(Context context) {
|
||||
getApiBuilder().createMapView(context);
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
getApiBuilder().destroy();
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView( Context context ) {
|
||||
return getApiBuilder().getMapView( context );
|
||||
public static IMogoMapView getMapView(Context context) {
|
||||
return getApiBuilder().getMapView(context);
|
||||
}
|
||||
|
||||
public static IMogoTrafficSearch getTrafficSearch() {
|
||||
return getApiBuilder().getTrafficSearch();
|
||||
}
|
||||
|
||||
public static CoordinatesTransformer getCoordinatesTransformer(){
|
||||
public static CoordinatesTransformer getCoordinatesTransformer() {
|
||||
return getApiBuilder().getCoordinatesTransformer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,12 +107,10 @@ public class MogoMarkerManager implements IMogoMarkerManager {
|
||||
|
||||
@Override
|
||||
public void addRouteWay(Context context, MogoLatLng startPoint, MogoLatLng endPoint, List< MogoLatLng > wayPoints ) {
|
||||
// RouteOverlayHelper.getInstance().addRouteWay( context, startPoint, endPoint, wayPoints );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRouteWayOverlay() {
|
||||
// RouteOverlayHelper.getInstance().removeAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user