合并分支
This commit is contained in:
@@ -104,8 +104,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
if ( mIsVrMode ) {
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
marker.use3DResource( getVrModel() );
|
||||
} else {
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
marker.setIcon( ViewUtils.fromView( inflateView( recognizedListResult, machineVision, 0 ) ) );
|
||||
}
|
||||
}
|
||||
@@ -200,8 +202,10 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
.position( new MogoLatLng( recognizedListResult.latLonList.get( 0 ).lat, recognizedListResult.latLonList.get( 0 ).lon ) );
|
||||
|
||||
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.icon3DRes( getVrModel() );
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
options.icon( inflateView( recognizedListResult, machineVision, curSpeed ) );
|
||||
}
|
||||
|
||||
@@ -209,7 +213,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
|
||||
private int getVrModel() {
|
||||
return R.raw.taxi;
|
||||
return R.raw.carred;
|
||||
}
|
||||
|
||||
private View inflateView( ADASRecognizedListResult data, boolean machineVision, double curSpeed ) {
|
||||
@@ -225,7 +229,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
// safeType
|
||||
// ) );
|
||||
|
||||
iv.setImageResource( R.drawable.icon_map_marker_car_type_taxi );
|
||||
iv.setImageResource( R.drawable.icon_map_marker_car_gray );
|
||||
return rootView;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,8 +71,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
// 云端 marker 缓存
|
||||
private Map< String, IMogoMarker > mCloudSnapshotMarkersCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private int mPurseCounter = 0;
|
||||
|
||||
private Map< String, MogoLatLng > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
@@ -95,17 +93,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
filterData( data.getAllList() );
|
||||
List< CloudRoadData > allDatumsList = new ArrayList<>();
|
||||
allDatumsList.addAll( data.getAllList() );
|
||||
// allDatumsList.addAll( data.getNearList() );
|
||||
// if ( machineVision ) {
|
||||
// allDatumsList.addAll( data.getAllList() );
|
||||
// allDatumsList.addAll( data.getNearList() );
|
||||
// } else {
|
||||
// allDatumsList.addAll( data.getAllList() );
|
||||
// }
|
||||
mPurseCounter++;
|
||||
if ( mPurseCounter >= 100 ) {
|
||||
mPurseCounter = 0;
|
||||
}
|
||||
purgeCloudSnapshotData( allDatumsList );
|
||||
for ( CloudRoadData cloudRoadData : allDatumsList ) {
|
||||
if ( cloudRoadData == null ) {
|
||||
@@ -119,7 +106,6 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IMogoMarker marker = null;
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
if ( TextUtils.isEmpty( uniqueKey ) ) {
|
||||
@@ -142,6 +128,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
if ( mIsVrMode != MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode();
|
||||
if ( mIsVrMode ) {
|
||||
marker.getMogoMarkerOptions().set3DMode( true );
|
||||
marker.use3DResource( getVrModel( cloudRoadData ) );
|
||||
} else {
|
||||
marker.getMogoMarkerOptions().set3DMode( false );
|
||||
@@ -159,7 +146,7 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
List< MogoLatLng > points = new ArrayList<>();
|
||||
points.add( new MogoLatLng( lastPosition.lat, lastPosition.lon ) );
|
||||
points.add( new MogoLatLng( target.lat, target.lon ) );
|
||||
marker.startSmoothInMs( points, SystemClock.elapsedRealtime() - mLastReceiveTime );
|
||||
marker.startSmoothInMs( points, 1000 );
|
||||
}
|
||||
} else {
|
||||
marker.setRotateAngle( 360 - ( float ) cloudRoadData.getHeading() );
|
||||
@@ -257,8 +244,10 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
// .position( new MogoLatLng( coor[POS_LAT], coor[POS_LON] ) );
|
||||
.position( new MogoLatLng( data.getLat(), data.getLon() ) );
|
||||
if ( mIsVrMode = MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.icon3DRes( getVrModel( data ) );
|
||||
} else {
|
||||
options.set3DMode( false );
|
||||
options.icon( inflateView( data, machineVision, curSpeed ) );
|
||||
}
|
||||
return MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( DataTypes.TYPE_MARKER_CLOUD_DATA, options );
|
||||
@@ -267,9 +256,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
private int getVrModel( CloudRoadData data ) {
|
||||
switch ( data.getFromType() ) {
|
||||
case CloudRoadData.FROM_ADAS:
|
||||
return R.raw.taxi;
|
||||
// return R.raw.taxi;
|
||||
case CloudRoadData.FROM_ROAD_UNIT:
|
||||
return R.raw.bus;
|
||||
// return R.raw.bus;
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
default:
|
||||
return R.raw.carred;
|
||||
@@ -296,9 +285,9 @@ class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClickListen
|
||||
private int get2DModel( CloudRoadData data ) {
|
||||
switch ( data.getFromType() ) {
|
||||
case CloudRoadData.FROM_ADAS:
|
||||
return R.drawable.icon_map_marker_car_type_taxi;
|
||||
// return R.drawable.icon_map_marker_car_type_taxi;
|
||||
case CloudRoadData.FROM_ROAD_UNIT:
|
||||
return R.drawable.icon_map_marker_car_type_bus;
|
||||
// return R.drawable.icon_map_marker_car_type_bus;
|
||||
case CloudRoadData.FROM_MY_LOCATION:
|
||||
default:
|
||||
return R.drawable.icon_map_marker_car_gray;
|
||||
|
||||
@@ -90,7 +90,9 @@ public abstract class MapMarkerBaseView extends LinearLayout implements IMarkerV
|
||||
}
|
||||
|
||||
private void loadPoiTypeIconInUiThread(String url,int res) {
|
||||
|
||||
if (mMarker != null) {
|
||||
mMarker.setIcon( ViewUtils.fromView(MapMarkerBaseView.this));
|
||||
}
|
||||
if (!url.isEmpty()) {
|
||||
ivIcon.setPlaceHolder(res);
|
||||
ivIcon.setFailureHolder(res);
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.mogo.module.common.hook;
|
||||
|
||||
|
||||
import android.util.Pair;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 替换管理
|
||||
* Created by donghongyu on 12/29/20 1:34 PM
|
||||
*/
|
||||
public final class HookManager {
|
||||
|
||||
private HookManager() {
|
||||
}
|
||||
|
||||
public static HookManager get() {
|
||||
return InstanceHolder.sInstance;
|
||||
}
|
||||
|
||||
private static class InstanceHolder {
|
||||
private static HookManager sInstance = new HookManager();
|
||||
}
|
||||
|
||||
private Map<Pair<String, String>, MethodHook> methodHookMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 替换方法
|
||||
*
|
||||
* @param originMethod 原始方法
|
||||
* @param hookMethod 替换方法
|
||||
*/
|
||||
public void hookMethod(Method originMethod, Method hookMethod) {
|
||||
if (originMethod == null || hookMethod == null) {
|
||||
throw new IllegalArgumentException("argument cannot be null");
|
||||
}
|
||||
|
||||
Pair<String, String> key = Pair.create(hookMethod.getDeclaringClass().getName(), hookMethod.getName());
|
||||
if (methodHookMap.containsKey(key)) {
|
||||
MethodHook methodHook = methodHookMap.get(key);
|
||||
methodHook.restore();
|
||||
}
|
||||
MethodHook methodHook = new MethodHook(originMethod, hookMethod);
|
||||
methodHookMap.put(key, methodHook);
|
||||
methodHook.hook();
|
||||
}
|
||||
|
||||
public void callOrigin(Object receiver, Object... args) {
|
||||
StackTraceElement stackTrace = Thread.currentThread().getStackTrace()[3];
|
||||
String className = stackTrace.getClassName();
|
||||
String methodName = stackTrace.getMethodName();
|
||||
MethodHook methodHook = methodHookMap.get(Pair.create(className, methodName));
|
||||
if (methodHook != null) {
|
||||
try {
|
||||
methodHook.callOrigin(receiver, args);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
package com.mogo.module.common.hook;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* 替换类与c++代码对应
|
||||
* Created by donghongyu on 12/29/20 1:34 PM
|
||||
*/
|
||||
public class MethodHook {
|
||||
|
||||
public static void m1() {
|
||||
}
|
||||
|
||||
public static void m2() {
|
||||
}
|
||||
|
||||
// 目标方法
|
||||
private Method srcMethod;
|
||||
// 要替换的方法
|
||||
private Method hookMethod;
|
||||
|
||||
// 备份目标替换方法ID
|
||||
private long backupMethodPtr;
|
||||
|
||||
/**
|
||||
* hook方法
|
||||
*
|
||||
* @param src 要替换的方法对象
|
||||
* @param dest 被替换的方法对象
|
||||
*/
|
||||
public MethodHook(Method src, Method dest) {
|
||||
srcMethod = src;
|
||||
hookMethod = dest;
|
||||
srcMethod.setAccessible(true);
|
||||
hookMethod.setAccessible(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 native 层,完成替换
|
||||
*/
|
||||
public void hook() {
|
||||
if (backupMethodPtr == 0) {
|
||||
backupMethodPtr = hook_native(srcMethod, hookMethod);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 native 层,完成方法还原
|
||||
*/
|
||||
public void restore() {
|
||||
if (backupMethodPtr != 0) {
|
||||
restore_native(srcMethod, backupMethodPtr);
|
||||
backupMethodPtr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用原来class 对象中的方法
|
||||
*
|
||||
* @param receiver 接受对象
|
||||
* @param args 方法列表
|
||||
* @throws InvocationTargetException
|
||||
* @throws IllegalAccessException
|
||||
*/
|
||||
public void callOrigin(Object receiver, Object... args)
|
||||
throws InvocationTargetException, IllegalAccessException {
|
||||
if (backupMethodPtr != 0) {
|
||||
restore();
|
||||
srcMethod.invoke(receiver, args);
|
||||
hook();
|
||||
} else {
|
||||
srcMethod.invoke(receiver, args);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 native 方法完成 方法替换
|
||||
*
|
||||
* @param src 旧方法
|
||||
* @param dest 新方法
|
||||
* @return 就方法ID
|
||||
*/
|
||||
private static native long hook_native(Method src, Method dest);
|
||||
|
||||
/**
|
||||
* 调用 native 方法完成 方法还原
|
||||
*
|
||||
* @param src
|
||||
* @param methodPtr
|
||||
* @return
|
||||
*/
|
||||
private static native Method restore_native(Method src, long methodPtr);
|
||||
|
||||
static {
|
||||
// 加载本地方法 so
|
||||
System.loadLibrary("method-hook-lib");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -274,7 +274,6 @@ public class MapCenterPointStrategy {
|
||||
Logger.w( TAG, "vr 模式下忽略该设置" );
|
||||
return;
|
||||
}
|
||||
Logger.e( TAG, "scene"+scene );
|
||||
Map< Integer, Map< String, MapCenterPoint > > strategies = sCommonStrategies;
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
strategies = sVrStrategies;
|
||||
|
||||
Reference in New Issue
Block a user