优化显示逻辑
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -39,6 +41,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
private Handler pointSettingHandler = null;
|
||||
public static final int MSG_POINTS_SETTING = 9;
|
||||
public static final int MSG_SET_POINT = 10;
|
||||
public static final int MSG_SET_SPEED = 11;
|
||||
|
||||
private AdasRecognizedResultDrawer() {
|
||||
super();
|
||||
@@ -59,6 +62,14 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if ( msg.obj instanceof PointData ) {
|
||||
moveMarker( ( ( PointData ) msg.obj ) );
|
||||
}
|
||||
} else if( msg.what == MSG_SET_SPEED ){
|
||||
if ( msg.obj instanceof SpeedData ) {
|
||||
try {
|
||||
( ( SpeedData ) msg.obj ).showSpeed();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -79,6 +90,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
}
|
||||
}
|
||||
|
||||
private String markerRes;
|
||||
|
||||
/**
|
||||
* 设置 marker 的点到新的位置
|
||||
*
|
||||
@@ -88,7 +101,25 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
if ( pointData == null ) {
|
||||
return;
|
||||
}
|
||||
pointData.move();
|
||||
try {
|
||||
pointData.move();
|
||||
// MogoMarkerOptions options = new MogoMarkerOptions();
|
||||
// options.gps( true )
|
||||
// .position( pointData.point)
|
||||
// .anchor( 0.5f, 0.5f )
|
||||
// .rotate( pointData.angle);
|
||||
// if ( TextUtils.isEmpty( markerRes ) ) {
|
||||
// options.icon( BitmapFactory.decodeResource( mContext.getResources(), R.drawable.blue ) );
|
||||
// }else {
|
||||
// options.resName( markerRes );
|
||||
// }
|
||||
// IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager( mContext ).addMarker( TAG, options );
|
||||
// if ( TextUtils.isEmpty( markerRes ) ) {
|
||||
// markerRes = marker.getMarkerResName();
|
||||
// }
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private final Map< String, ADASRecognizedResult > mLastPositions = new ConcurrentHashMap<>();
|
||||
@@ -221,11 +252,14 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
}
|
||||
showSelfSpeed( mContext,
|
||||
marker,
|
||||
recognizedListResult.speed,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()
|
||||
);
|
||||
Message msg = new Message();
|
||||
SpeedData obj = new SpeedData();
|
||||
obj.context = mContext;
|
||||
obj.marker = marker;
|
||||
obj.speed = recognizedListResult.speed;
|
||||
msg.obj = obj;
|
||||
msg.what = MSG_SET_SPEED;
|
||||
pointSettingHandler.sendMessage( msg );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -276,4 +276,22 @@ class BaseDrawer {
|
||||
public static class SettingData {
|
||||
public List< PointData > points;
|
||||
}
|
||||
|
||||
public class SpeedData {
|
||||
|
||||
public IMogoMarker marker;
|
||||
public Context context;
|
||||
double speed;
|
||||
|
||||
public void showSpeed() {
|
||||
try {
|
||||
showSelfSpeed( context,
|
||||
marker,
|
||||
speed,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user