opt
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.IMogoMapViewCreator;
|
||||
@@ -23,11 +22,11 @@ public class AMapBaseMapView implements IMogoMapViewCreator {
|
||||
|
||||
@Override
|
||||
public IMogoMapView create( Context context ) {
|
||||
MapAutoApi.INSTANCE.init(context, MapParams.Companion.init().setDebugMode( false )
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter(0.5f,0.5f)
|
||||
.setPointToCenter( 0.5f, 0.5f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ) );
|
||||
mapAutoView = new MapAutoView( context );
|
||||
return new AMapViewWrapper( mapAutoView );
|
||||
|
||||
@@ -1,886 +0,0 @@
|
||||
//package com.mogo.map.impl.custom;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.BitmapFactory;
|
||||
//import android.graphics.Color;
|
||||
//import android.graphics.Point;
|
||||
//import android.graphics.Rect;
|
||||
//import android.location.Location;
|
||||
//import android.os.Bundle;
|
||||
//import android.os.SystemClock;
|
||||
//import android.os.Trace;
|
||||
//import android.util.Log;
|
||||
//import android.view.MotionEvent;
|
||||
//import android.view.View;
|
||||
//import android.view.animation.Interpolator;
|
||||
//
|
||||
//import com.mogo.commons.debug.DebugConfig;
|
||||
//import com.mogo.map.IMogoMap;
|
||||
//import com.mogo.map.IMogoMapView;
|
||||
//import com.mogo.map.MogoLatLng;
|
||||
//import com.mogo.map.impl.custom.hook.BnHooker;
|
||||
//import com.mogo.map.impl.custom.marker.AMapMarkerWrapper;
|
||||
//import com.mogo.map.impl.custom.message.AMapMessageListener;
|
||||
//import com.mogo.map.impl.custom.message.AMapMessageManager;
|
||||
//import com.mogo.map.impl.custom.navi.NaviClient;
|
||||
//import com.mogo.map.impl.custom.utils.MogoMapUtils;
|
||||
//import com.mogo.map.impl.custom.utils.ObjectUtils;
|
||||
//import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
//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.WindowUtils;
|
||||
//import com.mogo.utils.logger.Logger;
|
||||
//import com.zhidaoauto.map.sdk.open.MapParams;
|
||||
//import com.zhidaoauto.map.sdk.open.camera.CameraUpdate;
|
||||
//import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
//import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
|
||||
//import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
//import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
//import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
//
|
||||
//import org.jetbrains.annotations.NotNull;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-12-18
|
||||
// * <p>
|
||||
// * 代理自研导航地图
|
||||
// */
|
||||
//public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
// IMogoMapUIController,
|
||||
// OnMarkClickListener,
|
||||
//// AMap.OnMapLoadedListener,
|
||||
//// AMap.OnMapTouchListener,
|
||||
//// AMap.OnPOIClickListener,
|
||||
//// AMap.OnMapClickListener,
|
||||
//// AMap.OnPolylineClickListener,
|
||||
//// AMapNaviViewListener,
|
||||
//// AMapMessageListener,
|
||||
//// AMap.OnCameraChangeListener,
|
||||
// LocationListener {
|
||||
//
|
||||
// private static final String TAG = "AMapNaviViewWrapper";
|
||||
//
|
||||
// private final MapAutoView mMapView;
|
||||
// private IMogoMap mIMap;
|
||||
//
|
||||
// private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
// private EnumMapUI mCurrentUIMode;
|
||||
//
|
||||
// private boolean mIsCarLocked = false;
|
||||
//
|
||||
// private float mDefaultZoomLevel = 16.0f;
|
||||
// private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
|
||||
// .carCursorRes( R.drawable.map_api_ic_current_location2 )
|
||||
// .naviCursorRes( R.drawable.ic_amap_navi_cursor )
|
||||
// .build();
|
||||
// private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
//
|
||||
// public AMapNaviViewWrapper( MapAutoView mapView ) {
|
||||
// this.mMapView = mapView;
|
||||
// this.mIMap = new AMapWrapper( mMapView.getMapAutoViewHelper(), mMapView, this );
|
||||
// try {
|
||||
// new BnHooker( mMapView.getMapAutoViewHelper(), mapView.getContext() );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void initMapView() {
|
||||
// if ( mMapView == null ) {
|
||||
// return;
|
||||
// }
|
||||
// MapAutoViewHelper options = mMapView.getMapAutoViewHelper();
|
||||
// if ( options != null ) {
|
||||
// // 设置是否开启自动黑夜模式切换,默认为false,不自动切换
|
||||
//// options.setAutoNaviViewNightMode( false );
|
||||
// // 设置6秒后是否自动锁车
|
||||
//// options.setAutoLockCar( false );
|
||||
// // 设置路线上的摄像头气泡是否显示
|
||||
//// options.setCameraBubbleShow( true );
|
||||
// // 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。
|
||||
// // options.setRouteOverlayOptions( MapStyleUtils.getRouteOverlayOptions() );
|
||||
// // 设置自车的图片对象
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
// // 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。
|
||||
// options.hiddenDirection();
|
||||
// // 黑夜模式
|
||||
// options.setMapStyle(MapParams.MAP_STYLE_NIGHT);
|
||||
// //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficBarEnabled( false );
|
||||
// // 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficLayerEnabled( false );
|
||||
// // 设置导航界面是否显示路线全览按钮。
|
||||
//// options.setRouteListButtonShow( false );
|
||||
// // 设置导航状态下屏幕是否一直开启。
|
||||
//// options.setScreenAlwaysBright( true );
|
||||
// // 设置交通播报是否打开(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficInfoUpdateEnabled( true );
|
||||
// // 设置摄像头播报是否打开(只适用于驾车导航)。
|
||||
//// options.setCameraInfoUpdateEnabled( true );
|
||||
// // 设置菜单按钮是否在导航界面显示。
|
||||
//// options.setSettingMenuEnabled( false );
|
||||
// // 设置是否绘制显示交通路况的线路(彩虹线),拥堵-红色,畅通-绿色,缓慢-黄色,未知-蓝色。默认不绘制彩虹线。
|
||||
//// options.setTrafficLine( true );
|
||||
// // 设置是否绘制牵引线(当前位置到目的地的指引线)。默认不绘制牵引线。
|
||||
//// options.setLeaderLineEnabled( -1 );
|
||||
// // 设置导航界面UI是否显示。
|
||||
//// options.setLayoutVisible( false );
|
||||
// // 设置是否自动画路
|
||||
//// options.setAutoDrawRoute( false );
|
||||
// // 设置是否显示路口放大图(实景图)
|
||||
//// options.setRealCrossDisplayShow( false );
|
||||
// // 设置是否显示路口放大图(路口模型图)
|
||||
//// options.setModeCrossDisplayShow( false );
|
||||
// // 设置是否显示道路信息view
|
||||
//// options.setLaneInfoShow( false );
|
||||
// // 设置是否自动改变缩放等级
|
||||
//// options.setAutoChangeZoom( false );
|
||||
// // 设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
//// options.setAutoDisplayOverview( false );
|
||||
// // 设置路线转向箭头隐藏和显示
|
||||
//// options.setNaviArrowVisible( false );
|
||||
// // 通过路线是否自动置灰,仅支持驾车导航
|
||||
//// options.setAfterRouteAutoGray( true );
|
||||
// options.setZoom( ( ( int ) mDefaultZoomLevel ) );
|
||||
// options.setPointToCenter( 0.5D, 0.5D );
|
||||
// // 2D模式
|
||||
// options.setTilt( 0 );
|
||||
// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// mMapView.setRouteOverlayVisible( false );
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
// setUIMode( EnumMapUI.CarUp_2D, null );
|
||||
// }
|
||||
//
|
||||
// private void initListeners() {
|
||||
//
|
||||
// mMapView.setOnMarkerClickListener( this );
|
||||
// mMarkerClickHandler = new AMapMarkerClickHandler();
|
||||
// mMapView.setOnMapLoadedListener( this );
|
||||
// mMapView.setOnMapTouchListener( this );
|
||||
// mMapView.setOnPolylineClickListener( this );
|
||||
// mMapView.setAMapNaviViewListener( this );
|
||||
// mMapView.setOnCameraChangeListener( this );
|
||||
//
|
||||
// final AMap aMap = mMapView.getMap();
|
||||
// if ( aMap != null ) {
|
||||
// aMap.setOnPOIClickListener( this );
|
||||
// aMap.setOnMapClickListener( this );
|
||||
// aMap.setOnCameraChangeListener( this );
|
||||
// aMap.setOnMyLocationChangeListener( this );
|
||||
// }
|
||||
// AMapMessageManager.getInstance().registerAMapMessageListener( this );
|
||||
// }
|
||||
//
|
||||
// private Context getContext() {
|
||||
// return mMapView.getContext();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public View getMapView() {
|
||||
// return mMapView;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public IMogoMap getMap() {
|
||||
// return mIMap;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCreate( Bundle bundle ) {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onCreate( bundle );
|
||||
// Logger.d( TAG, "map onCreate" );
|
||||
// initMapView();
|
||||
// initListeners();
|
||||
// initMyLocation();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onResume() {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onResume();
|
||||
// Logger.d( TAG, "map onResume" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPause() {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onPause();
|
||||
// Logger.d( TAG, "map onPause" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onDestroy() {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onDestroy();
|
||||
// Logger.d( TAG, "map onDestroy" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onSaveInstanceState( Bundle outState ) {
|
||||
// if ( mMapView != null ) {
|
||||
// mMapView.onSaveInstanceState( outState );
|
||||
// Logger.d( TAG, "map onSaveInstanceState" );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLowMemory() {
|
||||
// Logger.d( TAG, "map onLowMemory" );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 地图marker点击
|
||||
// */
|
||||
// @Override
|
||||
// public boolean onMarkerClick( Marker marker ) {
|
||||
// return mMarkerClickHandler.handleMarkerClicked( marker );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 地图加载完毕
|
||||
// */
|
||||
// @Override
|
||||
// public void onMapLoaded() {
|
||||
// MogoMapListenerHandler.getInstance().onMapLoaded();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 地图点击回调
|
||||
// */
|
||||
// @Override
|
||||
// public void onTouch( MotionEvent motionEvent ) {
|
||||
// MogoMapListenerHandler.getInstance().onTouch( motionEvent );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * POI 点击
|
||||
// */
|
||||
// @Override
|
||||
// public void onPOIClick( Poi poi ) {
|
||||
// if ( InterceptorHandler.getInstance().ignorePoiClicked( getContext() ) ) {
|
||||
// return;
|
||||
// }
|
||||
// MogoMapListenerHandler.getInstance().onPOIClick( ObjectUtils.fromAMap( poi ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMapClick( LatLng latLng ) {
|
||||
// if ( InterceptorHandler.getInstance().ignoreMapClicked( getContext() ) ) {
|
||||
// return;
|
||||
// }
|
||||
// MogoMapListenerHandler.getInstance().onMapClick( ObjectUtils.fromAMap( latLng ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPolylineClick( Polyline polyline ) {
|
||||
// if ( !NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// NaviClient.getInstance( getContext() ).handleClickedPolyline( polyline );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviSetting() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviCancel() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onNaviBackClick() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param mode 0:车头朝上状态;1:正北朝上模式
|
||||
// */
|
||||
// @Override
|
||||
// public void onNaviMapMode( int mode ) {
|
||||
// Logger.i( TAG, "mode=" + mode );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviTurnClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNextRoadClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onScanViewButtonClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLockMap( boolean isLock ) {
|
||||
// Logger.d( TAG, "lock status = %s", isLock );
|
||||
// mIsCarLocked = isLock;
|
||||
// Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
// MogoMapListenerHandler.getInstance().onLockMap( isLock );
|
||||
// Trace.endSection();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviViewLoaded() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMapTypeChanged( int type ) {
|
||||
// if ( type == 4 ) {
|
||||
// MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_Light );
|
||||
// } else if ( type == 3 ) {
|
||||
// MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_Night );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviViewShowMode( int i ) {
|
||||
//
|
||||
// long delay = mMapView.getViewOptions().getLockMapDelayed();
|
||||
// switch ( i ) {
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_DEFAULT:
|
||||
// Logger.d( TAG, "普通模式" );
|
||||
// break;
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_DISPLAY_OVERVIEW:
|
||||
// Logger.d( TAG, "全览模式" );
|
||||
// break;
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_LOCK_CAR:
|
||||
// Logger.d( TAG, "锁车模式: %s", delay );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setTrafficEnabled( boolean visible ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setTrafficLine( visible );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapControlResult changeZoom( boolean zoom ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// mDefaultZoomLevel = ( int ) ( getMap().getZoomLevel() + 0.5f );
|
||||
//
|
||||
// if ( zoom ) {
|
||||
// if ( mDefaultZoomLevel >= 20 ) {
|
||||
// return MapControlResult.TARGET;
|
||||
// }
|
||||
// } else {
|
||||
// if ( mDefaultZoomLevel <= 3 ) {
|
||||
// return MapControlResult.TARGET;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if ( zoom ) {
|
||||
// mDefaultZoomLevel += 2f;
|
||||
// if ( mDefaultZoomLevel > 20 ) {
|
||||
// mDefaultZoomLevel = 20;
|
||||
// }
|
||||
// } else {
|
||||
// mDefaultZoomLevel -= 2f;
|
||||
// if ( mDefaultZoomLevel < 1 ) {
|
||||
// mDefaultZoomLevel = 1;
|
||||
// }
|
||||
// }
|
||||
// changeZoom( ( int ) mDefaultZoomLevel );
|
||||
// }
|
||||
// return MapControlResult.SUCCESS;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapControlResult changeZoom( float zoom ) {
|
||||
// Logger.d( TAG, "changeZoom %s", zoom );
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// getMap().changeZoom( zoom );
|
||||
// return MapControlResult.SUCCESS;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeMapMode( EnumMapUI ui ) {
|
||||
// if ( ui == null ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( checkAMapView() ) {
|
||||
// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
// if ( options == null ) {
|
||||
// options = new AMapNaviViewOptions();
|
||||
// }
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// case NorthUP_2D:
|
||||
// setUIMode( ui, options );
|
||||
// return;
|
||||
// case Type_Light:
|
||||
// options.setNaviNight( false );
|
||||
// break;
|
||||
// case Type_Night:
|
||||
// options.setNaviNight( true );
|
||||
// break;
|
||||
// case Type_AUTO_LIGHT_Night:
|
||||
// options.setNaviNight( false );
|
||||
// options.setAutoNaviViewNightMode( true );
|
||||
// break;
|
||||
// }
|
||||
// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void setUIMode( EnumMapUI ui, AMapNaviViewOptions options ) {
|
||||
// this.mCurrentUIMode = ui;
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// mMapView.setNaviMode( AMapNaviView.CAR_UP_MODE );
|
||||
// break;
|
||||
// case NorthUP_2D:
|
||||
// mMapView.setNaviMode( AMapNaviView.NORTH_UP_MODE );
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// Logger.d( TAG, "mCurrentUIMode--->" + mCurrentUIMode.name() );
|
||||
// if ( options == null ) {
|
||||
// return;
|
||||
// }
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case NorthUP_2D:
|
||||
// options.setTilt( 0 );
|
||||
// break;
|
||||
// case CarUp_3D:
|
||||
// options.setTilt( 60 );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private boolean checkAMapView() {
|
||||
// if ( mMapView == null ) {
|
||||
// Logger.e( TAG, "自研mapView实例为空,请检查" );
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void moveToCenter( MogoLatLng latLng, boolean animate ) {
|
||||
// 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" );
|
||||
// return;
|
||||
// }
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// loseLockMode();
|
||||
// if ( animate ) {
|
||||
// mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
// } else {
|
||||
// mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showMyLocation( boolean visible ) {
|
||||
// Logger.d( TAG, "showMyLocation1 %s", visible );
|
||||
// if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// if ( checkAMapView() ) {
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// style.showMyLocation( visible );
|
||||
// if ( visible ) {
|
||||
// // 强制刷新一遍车标
|
||||
// style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
// }
|
||||
// mMapView.getMap().setMyLocationStyle( style );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showMyLocation( View view ) {
|
||||
// if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// return;
|
||||
// }
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// if ( checkAMapView() ) {
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// style.showMyLocation( true );
|
||||
// style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
|
||||
// mMapView.getMap().setMyLocationStyle( style );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void initMyLocation() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.getMap().setMyLocationEnabled( true );
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
// style.interval( 1000 );
|
||||
// style.anchor( 0.5F, 0.5F );
|
||||
// style.strokeColor( Color.TRANSPARENT );
|
||||
// style.strokeWidth( 0 );
|
||||
// style.radiusFillColor( Color.TRANSPARENT );
|
||||
// mMapView.getMap().setMyLocationStyle( style );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void recoverLockMode() {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "锁车" );
|
||||
// mMapView.recoverLockMode();
|
||||
// mIsCarLocked = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loseLockMode() {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "解锁锁车" );
|
||||
// mockTouchEvent();
|
||||
// mIsCarLocked = false;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 模拟点击事件,达到锁车->普通事件
|
||||
// */
|
||||
// private void mockTouchEvent() {
|
||||
// long downTime = SystemClock.uptimeMillis();
|
||||
// long eventTime = downTime + 1;
|
||||
// int metaState = 0;
|
||||
// MotionEvent motionEvent = MotionEvent.obtain( downTime, eventTime, MotionEvent.ACTION_DOWN, 0, 0, metaState );
|
||||
// mMapView.dispatchTouchEvent( motionEvent );
|
||||
// MotionEvent upEvent = MotionEvent.obtain( downTime + 1, eventTime + 2, MotionEvent.ACTION_UP, 0, 0, metaState );
|
||||
// mMapView.dispatchTouchEvent( upEvent );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setLockZoom( int var1 ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 );
|
||||
// mMapView.setLockZoom( var1 );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void displayOverview( Rect bounds ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
// loseLockMode();
|
||||
// NaviClient.getInstance( getContext() ).displayOverview( bounds );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getScalePerPixel() {
|
||||
// return getMap().getScalePerPixel();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float getZoomLevel() {
|
||||
// return getMap().getZoomLevel();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviStarted() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setCarOverlayVisible( true );
|
||||
// showMyLocation( false );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviStopped() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
// showMyLocation( true );
|
||||
// NaviClient.getInstance( getContext() ).startAimlessMode();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviInfoUpdat( NaviInfo naviInfo ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCalculateSuccess() {
|
||||
// loseLockMode();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCameraChange( CameraPosition cameraPosition ) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onCameraChangeFinish( CameraPosition cameraPosition ) {
|
||||
// if ( cameraPosition != null ) {
|
||||
// Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
// MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.target ),
|
||||
// cameraPosition.zoom,
|
||||
// cameraPosition.tilt,
|
||||
// cameraPosition.bearing );
|
||||
// Trace.endSection();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getCameraNorthEastPosition() {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.northeast );
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getCameraSouthWestPosition() {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.southwest );
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getWindowCenterLocation() {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap( mMapView.getMap().getCameraPosition().target );
|
||||
// } catch ( Exception e ) {
|
||||
//
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setPointToCenter( double mapCenterX, double mapCenterY ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
//// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
//// options.setPointToCenter( mapCenterX, mapCenterY );
|
||||
//// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Point getLocationPointInScreen( MogoLatLng latLng ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// try {
|
||||
// return MapTools.INSTANCE.toScreenLocation( ObjectUtils.fromMogo( latLng ) );
|
||||
// } catch ( Exception e ) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap(
|
||||
// MapTools.INSTANCE.fromScreenLocation( point ) );
|
||||
// } catch ( Exception e ) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
|
||||
// long duration ) {
|
||||
// if ( marker == null || high <= 0.0f || interpolator == null || duration < 0 ) {
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
//// final LatLng latLng = ObjectUtils.fromMogo2( marker.getPosition() );
|
||||
//// Point point = mMapView.getMap().getProjection().toScreenLocation( latLng );
|
||||
//// point.y -= WindowUtils.dip2px( getContext(), high );
|
||||
//// LatLng target = mMapView.getMap().getProjection().fromScreenLocation( point );
|
||||
//// //使用TranslateAnimation,填写一个需要移动的目标点
|
||||
//// Animation animation = new TranslateAnimation( target );
|
||||
//// animation.setInterpolator( interpolator );
|
||||
//// //整个移动所需要的时间
|
||||
//// animation.setDuration( duration );
|
||||
//// //设置动画
|
||||
//// if ( marker instanceof AMapMarkerWrapper ) {
|
||||
//// ( ( AMapMarkerWrapper ) marker ).getMarker().setAnimation( animation );
|
||||
//// ( ( AMapMarkerWrapper ) marker ).getMarker().startAnimation();
|
||||
//// }
|
||||
// } catch ( Exception e ) {
|
||||
// Logger.e( TAG, e, "error." );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setRenderFps( int fps ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( mMapView.getMapAutoViewHelper() != null ) {
|
||||
//// mMapView.getMapAutoViewHelper().setRenderFps( fps );
|
||||
// Logger.d( TAG, "设置刷新帧率 fps = %s", fps );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
|
||||
// if ( !checkAMapView() ) {
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
//// if ( DebugConfig.isDebug() ) {
|
||||
//// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
//// }
|
||||
//// LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition );
|
||||
//// if ( !lockCarPosition ) {
|
||||
//// loseLockMode();
|
||||
//// }
|
||||
//// mMapView.getMapAutoViewHelper().moveCamera( new CameraUpdate(new MapCameraMessage( latLngBounds, bound.left, bound.right, bound.top, bound.bottom ) ));
|
||||
// } catch ( Exception e ) {
|
||||
// Logger.e( TAG, e, "%s error.", tag );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void forceRender() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.getMapAutoViewHelper().runOnDrawFrame();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
|
||||
// if ( p1 == null || p2 == null ) {
|
||||
// throw new Exception( "计算距离的点不能为 null" );
|
||||
// }
|
||||
// return AMapUtils.calculateLineDistance( ObjectUtils.fromMogo2( p1 ), ObjectUtils.fromMogo2( p2 ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMyLocationChange( Location location ) {
|
||||
// NaviClient.getInstance( getContext() ).syncCarLocation( location );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EnumMapUI getCurrentUiMode() {
|
||||
// return mCurrentUIMode;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeMyLocation( Location location ) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public synchronized boolean isCarLocked() {
|
||||
// return mIsCarLocked;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setCarCursorOption( CarCursorOption option ) {
|
||||
// if ( mCarCursorOption != null && mCarCursorOption != DEFAULT_OPTION ) {
|
||||
// mCarCursorOption.destroy();
|
||||
// }
|
||||
// if ( option != null ) {
|
||||
// try {
|
||||
// mCarCursorOption = option.clone();
|
||||
// } catch ( Exception e ) {
|
||||
// mCarCursorOption = DEFAULT_OPTION;
|
||||
// }
|
||||
// } else {
|
||||
// mCarCursorOption = DEFAULT_OPTION;
|
||||
// }
|
||||
// if ( !checkAMapView() ) {
|
||||
// return;
|
||||
// }
|
||||
//// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
//// if ( options != null && mCarCursorOption.getNaviCursorRes() != 0 ) {
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), mCarCursorOption.getNaviCursorRes() ) );
|
||||
//// } else {
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
//// }
|
||||
//// mMapView.setViewOptions( options );
|
||||
//
|
||||
// if ( mMapView.getMapAutoViewHelper() == null ) {
|
||||
// return;
|
||||
// }
|
||||
// MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
// if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
|
||||
//// style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
|
||||
// } else {
|
||||
// if ( mCarCursorOption.getCarCursorRes() != 0 ) {
|
||||
// style.myLocationIcon( mCarCursorOption.getCarCursorRes());
|
||||
// } else {
|
||||
// style.myLocationIcon( mCarCursorOption.getCarCursorRes());
|
||||
// }
|
||||
// }
|
||||
// mMapView.getMapAutoViewHelper().setMyLocationStyle( style );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapCameraPosition getMapCameraPosition() {
|
||||
// if ( checkAMapView() ) {
|
||||
//// CameraPosition cameraPosition = mMapView.getMap().getCameraPosition();
|
||||
//// return ObjectUtils.fromAMap( cameraPosition );
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeBearing( float bearing ) {
|
||||
// if ( checkAMapView() ) {
|
||||
//// mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.Location location) {
|
||||
// Location sysLocation = new Location(location.getProvider());
|
||||
// sysLocation.setAltitude(location.getAltitude());
|
||||
// sysLocation.setLatitude(location.getLat());
|
||||
// sysLocation.setLongitude(location.getLon());
|
||||
// sysLocation.setSpeed(location.getSpeed());
|
||||
// NaviClient.getInstance( getContext() ).syncCarLocation(sysLocation);
|
||||
// }
|
||||
//}
|
||||
@@ -480,4 +480,9 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
public void startScaleAnimationWithAlpha( float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoWindowShowing() {
|
||||
return mMarker.isInfoWindowShown();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user