@@ -24,13 +24,11 @@ import android.graphics.Rect;
import android.os.Bundle ;
import android.os.Looper ;
import android.text.TextUtils ;
import android.util.Log ;
import android.view.MotionEvent ;
import android.view.View ;
import androidx.annotation.NonNull ;
import com.mogo.commons.debug.DebugConfig ;
import com.mogo.eagle.core.data.config.HdMapBuildConfig ;
import com.mogo.eagle.core.data.enums.TrafficTypeEnum ;
import com.mogo.eagle.core.data.map.CenterLine ;
@@ -44,7 +42,6 @@ import com.mogo.eagle.core.function.call.map.CallerMapRoadListenerManager;
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener ;
import com.mogo.eagle.core.function.call.map.CallerMapStyleListenerManager ;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger ;
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast ;
import com.mogo.eagle.core.utilcode.util.ThreadUtils ;
import com.mogo.eagle.core.utilcode.util.UiThreadHandler ;
import com.mogo.map.hdcache.IHdCacheListener ;
@@ -127,7 +124,7 @@ public class AMapViewWrapper implements IMogoMapView,
private IHdCacheListener hdCacheListener ;
public AMapViewWrapper ( MapAutoView mMapView ) {
CallerLogger . INSTANCE . i( M_MAP + TAG , " autoop--AMapViewWrapper: init " ) ;
CallerLogger . i ( M_MAP + TAG , " autoop--AMapViewWrapper: init " ) ;
this . mMapView = mMapView ;
initViews ( ) ;
initListeners ( ) ;
@@ -137,7 +134,7 @@ public class AMapViewWrapper implements IMogoMapView,
private void initViews ( ) {
// 初始化首次地图进入的时候的样式, MapAutoApi.INSTANCE.init(context, mapParams);将影响这里的数据
int mapStyle = MapAutoApi . INSTANCE . getMapParams ( ) . getStyleMode ( ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " 默认配置地图模式: mapStyle= " + mapStyle ) ;
CallerLogger . d ( M_MAP + TAG , " 默认配置地图模式: mapStyle= " + mapStyle ) ;
switch ( mapStyle ) {
case MapAutoApi . MAP_STYLE_DAY :
mCurrentUI = EnumMapUI . MAP_STYLE_DAY ;
@@ -158,7 +155,7 @@ public class AMapViewWrapper implements IMogoMapView,
mCurrentUI = EnumMapUI . MAP_STYLE_NIGHT_VR ;
break ;
default :
CallerLogger . INSTANCE . e( M_MAP + TAG , " 暂不支持此地图模式, 默认使用VR夜间模式 " ) ;
CallerLogger . e ( M_MAP + TAG , " 暂不支持此地图模式, 默认使用VR夜间模式 " ) ;
}
}
@@ -198,7 +195,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView . setOnMapViewVisualAngleChangeListener ( this ) ;
mMapView . setOnRoadInfoListener ( this , 1 ) ;
MapAutoApi . INSTANCE . registerLogListener ( this ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " styleop - initListeners - setOnMapStyleListener - view " + mMapView ) ;
CallerLogger . d ( M_MAP + TAG , " styleop - initListeners - setOnMapStyleListener - view " + mMapView ) ;
}
/**
@@ -210,10 +207,10 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onRoadIdInfo ( @androidx.annotation.Nullable String roadId , @androidx.annotation.Nullable String s1 ) {
if ( roadId ! = null & & ! TextUtils . isEmpty ( roadId ) ) {
// CallerLogger.INSTANCE. d(M_MAP + TAG, "onRoadIdInfo::" + roadId);
// CallerLogger.d(M_MAP + TAG, "onRoadIdInfo::" + roadId);
CallerMapRoadListenerManager . INSTANCE . invokeListenersOnRoadIdGet ( roadId ) ;
} else {
//CallerLogger.INSTANCE. d(M_MAP + TAG, "onRoadIdInfo::null");
//CallerLogger.d(M_MAP + TAG, "onRoadIdInfo::null");
}
}
@@ -228,18 +225,18 @@ public class AMapViewWrapper implements IMogoMapView,
if ( stopLine ! = null & & stopLine . road_id ! = null & & ! stopLine . road_id . isEmpty ( ) & & stopLine . points ! = null & & stopLine . points . size ( ) > 0 ) {
ArrayList < LonLatPoint > points = stopLine . points ;
if ( carLoc ! = null ) {
// //CallerLogger.INSTANCE. d(M_MAP + TAG, "onStopLineInfo:stop_line" + stopLine + ", car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
// //CallerLogger.d(M_MAP + TAG, "onStopLineInfo:stop_line" + stopLine + ", car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
MapRoadInfo . StopLine stopInfo = convert ( stopLine ) ;
LonLatPoint p1 = points . get ( 0 ) ;
LonLatPoint p2 = points . get ( points . size ( ) - 1 ) ;
double distanceOfCarToStopLine = MapDataApi . INSTANCE . getNearstFromPointToSegment ( carLoc . getLongitude ( ) , carLoc . getLatitude ( ) , p1 . longitude , p1 . latitude , p2 . longitude , p2 . latitude ) * 10_0000 ;
stopInfo . setDistanceOfCarToStopLine ( distanceOfCarToStopLine ) ;
//CallerLogger.INSTANCE. d(M_MAP + TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
//CallerLogger.d(M_MAP + TAG, "onStopLineInfo: --- distance: " + distanceOfCarToStopLine);
CallerMapRoadListenerManager . INSTANCE . invokeListenersOnStopLineGet ( stopInfo ) ;
}
} else {
if ( carLoc ! = null ) {
//CallerLogger.INSTANCE. d(M_MAP + TAG, "onStopLineInfo::null, car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
//CallerLogger.d(M_MAP + TAG, "onStopLineInfo::null, car_loc:{lon: " + carLoc.getLatitude() + ", lat: " + carLoc.getLongitude() + "}");
}
}
}
@@ -287,7 +284,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onCreate ( Bundle bundle ) {
if ( mMapView ! = null ) {
mMapView . onCreate ( bundle ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " map onCreate " ) ;
CallerLogger . d ( M_MAP + TAG , " map onCreate " ) ;
}
}
@@ -295,7 +292,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onResume ( ) {
if ( mMapView ! = null ) {
mMapView . onResume ( ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " map onResume " ) ;
CallerLogger . d ( M_MAP + TAG , " map onResume " ) ;
}
}
@@ -303,7 +300,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onPause ( ) {
if ( mMapView ! = null ) {
mMapView . onPause ( ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " map onPause " ) ;
CallerLogger . d ( M_MAP + TAG , " map onPause " ) ;
}
}
@@ -317,7 +314,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView . setOnMapClickListener ( null ) ;
mMapView . setOnCameraChangeListener ( null ) ;
MapAutoApi . INSTANCE . unregisterLogListener ( this ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " map onDestroy " ) ;
CallerLogger . d ( M_MAP + TAG , " map onDestroy " ) ;
}
}
@@ -326,7 +323,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void onSaveInstanceState ( Bundle outState ) {
if ( mMapView ! = null ) {
mMapView . onSaveInstanceState ( outState ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " map onSaveInstanceState " ) ;
CallerLogger . d ( M_MAP + TAG , " map onSaveInstanceState " ) ;
}
}
@@ -340,7 +337,7 @@ public class AMapViewWrapper implements IMogoMapView,
if ( isVrMold ( ) ) {
return MapControlResult . ERROR ;
}
CallerLogger . INSTANCE . d( M_MAP + TAG , " changeZoom : " + zoom ) ;
CallerLogger . d ( M_MAP + TAG , " changeZoom : " + zoom ) ;
getMap ( ) . changeZoom ( zoom ) ;
return MapControlResult . SUCCESS ;
}
@@ -350,7 +347,7 @@ public class AMapViewWrapper implements IMogoMapView,
// if (isVrMold()) {
// return;
// }
CallerLogger . INSTANCE . d( M_MAP + TAG , " changeZoom2 : " + zoom ) ;
CallerLogger . d ( M_MAP + TAG , " changeZoom2 : " + zoom ) ;
getMap ( ) . changeZoom2 ( zoom ) ;
}
@@ -366,7 +363,7 @@ public class AMapViewWrapper implements IMogoMapView,
mVisualAngleMode = angelMode ;
if ( angelMode = = MODE_CLOSE_SIGHT ) {
if ( mogoLatLng = = null ) {
CallerLogger . INSTANCE . e( M_MAP + TAG , " 切换地图近景需要传入要移动的经纬度数据 " ) ;
CallerLogger . e ( M_MAP + TAG , " 切换地图近景需要传入要移动的经纬度数据 " ) ;
return ;
}
// 近景传入经纬度为点击地图上静态marker经纬度数据, 为GPS坐标点。
@@ -417,7 +414,7 @@ public class AMapViewWrapper implements IMogoMapView,
private boolean checkAMapView ( ) {
if ( mMapView = = null | | mMapView . getMapAutoViewHelper ( ) = = null ) {
CallerLogger . INSTANCE . e( M_MAP + TAG , " 自研mapView实例为空, 请检查 " ) ;
CallerLogger . e ( M_MAP + TAG , " 自研mapView实例为空, 请检查 " ) ;
return false ;
}
return true ;
@@ -425,9 +422,9 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void moveToCenter ( MogoLatLng latLng , boolean animate ) {
CallerLogger . INSTANCE . d( M_MAP + TAG , " move to center " + latLng ) ;
CallerLogger . d ( M_MAP + TAG , " move to center " + latLng ) ;
if ( latLng = = null | | latLng . lat = = 0 . 0d | | latLng . lon = = 0 . 0d ) {
CallerLogger . INSTANCE . e( M_MAP + TAG , " latLng = null or is illegal " ) ;
CallerLogger . e ( M_MAP + TAG , " latLng = null or is illegal " ) ;
return ;
}
if ( checkAMapView ( ) ) {
@@ -437,7 +434,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void showMyLocation ( boolean visible ) {
CallerLogger . INSTANCE . d( M_MAP + TAG , " showMyLocation1 " + visible ) ;
CallerLogger . d ( M_MAP + TAG , " showMyLocation1 " + visible ) ;
// 如果是VR模式
if ( isVrMold ( ) ) {
return ;
@@ -458,7 +455,7 @@ public class AMapViewWrapper implements IMogoMapView,
*/
private boolean isVrMold ( ) {
boolean isVrMode = mCurrentUI = = EnumMapUI . MAP_STYLE_NIGHT_VR | | mCurrentUI = = EnumMapUI . MAP_STYLE_DAY_VR ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " 是否是VR模式: " + isVrMode ) ;
CallerLogger . d ( M_MAP + TAG , " 是否是VR模式: " + isVrMode ) ;
return isVrMode ;
}
@@ -540,7 +537,7 @@ public class AMapViewWrapper implements IMogoMapView,
if ( isVrMold ( ) ) {
return ;
}
CallerLogger . INSTANCE . d( M_MAP + TAG , " setPointToCenter x : " + mapCenterX + " y : " + mapCenterY ) ;
CallerLogger . d ( M_MAP + TAG , " setPointToCenter x : " + mapCenterX + " y : " + mapCenterY ) ;
mMapView . getMapAutoViewHelper ( ) . setPointToCenter ( ( float ) mapCenterX , ( float ) mapCenterY ) ;
}
}
@@ -577,7 +574,7 @@ public class AMapViewWrapper implements IMogoMapView,
if ( checkAMapView ( ) ) {
if ( mMapView . getMapAutoViewHelper ( ) ! = null ) {
mMapView . getMapAutoViewHelper ( ) . setRenderFps ( fps ) ;
CallerLogger . INSTANCE . d( M_MAP + TAG , " 设置刷新帧率 fps = " + fps ) ;
CallerLogger . d ( M_MAP + TAG , " 设置刷新帧率 fps = " + fps ) ;
}
}
}
@@ -588,16 +585,16 @@ public class AMapViewWrapper implements IMogoMapView,
return ;
}
if ( isVrMold ( ) ) {
CallerLogger . INSTANCE . w( M_MAP + TAG , " vr 模式下忽略该设置 " ) ;
CallerLogger . w ( M_MAP + TAG , " vr 模式下忽略该设置 " ) ;
return ;
}
CallerLogger . INSTANCE . i( M_MAP + TAG , " showBounds : " + M_MAP + TAG + " , " + carPosition . toString ( ) + " , " + bound . toShortString ( ) + " , " + lockCarPosition ) ;
CallerLogger . i ( M_MAP + TAG , " showBounds : " + M_MAP + TAG + " , " + carPosition . toString ( ) + " , " + bound . toShortString ( ) + " , " + lockCarPosition ) ;
try {
LatLngBounds latLngBounds = MogoMapUtils . getLatLngBounds ( carPosition , lonLats , lockCarPosition ) ;
mMapView . getMapAutoViewHelper ( ) . setCenter ( ObjectUtils . fromMogo ( carPosition ) ) ;
mMapView . getMapAutoViewHelper ( ) . moveCamera ( CameraUpdateFactory . INSTANCE . newLatLngBounds ( latLngBounds , bound . left , bound . right , bound . top , bound . bottom ) ) ;
} catch ( Exception e ) {
CallerLogger . INSTANCE . e( M_MAP + TAG , " M_MAP+TAG : " + M_MAP + TAG + " error : " + e ) ;
CallerLogger . e ( M_MAP + TAG , " M_MAP+TAG : " + M_MAP + TAG + " error : " + e ) ;
}
}
@@ -730,7 +727,7 @@ public class AMapViewWrapper implements IMogoMapView,
)
@Override
public void onMapInit ( ) {
CallerLogger . INSTANCE . i( M_MAP + TAG , " autoop--onMapInit: " ) ;
CallerLogger . i ( M_MAP + TAG , " autoop--onMapInit: " ) ;
MogoMapListenerHandler . Companion . getMogoMapListenerHandler ( ) . onMapLoaded ( ) ;
}
@@ -742,7 +739,7 @@ public class AMapViewWrapper implements IMogoMapView,
)
@Override
public void onMapLoaded ( ) {
CallerLogger . INSTANCE . i( M_MAP + TAG , " autoop--onMapLoaded: " ) ;
CallerLogger . i ( M_MAP + TAG , " autoop--onMapLoaded: " ) ;
if ( checkAMapView ( ) ) {
CameraPosition cameraPosition = mMapView . getMapAutoViewHelper ( ) . getCameraPosition ( ) ;
MogoMapListenerHandler . Companion . getMogoMapListenerHandler ( ) . onMapChanged ( ObjectUtils . fromAMap ( cameraPosition . getTarget ( ) ) ,
@@ -781,7 +778,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onMapViewVisualAngleChange ( int i ) {
CallerLogger . INSTANCE . d( M_MAP + TAG , " 地图自动更改视距 currentThread : " + Thread . currentThread ( ) . getName ( ) ) ;
CallerLogger . d ( M_MAP + TAG , " 地图自动更改视距 currentThread : " + Thread . currentThread ( ) . getName ( ) ) ;
mVisualAngleMode = getVisualAngleMode ( i ) ;
MogoMapListenerHandler . Companion . getMogoMapListenerHandler ( ) . onMapVisualAngleChanged ( mVisualAngleMode ) ;
}
@@ -829,7 +826,7 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void onChangeMapStyle ( int styleId ) {
CallerLogger . INSTANCE . d( M_MAP + TAG , " currentMapStyle = " + styleId ) ;
CallerLogger . d ( M_MAP + TAG , " currentMapStyle = " + styleId ) ;
// 映射地图样式ID到鹰眼样式ID
if ( styleId = = MapAutoApi . MAP_STYLE_DAY
| | styleId = = MapAutoApi . MAP_STYLE_DAY_NAV ) {
@@ -849,7 +846,7 @@ public class AMapViewWrapper implements IMogoMapView,
if ( mCurrentUI ! = null ) {
UiThreadHandler . post ( ( ) - > {
try {
CallerLogger . INSTANCE . d( M_MAP + TAG , " currentUI = " + mCurrentUI ) ;
CallerLogger . d ( M_MAP + TAG , " currentUI = " + mCurrentUI ) ;
MogoMapListenerHandler . Companion . getMogoMapListenerHandler ( ) . onMapModeChanged ( mCurrentUI ) ;
CallerMapStyleListenerManager . INSTANCE . invokeMapStyleChange ( styleId ) ;
} catch ( Exception e ) {
@@ -870,7 +867,7 @@ public class AMapViewWrapper implements IMogoMapView,
mMapView . getLocationClient ( ) . rtkEnable ( mRtkEnable ) ;
}
} catch ( Exception e ) {
CallerLogger . INSTANCE . e( M_MAP + TAG , " rtkEnable has exception : " + e ) ;
CallerLogger . e ( M_MAP + TAG , " rtkEnable has exception : " + e ) ;
}
}
@@ -925,7 +922,7 @@ public class AMapViewWrapper implements IMogoMapView,
* 加载3D模型
*/
private void loadPreVehicleModel ( ) {
CallerLogger . INSTANCE . d( M_MAP + TAG , " 添加感知模型到地图中…… " ) ;
CallerLogger . d ( M_MAP + TAG , " 添加感知模型到地图中…… " ) ;
ThreadUtils . getIoPool ( ) . submit ( ( ) - > {
addPreVehicleModelWeiZhi ( TrafficTypeEnum . TYPE_TRAFFIC_ID_WEI_ZHI , " 添加感知模型到地图中……preVehicleStrWeiZhi= " ) ;
@@ -964,11 +961,11 @@ public class AMapViewWrapper implements IMogoMapView,
. addPreVehicleModel ( typeTrafficId . getType ( ) , typeTrafficId . getTraffic3DNightIconId ( ) ) ;
}
CallerLogger . INSTANCE . d( M_MAP + TAG , logMsg + preVehicleStrWeiZhi ) ;
CallerLogger . d ( M_MAP + TAG , logMsg + preVehicleStrWeiZhi ) ;
if ( preVehicleStrWeiZhi = = null ) {
UiThreadHandler . postDelayed ( ( ) - > {
CallerLogger . INSTANCE . w( M_MAP + TAG , " 添加感知模型到地图中失败,尝试重复添加…… " ) ;
CallerLogger . w ( M_MAP + TAG , " 添加感知模型到地图中失败,尝试重复添加…… " ) ;
addPreVehicleModelWeiZhi ( typeTrafficId , logMsg ) ;
} , 1000L ) ;
}
@@ -977,7 +974,6 @@ public class AMapViewWrapper implements IMogoMapView,
@Override
public void setLockMode ( boolean isLock ) {
if ( checkAMapView ( ) ) {
Log . d ( " TTTTT " , " setLockMode: " + isLock ) ;
mMapView . getMapAutoViewHelper ( ) . setLockMode ( isLock ) ;
}
}
@@ -1044,7 +1040,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void cacheHDDataByCity ( IHdCacheListener listener ) {
if ( mMapView . getMapAutoViewHelper ( ) ! = null ) {
String gdCityCode = GDLocationClient . getInstance ( getContext ( ) ) . getLastCityCode ( ) ;
CallerLogger . INSTANCE . i( M_MAP + TAG , " gdCityCode is: " + gdCityCode ) ;
CallerLogger . i ( M_MAP + TAG , " gdCityCode is: " + gdCityCode ) ;
Integer id = HDMapUtils . getHDCityCode ( gdCityCode ) ;
if ( id ! = null ) {
hdCacheListener = listener ;
@@ -1087,7 +1083,7 @@ public class AMapViewWrapper implements IMogoMapView,
public void cacheHDDataByCity ( IHdCacheListener listener , MogoLocation location ) {
if ( mMapView . getMapAutoViewHelper ( ) ! = null ) {
hdCacheListener = listener ;
CallerLogger . INSTANCE . i( M_MAP + TAG , " location lon is: " + location . getLongitude ( ) + " ,lat is: " + location . getLatitude ( ) ) ;
CallerLogger . i ( M_MAP + TAG , " location lon is: " + location . getLongitude ( ) + " ,lat is: " + location . getLatitude ( ) ) ;
mMapView . getMapAutoViewHelper ( ) . cacheHDDataByCityByLonLat ( location . getLongitude ( ) , location . getLatitude ( ) , new OnHdDataDownByCityListener ( ) {
@Override
public void onMapHDDataCacheProgressByCity ( int cityId , double progress ) {
@@ -1126,7 +1122,7 @@ public class AMapViewWrapper implements IMogoMapView,
public boolean isCityDataCached ( ) {
if ( mMapView . getMapAutoViewHelper ( ) ! = null ) {
String gdCityCode = GDLocationClient . getInstance ( getContext ( ) ) . getLastCityCode ( ) ;
CallerLogger . INSTANCE . i( M_MAP + TAG , " gdCityCode is: " + gdCityCode ) ;
CallerLogger . i ( M_MAP + TAG , " gdCityCode is: " + gdCityCode ) ;
Integer id = HDMapUtils . getHDCityCode ( gdCityCode ) ;
if ( id ! = null ) {
List < CityInfo > cityInfoList = mMapView . getMapAutoViewHelper ( ) . getAllCityCode ( ) ;