Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
@@ -499,6 +499,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
info.type = type //0为图片, 1为视频
|
||||
info.fromType = fromType
|
||||
info.mainInfoId = mainInfoId
|
||||
info.infoType = 1
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
@@ -29,12 +29,12 @@ import java.util.Set;
|
||||
import static java.lang.Math.PI;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/10/30
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class BaseDrawer {
|
||||
|
||||
/**
|
||||
@@ -48,11 +48,11 @@ class BaseDrawer {
|
||||
|
||||
public void showSpeed() {
|
||||
try {
|
||||
showSelfSpeed( context,
|
||||
showSelfSpeed(context,
|
||||
marker,
|
||||
speed,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() );
|
||||
} catch ( Exception e ) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -79,12 +79,12 @@ class BaseDrawer {
|
||||
/**
|
||||
* 地图内部资源md5缓存,便于资源复用
|
||||
*/
|
||||
protected static final Map< String, String > mMarkerCachesResMd5Values = new HashMap<>();
|
||||
protected static final Map<String, String> mMarkerCachesResMd5Values = new HashMap<>();
|
||||
|
||||
/**
|
||||
* 上一帧数据的缓存
|
||||
*/
|
||||
protected Map< String, IMogoMarker > mMarkersCaches = new HashMap<>();
|
||||
protected Map<String, IMogoMarker> mMarkersCaches = new HashMap<>();
|
||||
|
||||
protected final Context mContext;
|
||||
|
||||
@@ -101,38 +101,38 @@ class BaseDrawer {
|
||||
* 处理 marker 移除的线程
|
||||
*/
|
||||
private static void initWorkThreadHandler() {
|
||||
if ( mWorkThreadHandler == null ) {
|
||||
mWorkThreadHandler = new Handler( WorkThreadHandler.newInstance( "3d-marker-work-thread" ).getLooper() ) {
|
||||
if (mWorkThreadHandler == null) {
|
||||
mWorkThreadHandler = new Handler(WorkThreadHandler.newInstance("3d-marker-work-thread").getLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == MSG_REMOVE_DIRTY_MARKERS ) {
|
||||
if ( msg.obj instanceof Map ) {
|
||||
removeDirtyMarkers( ( ( Map ) msg.obj ) );
|
||||
Set< String > key = ( ( Map ) msg.obj ).keySet();
|
||||
for ( String id : key ) {
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_REMOVE_DIRTY_MARKERS) {
|
||||
if (msg.obj instanceof Map) {
|
||||
removeDirtyMarkers(((Map) msg.obj));
|
||||
Set<String> key = ((Map) msg.obj).keySet();
|
||||
for (String id : key) {
|
||||
// 清除道路缓存
|
||||
clearRoadCacheById( id );
|
||||
clearRoadCacheById(id);
|
||||
}
|
||||
} else if ( msg.obj instanceof String ) {
|
||||
} else if (msg.obj instanceof String) {
|
||||
MogoApisHandler.getInstance().getApis()
|
||||
.getMapServiceApi()
|
||||
.getMarkerManager( AbsMogoApplication.getApp() )
|
||||
.removeMarkers( ( ( String ) msg.obj ) );
|
||||
.getMarkerManager(AbsMogoApplication.getApp())
|
||||
.removeMarkers(((String) msg.obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if ( mRenderThreadHandler == null ) {
|
||||
mRenderThreadHandler = new Handler( WorkThreadHandler.newInstance( "render-thread-" + new Random().nextLong() ).getLooper() ) {
|
||||
if (mRenderThreadHandler == null) {
|
||||
mRenderThreadHandler = new Handler(WorkThreadHandler.newInstance("render-thread-" + new Random().nextLong()).getLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == MSG_DISPLAY_SPEED ) {
|
||||
if ( msg.obj instanceof SpeedData ) {
|
||||
showSpeed( ( SpeedData ) msg.obj );
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (msg.what == MSG_DISPLAY_SPEED) {
|
||||
if (msg.obj instanceof SpeedData) {
|
||||
showSpeed((SpeedData) msg.obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -143,10 +143,10 @@ class BaseDrawer {
|
||||
/**
|
||||
* 显示速度
|
||||
*
|
||||
* @param data
|
||||
* @param data {@link SpeedData}
|
||||
*/
|
||||
private static void showSpeed( SpeedData data ) {
|
||||
if ( data == null ) {
|
||||
private static void showSpeed(SpeedData data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
data.showSpeed();
|
||||
@@ -156,13 +156,13 @@ class BaseDrawer {
|
||||
* 清除无效[为 null 或者 已被销毁]的 marker
|
||||
*/
|
||||
protected void removeUselessMarker() {
|
||||
if ( mMarkersCaches == null || mMarkersCaches.isEmpty() ) {
|
||||
if (mMarkersCaches == null || mMarkersCaches.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Iterator< IMogoMarker > iterator = mMarkersCaches.values().iterator();
|
||||
while ( iterator.hasNext() ) {
|
||||
Iterator<IMogoMarker> iterator = mMarkersCaches.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
IMogoMarker marker = iterator.next();
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
@@ -171,66 +171,60 @@ class BaseDrawer {
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param msg
|
||||
* @param data
|
||||
* @param msg 消息类型
|
||||
* @param data 数据体
|
||||
*/
|
||||
public void sendMessage( int msg, Object data ) {
|
||||
public void sendMessage(int msg, Object data) {
|
||||
Message message = Message.obtain();
|
||||
message.what = msg;
|
||||
message.obj = data;
|
||||
mWorkThreadHandler.sendMessage( message );
|
||||
mWorkThreadHandler.sendMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否是绘制内容
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return render
|
||||
*/
|
||||
public boolean isRenderType( int type ) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdCar
|
||||
public boolean isRenderType(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto
|
||||
|| recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdPerson
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否展示车速
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return showSpeed
|
||||
*/
|
||||
public boolean shouldShowSpeed( int type ) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto
|
||||
|| recognizedType == AdasRecognizedType.classIdPerson ) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
public boolean shouldShowSpeed(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
return recognizedType != AdasRecognizedType.classIdBicycle
|
||||
&& recognizedType != AdasRecognizedType.classIdMoto
|
||||
&& recognizedType != AdasRecognizedType.classIdPerson;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取3D锚点模型资源
|
||||
*
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return
|
||||
* @return modelRes
|
||||
*/
|
||||
public int getModelRes( int type ) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck ) {
|
||||
public int getModelRes(int type) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck) {
|
||||
return R.raw.othercar;
|
||||
} else if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) {
|
||||
} else if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return R.raw.bus;
|
||||
} else if ( recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto ) {
|
||||
} else if (recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto) {
|
||||
return R.raw.motorbike;
|
||||
}
|
||||
return R.raw.people;
|
||||
@@ -244,18 +238,18 @@ class BaseDrawer {
|
||||
* @param lat 纬度
|
||||
* @return 实际车辆颜色
|
||||
*/
|
||||
protected String getModelRenderColor( int type, double speed, double lon, double lat, double angle ) {
|
||||
protected String getModelRenderColor(int type, double speed, double lon, double lat, double angle) {
|
||||
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom(type);
|
||||
if (recognizedType == AdasRecognizedType.classIdTrafficBus) {
|
||||
return "#D8D8D8FF";
|
||||
}
|
||||
// 距离策略
|
||||
double coordinates[] = getCurCoordinates();
|
||||
double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100;
|
||||
if ( distance < 50 ) {
|
||||
double[] coordinates = getCurCoordinates();
|
||||
double distance = CoordinateUtils.calculateLineDistance(lon, lat, coordinates[0], coordinates[1]) * 100;
|
||||
if (distance < 50) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if ( distance < 100 && distance >= 50 ) {
|
||||
} else if (distance < 100 && distance >= 50) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
}
|
||||
|
||||
@@ -263,11 +257,11 @@ class BaseDrawer {
|
||||
// 自车速度 >= 50% 危险
|
||||
// 10% < 自车速度 < 50% 警告
|
||||
double curSpeed = getCurSpeed();
|
||||
if ( curSpeed > 0 && speed > curSpeed ) {
|
||||
double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
|
||||
if ( rate >= 50 ) {
|
||||
if (curSpeed > 0 && speed > curSpeed) {
|
||||
double rate = ((speed - curSpeed) / curSpeed) * 100;
|
||||
if (rate >= 50) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if ( rate > 10 && rate < 50 ) {
|
||||
} else if (rate > 10 && rate < 50) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
}
|
||||
}
|
||||
@@ -279,11 +273,11 @@ class BaseDrawer {
|
||||
/**
|
||||
* 返回当前自车速度
|
||||
*
|
||||
* @return
|
||||
* @return isCurSpeed
|
||||
*/
|
||||
private double getCurSpeed() {
|
||||
double speed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed();
|
||||
if ( speed <= 0 ) {
|
||||
if (speed <= 0) {
|
||||
speed = SnapshotLocationController.getInstance().getCurSpeed();
|
||||
}
|
||||
return speed;
|
||||
@@ -295,11 +289,11 @@ class BaseDrawer {
|
||||
* @return
|
||||
*/
|
||||
private double[] getCurCoordinates() {
|
||||
double coordinates[] = {
|
||||
double[] coordinates = {
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
||||
};
|
||||
if ( coordinates[0] <= 0 ) {
|
||||
if (coordinates[0] <= 0) {
|
||||
coordinates[0] = SnapshotLocationController.getInstance().getCurLon();
|
||||
coordinates[1] = SnapshotLocationController.getInstance().getCurLat();
|
||||
}
|
||||
@@ -312,13 +306,13 @@ class BaseDrawer {
|
||||
*/
|
||||
public enum Car3DModelColor {
|
||||
|
||||
Normal( "#D8D8D8FF" ),
|
||||
Warming( "#FFD53EFF" ),
|
||||
Dangerous( "#FF3C45FF" );
|
||||
Normal("#D8D8D8FF"),
|
||||
Warming("#FFD53EFF"),
|
||||
Dangerous("#FF3C45FF");
|
||||
|
||||
private String color;
|
||||
private final String color;
|
||||
|
||||
Car3DModelColor( String color ) {
|
||||
Car3DModelColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
@@ -328,59 +322,59 @@ class BaseDrawer {
|
||||
/**
|
||||
* 展示车辆速度
|
||||
*
|
||||
* @param context
|
||||
* @param mogoMarker
|
||||
* @param speed
|
||||
* @param isVrMode
|
||||
* @param context 上下文
|
||||
* @param mogoMarker {@link IMogoMarker}
|
||||
* @param speed 是否显示速度
|
||||
* @param isVrMode 是否是vrMode
|
||||
*/
|
||||
public void showSelfSpeed( Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode ) {
|
||||
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
|
||||
public void showSelfSpeed(Context context, IMogoMarker mogoMarker, double speed, boolean isVrMode) {
|
||||
if (mogoMarker == null || mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
if ( !isVrMode ) {
|
||||
if (!isVrMode) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
int speedIntVal = ( int ) ( speed * 3.6 );
|
||||
if ( speedIntVal <= 0 ) {
|
||||
int speedIntVal = (int) (speed * 3.6);
|
||||
if (speedIntVal <= 0) {
|
||||
mogoMarker.hideInfoWindow();
|
||||
return;
|
||||
}
|
||||
String speedVal = speedIntVal + "";
|
||||
String infoResName = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMarkerInfoResName( speedVal );
|
||||
mogoMarker.setInfoWindowOffset( 0, 20 );
|
||||
if ( TextUtils.isEmpty( infoResName ) ) {
|
||||
if ( mSpeedView == null ) {
|
||||
mSpeedView = new TextView( context );
|
||||
mSpeedView.setTextColor( Color.WHITE );
|
||||
mSpeedView.setTypeface( Typeface.defaultFromStyle( Typeface.BOLD ) );
|
||||
mSpeedView.setLayoutParams( new ViewGroup.LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT ) );
|
||||
String infoResName = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getMarkerInfoResName(speedVal);
|
||||
mogoMarker.setInfoWindowOffset(0, 20);
|
||||
if (TextUtils.isEmpty(infoResName)) {
|
||||
if (mSpeedView == null) {
|
||||
mSpeedView = new TextView(context);
|
||||
mSpeedView.setTextColor(Color.WHITE);
|
||||
mSpeedView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
mSpeedView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||
}
|
||||
mSpeedView.setText( speedVal );
|
||||
mogoMarker.updateInfoWindowView( mSpeedView );
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setMarkerInfoResName( speedVal, mogoMarker.getMarkerInfoResName() );
|
||||
mSpeedView.setText(speedVal);
|
||||
mogoMarker.updateInfoWindowView(mSpeedView);
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().setMarkerInfoResName(speedVal, mogoMarker.getMarkerInfoResName());
|
||||
} else {
|
||||
mogoMarker.updateInfoWindowView( infoResName );
|
||||
mogoMarker.updateInfoWindowView(infoResName);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除markers
|
||||
*
|
||||
* @param dirtyMarkers
|
||||
* @param dirtyMarkers 缓存marker数据
|
||||
*/
|
||||
protected static void removeDirtyMarkers( Map< String, IMogoMarker > dirtyMarkers ) {
|
||||
if ( dirtyMarkers == null || dirtyMarkers.isEmpty() ) {
|
||||
protected static void removeDirtyMarkers(Map<String, IMogoMarker> dirtyMarkers) {
|
||||
if (dirtyMarkers == null || dirtyMarkers.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final Collection< IMogoMarker > dirSet = dirtyMarkers.values();
|
||||
for ( IMogoMarker value : dirSet ) {
|
||||
if ( value == null || value.isDestroyed() ) {
|
||||
final Collection<IMogoMarker> dirSet = dirtyMarkers.values();
|
||||
for (IMogoMarker value : dirSet) {
|
||||
if (value == null || value.isDestroyed()) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
value.destroy();
|
||||
} catch ( Exception e ) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -393,15 +387,15 @@ class BaseDrawer {
|
||||
* @param id
|
||||
* @param marker
|
||||
*/
|
||||
protected static void cacheMarkerIconResMd5Val( String id, IMogoMarker marker ) {
|
||||
if ( marker == null || marker.isDestroyed() ) {
|
||||
protected static void cacheMarkerIconResMd5Val(String id, IMogoMarker marker) {
|
||||
if (marker == null || marker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
String md5 = marker.getMarkerResName();
|
||||
if ( TextUtils.isEmpty( md5 ) || TextUtils.isEmpty( id ) ) {
|
||||
if (TextUtils.isEmpty(md5) || TextUtils.isEmpty(id)) {
|
||||
return;
|
||||
}
|
||||
mMarkerCachesResMd5Values.put( id, md5 );
|
||||
mMarkerCachesResMd5Values.put(id, md5);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,14 +407,14 @@ class BaseDrawer {
|
||||
* @param isRtk
|
||||
* @return
|
||||
*/
|
||||
public double[] matchRoad( String id, double lon, double lat, double angle, boolean isRtk ) {
|
||||
public double[] matchRoad(String id, double lon, double lat, double angle, boolean isRtk) {
|
||||
final long start = System.currentTimeMillis();
|
||||
double[] matchRoad = MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getMapUIController()
|
||||
.matchRoad( id, lon, lat, angle, true, isRtk );
|
||||
Log.i( "timer-matchRoad", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
.matchRoad(id, lon, lat, angle, true, isRtk);
|
||||
Log.i("timer-matchRoad", "cost " + (System.currentTimeMillis() - start) + "ms");
|
||||
return matchRoad;
|
||||
}
|
||||
|
||||
@@ -429,8 +423,8 @@ class BaseDrawer {
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
public static void clearRoadCacheById( String id ) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById( id );
|
||||
public static void clearRoadCacheById(String id) {
|
||||
MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().clearRoadCacheById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -442,11 +436,11 @@ class BaseDrawer {
|
||||
* @param curSatelliteTime
|
||||
* @return
|
||||
*/
|
||||
public long computeAnimDuration( long lastSystemTime, long curSystemTime, long lastSatelliteTime, long curSatelliteTime ) {
|
||||
public long computeAnimDuration(long lastSystemTime, long curSystemTime, long lastSatelliteTime, long curSatelliteTime) {
|
||||
long systemTimeInterval = curSystemTime - lastSystemTime;
|
||||
long satelliteTimeInterval = curSatelliteTime - lastSatelliteTime;
|
||||
long interval = systemTimeInterval < satelliteTimeInterval || satelliteTimeInterval == 0 ? systemTimeInterval : satelliteTimeInterval;
|
||||
if ( interval < 45 ) {
|
||||
if (interval < 45) {
|
||||
interval = 45;
|
||||
}
|
||||
return interval;
|
||||
@@ -463,37 +457,37 @@ class BaseDrawer {
|
||||
* @param lastLat
|
||||
* @return
|
||||
*/
|
||||
protected double[] getMatchLonLat( String id, double lon, double lat, double heading, double lastLon, double lastLat ) {
|
||||
double[] matchedPoint = matchRoad( id, lon,
|
||||
protected double[] getMatchLonLat(String id, double lon, double lat, double heading, double lastLon, double lastLat) {
|
||||
double[] matchedPoint = matchRoad(id, lon,
|
||||
lat,
|
||||
heading,
|
||||
true
|
||||
);
|
||||
|
||||
boolean match = false;
|
||||
if ( matchedPoint != null ) {
|
||||
if (matchedPoint != null) {
|
||||
// Logger.d( TAG, "matchPoint %s distance = %s",lineCounter, matchedPoint[2] );
|
||||
match = matchedPoint[2] < 1 && matchedPoint[2] > 0;
|
||||
|
||||
if ( lastLon != -1 ) {
|
||||
if (lastLon != -1) {
|
||||
double clearAngle;
|
||||
if ( heading > 0 && heading <= 90 ) {
|
||||
if (heading > 0 && heading <= 90) {
|
||||
clearAngle = heading;
|
||||
} else if ( heading > 90 && heading <= 180 ) {
|
||||
} else if (heading > 90 && heading <= 180) {
|
||||
clearAngle = 180 - heading;
|
||||
} else if ( heading > 180 && heading <= 270 ) {
|
||||
} else if (heading > 180 && heading <= 270) {
|
||||
clearAngle = heading - 180;
|
||||
} else {
|
||||
clearAngle = 360 - heading;
|
||||
}
|
||||
double _angle = Math.atan2( Math.abs( matchedPoint[0] - lastLon ), Math.abs( matchedPoint[1] - lastLat ) ) * ( 180 / PI );
|
||||
_angle = Math.abs( clearAngle - _angle );
|
||||
double _angle = Math.atan2(Math.abs(matchedPoint[0] - lastLon), Math.abs(matchedPoint[1] - lastLat)) * (180 / PI);
|
||||
_angle = Math.abs(clearAngle - _angle);
|
||||
// Logger.d(TAG, "matchPoint %s angel = %s", lineCounter, _angle);
|
||||
if ( _angle > 22.5 ) {
|
||||
if (_angle > 22.5) {
|
||||
match = false;
|
||||
}
|
||||
}
|
||||
if ( match ) {
|
||||
if (match) {
|
||||
lon = matchedPoint[0];
|
||||
lat = matchedPoint[1];
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
// 需要新增的 marker 数量
|
||||
int newDiffSetSize = newDiffSet.size();
|
||||
// 能复用的数量
|
||||
int size = cachedMarkerSize >= newDiffSetSize ? newDiffSetSize : cachedMarkerSize;
|
||||
int size = Math.min(cachedMarkerSize, newDiffSetSize);
|
||||
|
||||
// 复用过期 marker
|
||||
if ( newDiffSetSize > 0 ) {
|
||||
@@ -197,7 +197,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
|
||||
// 更新资源内容
|
||||
if ( old == null || old.getType() != cloudRoadData.getType() ) {
|
||||
String resIdVal = null;
|
||||
String resIdVal;
|
||||
int resId = getModelRes( cloudRoadData.getType() );
|
||||
resIdVal = resId + "";
|
||||
String resName = mMarkerCachesResMd5Values.get( resIdVal );
|
||||
@@ -238,8 +238,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
/**
|
||||
* 判断类型、uuid 等
|
||||
*
|
||||
* @param cloudRoadData
|
||||
* @return
|
||||
* @param cloudRoadData {@link CloudRoadData}
|
||||
* @return isUselessValue
|
||||
*/
|
||||
private boolean isUselessValue( CloudRoadData cloudRoadData ) {
|
||||
if ( cloudRoadData == null ) {
|
||||
@@ -250,17 +250,14 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
}
|
||||
|
||||
String uniqueKey = cloudRoadData.getUniqueKey();
|
||||
if ( TextUtils.isEmpty( uniqueKey ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return TextUtils.isEmpty(uniqueKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制某个物体的一个数据
|
||||
*
|
||||
* @param cloudRoadData
|
||||
* @param newSnapshotCaches
|
||||
* @param cloudRoadData {@link CloudRoadData}
|
||||
* @param newSnapshotCaches 缓存数据
|
||||
*/
|
||||
private void renderSnapshotOneFrame( IMogoMarker marker, String uniqueKey, final CloudRoadData cloudRoadData, Map< String, IMogoMarker > newSnapshotCaches ) {
|
||||
|
||||
@@ -288,9 +285,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
long cost = System.currentTimeMillis() - start;
|
||||
final long intervalRef = interval - cost;
|
||||
|
||||
SimpleHandlerThreadPool.getInstance().postRender( () -> {
|
||||
marker.addDynamicAnchorPosition( point, ( float ) cloudRoadData.getHeading(), intervalRef );
|
||||
} );
|
||||
SimpleHandlerThreadPool.getInstance().postRender( () -> marker.addDynamicAnchorPosition( point, ( float ) cloudRoadData.getHeading(), intervalRef ));
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) cloudRoadData.getHeading() ) );
|
||||
marker.setPosition( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
|
||||
@@ -373,7 +368,7 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
.gps( true )
|
||||
.controlAngle( true )
|
||||
.position( new MogoLatLng( data.getWgslat(), data.getWgslon() ) );
|
||||
String resIdVal = null;
|
||||
String resIdVal;
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
|
||||
|
||||
@@ -88,8 +88,9 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
|
||||
IMogoMarker bottomMarker = drawMarkerWith2Resource(markerShowEntity);
|
||||
|
||||
//2D资源图片位置调整
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon());
|
||||
//2D资源图片位置调整
|
||||
MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 8, 180);
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
|
||||
|
||||
IMogoMarker marker = drawMarker(markerShowEntity);
|
||||
@@ -100,8 +101,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
|
||||
//识别物下方的红色圆圈
|
||||
bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lat : newLocation.getLat(),
|
||||
data.getDirection() == 1 ? data.getStopLines().get(1).lon : newLocation.getLon()), (float) data.getHeading(), 5000);
|
||||
data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(),
|
||||
data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000);
|
||||
//移动完成以后,3s后消失
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
marker.remove();
|
||||
@@ -127,7 +128,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
return marker;
|
||||
}
|
||||
|
||||
public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location){
|
||||
public void drawerMarkerWithLocation(MarkerShowEntity markerShowEntity, MogoLatLng location) {
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(markerShowEntity)
|
||||
.latitude(location.getLat())
|
||||
@@ -140,6 +141,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
|
||||
iMarkerView.setMarker(marker);
|
||||
marker.setToTop();
|
||||
}
|
||||
|
||||
/*
|
||||
* 2D资源绘制marker底部的红色圆圈
|
||||
* */
|
||||
|
||||
@@ -10,11 +10,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 实时坐标
|
||||
* 实时坐标数据处理中心
|
||||
*/
|
||||
class SnapshotLocationController {
|
||||
|
||||
@@ -40,16 +40,15 @@ class SnapshotLocationController {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private CloudLocationInfo mLastLocationInfo = null;
|
||||
|
||||
private List< CloudLocationInfo > mLocationList = new ArrayList<>();
|
||||
private int mDataAccuracy = 0;
|
||||
// GPS(1s1次) RTK(OS侧)缓存数据,
|
||||
private final List< CloudLocationInfo > mLocationList = new ArrayList<>();
|
||||
|
||||
// adda 工控机数据缓存
|
||||
private final List< CloudLocationInfo > mMachineCacheList = new ArrayList<>();
|
||||
|
||||
private int mDataAccuracy = 0;
|
||||
private double mCurSpeed;
|
||||
private double mCurLon;
|
||||
private double mCurLat;
|
||||
@@ -57,26 +56,23 @@ class SnapshotLocationController {
|
||||
/**
|
||||
* 同步从定位来的数据(也可能是rtk)
|
||||
*
|
||||
* @param cli
|
||||
* @param cli {@link CloudLocationInfo}
|
||||
*/
|
||||
public void syncLocationInfo( CloudLocationInfo cli ) {
|
||||
if ( cli == null ) {
|
||||
return;
|
||||
}
|
||||
mLastLocationInfo = cli;
|
||||
mCurSpeed = mLastLocationInfo.getSpeed();
|
||||
mCurLon = mLastLocationInfo.getLon();
|
||||
mCurLat = mLastLocationInfo.getLat();
|
||||
mCurSpeed = cli.getSpeed();
|
||||
mCurLon = cli.getLon();
|
||||
mCurLat = cli.getLat();
|
||||
mLocationList.add( cli );
|
||||
}
|
||||
|
||||
// adda 工控机数据缓存
|
||||
private List< CloudLocationInfo > mMachineCacheList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 同步从工控机来的数据
|
||||
*
|
||||
* @param data
|
||||
* @param data JSON结构化数据
|
||||
*/
|
||||
public void syncAdasLocationInfo( JSONObject data ) {
|
||||
if ( data == null ) {
|
||||
@@ -105,15 +101,15 @@ class SnapshotLocationController {
|
||||
mLastLocationInfo = cloudLocationInfo;
|
||||
mMachineCacheList.add( cloudLocationInfo );
|
||||
|
||||
mCurSpeed = mLastLocationInfo.getSpeed();
|
||||
mCurLon = mLastLocationInfo.getLon();
|
||||
mCurLat = mLastLocationInfo.getLat();
|
||||
mCurSpeed = cloudLocationInfo.getSpeed();
|
||||
mCurLon = cloudLocationInfo.getLon();
|
||||
mCurLat = cloudLocationInfo.getLat();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某一段时间内的坐标集合
|
||||
*
|
||||
* @return
|
||||
* @return 坐标合集
|
||||
*/
|
||||
public List< CloudLocationInfo > getSendLocationData() {
|
||||
|
||||
@@ -144,7 +140,7 @@ class SnapshotLocationController {
|
||||
/**
|
||||
* 数据精度类型,目前按照数据来源标志
|
||||
*
|
||||
* @return
|
||||
* @return 精度
|
||||
*/
|
||||
public int getDataAccuracy() {
|
||||
Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy );
|
||||
|
||||
@@ -109,11 +109,6 @@ public class MogoServices implements IMogoMapListener,
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private static final String TAG = "MogoServices";
|
||||
|
||||
/**
|
||||
@@ -238,7 +233,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
/**
|
||||
* 手动刷新回调
|
||||
*/
|
||||
private RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() {
|
||||
private final RefreshCallback mCustomRefreshCallback = new RefreshCallback< MarkerResponse >() {
|
||||
@Override
|
||||
public void onSuccess( MarkerResponse o ) {
|
||||
MapMarkerManager.getInstance().onSyncMarkerResponse( o );
|
||||
@@ -616,16 +611,13 @@ public class MogoServices implements IMogoMapListener,
|
||||
private int getQueryRadius() {
|
||||
mCameraSouthWestPosition = mUiController.getCameraSouthWestPosition();
|
||||
mCameraNorthEastPosition = mUiController.getCameraNorthEastPosition();
|
||||
int radius = 0;
|
||||
int radius;
|
||||
if ( mIsVertical ) {
|
||||
radius = ( ( int ) ( getMapCameraFactWidth() / 2 ) );
|
||||
} else {
|
||||
radius = ( ( int ) ( getMapCameraFactHeight() / 2 ) );
|
||||
}
|
||||
if ( radius < 1000 ) {
|
||||
return 1_000;
|
||||
}
|
||||
return radius;
|
||||
return Math.max(radius, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -633,7 +625,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private boolean invokeRefreshWhenTranslationByUser( MogoLatLng latLng ) {
|
||||
try {
|
||||
float factor = 0.0f;
|
||||
float factor;
|
||||
if ( mIsVertical ) {
|
||||
factor = getMapCameraFactWidth();
|
||||
} else {
|
||||
@@ -697,7 +689,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
/**
|
||||
* 首次定位成功后,执行道路事件的刷新
|
||||
*
|
||||
* @param point
|
||||
* @param point {@link MogoLatLng}
|
||||
*/
|
||||
private void startFirstLocationRequest( MogoLatLng point ) {
|
||||
mLastAutoRefreshLocation = point;
|
||||
|
||||
@@ -40,61 +40,61 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
private boolean mIsFirstAccOn = true;
|
||||
|
||||
@Override
|
||||
public final void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
switch ( descriptor ) {
|
||||
public final void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
switch (descriptor) {
|
||||
case USER_INTERACTED:
|
||||
onUserInteracted( isTrue );
|
||||
onUserInteracted(isTrue);
|
||||
break;
|
||||
case SEARCH_UI:
|
||||
onSearchUIShow( isTrue );
|
||||
onSearchUIShow(isTrue);
|
||||
break;
|
||||
case MAIN_PAGE_RESUME:
|
||||
onMainPageResumeStatusChanged( isTrue );
|
||||
onMainPageResumeStatusChanged(isTrue);
|
||||
break;
|
||||
case MAIN_PAGE_IS_BACKGROUND:
|
||||
onMainPageIsBackgroundStatusChanged( isTrue );
|
||||
onMainPageIsBackgroundStatusChanged(isTrue);
|
||||
break;
|
||||
case SEEK_HELPING:
|
||||
onSeekHelpingStatusChanged( isTrue );
|
||||
onSeekHelpingStatusChanged(isTrue);
|
||||
break;
|
||||
case ACC_STATUS:
|
||||
onAccStatusChanged( isTrue );
|
||||
onAccStatusChanged(isTrue);
|
||||
break;
|
||||
case VR_MODE:
|
||||
onVrModeChanged( isTrue );
|
||||
onVrModeChanged(isTrue);
|
||||
break;
|
||||
case TOP_VIEW:
|
||||
onTopViewStatusChanged( isTrue );
|
||||
onTopViewStatusChanged(isTrue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onUserInteracted( boolean userInteracted ) {
|
||||
if ( userInteracted ) {
|
||||
MogoServices.getInstance().restartAutoRefreshAtTime( ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT );
|
||||
public void onUserInteracted(boolean userInteracted) {
|
||||
if (userInteracted) {
|
||||
MogoServices.getInstance().restartAutoRefreshAtTime(ServiceConst.DEFAULT_AUTO_REFRESH_WHEN_INTERRUPT);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void onSearchUIShow( boolean visible );
|
||||
public abstract void onSearchUIShow(boolean visible);
|
||||
|
||||
public void onMainPageResumeStatusChanged( boolean resume ) {
|
||||
if ( resume ) {
|
||||
public void onMainPageResumeStatusChanged(boolean resume) {
|
||||
if (resume) {
|
||||
MogoServices.getInstance().registerInternalUnWakeupWords();
|
||||
if ( !mIsMainPageFirstResume ) {
|
||||
MogoServices.getInstance().restartAutoRefreshAtTime( 2_000L );
|
||||
if (!mIsMainPageFirstResume) {
|
||||
MogoServices.getInstance().restartAutoRefreshAtTime(2_000L);
|
||||
}
|
||||
mIsMainPageFirstResume = false;
|
||||
LauncherCardRefresher.getInstance( AbsMogoApplication.getApp() ).stop();
|
||||
LauncherCardRefresher.getInstance(AbsMogoApplication.getApp()).stop();
|
||||
MogoServices.getInstance().playAppTts();
|
||||
} else {
|
||||
MogoServices.getInstance().unregisterInternalUnWakeupWords();
|
||||
MogoServices.getInstance().stopAutoRefreshStrategy();
|
||||
}
|
||||
VrModeController.getInstance().onMainPageResumeStatusChanged( resume );
|
||||
VrModeController.getInstance().onMainPageResumeStatusChanged(resume);
|
||||
}
|
||||
|
||||
public void onMainPageIsBackgroundStatusChanged( boolean isBackground ) {
|
||||
if ( isBackground ) {
|
||||
public void onMainPageIsBackgroundStatusChanged(boolean isBackground) {
|
||||
if (isBackground) {
|
||||
closeAllPanel();
|
||||
}
|
||||
}
|
||||
@@ -104,76 +104,79 @@ abstract class StatusChangedAdapter implements IMogoStatusChangedListener {
|
||||
*/
|
||||
private void closeAllPanel() {
|
||||
|
||||
if ( mCallProviderResponse == null ) {
|
||||
if (mCallProviderResponse == null) {
|
||||
mCallProviderResponse = new ICallChatResponse() {
|
||||
@Override
|
||||
public void hideUserWindowError( @NotNull String errorMsg ) {
|
||||
public void hideUserWindowError(@NotNull String errorMsg) {
|
||||
}
|
||||
};
|
||||
}
|
||||
MogoApisHandler.getInstance().getApis().getShareManager().dismissShareDialog();
|
||||
MogoApisHandler.getInstance().getApis().getOnlineCarPanelApi().hidePanel();
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSettingStatus( false );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().setSettingStatus(false);
|
||||
MogoApisHandler.getInstance().getApis().getEventPanelManager().hidePanel();
|
||||
if ( mCarsChattingProvider == null ) {
|
||||
mCarsChattingProvider = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation();
|
||||
if (mCarsChattingProvider == null) {
|
||||
mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
|
||||
}
|
||||
if ( mCarsChattingProvider != null ) {
|
||||
mCarsChattingProvider.hideUserWindow( TAG, AbsMogoApplication.getApp(), mCallProviderResponse );
|
||||
if (mCarsChattingProvider != null) {
|
||||
mCarsChattingProvider.hideUserWindow(TAG, AbsMogoApplication.getApp(), mCallProviderResponse);
|
||||
}
|
||||
}
|
||||
|
||||
public void onSeekHelpingStatusChanged( boolean isSeekingHelping ) {
|
||||
CarIconDisplayStrategy.getInstance().changeCarIconStatus( isSeekingHelping );
|
||||
notifySeekHelpingStatusChanged( isSeekingHelping );
|
||||
public void onSeekHelpingStatusChanged(boolean isSeekingHelping) {
|
||||
CarIconDisplayStrategy.getInstance().changeCarIconStatus(isSeekingHelping);
|
||||
notifySeekHelpingStatusChanged(isSeekingHelping);
|
||||
}
|
||||
|
||||
private void notifySeekHelpingStatusChanged( boolean seekHelpingStatus ) {
|
||||
Intent intent = new Intent( "com.mogo.launcher.adas.app" );
|
||||
private void notifySeekHelpingStatusChanged(boolean seekHelpingStatus) {
|
||||
Intent intent = new Intent("com.mogo.launcher.adas.app");
|
||||
try {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put( "object", "辅助驾驶" );
|
||||
data.put( "action", seekHelpingStatus ? "2" : "1" );
|
||||
data.put( "des", "自身故障报警" );
|
||||
data.put( "v2x_warning_type", "20007" );// 后台返回
|
||||
intent.putExtra( "data", data.toString() );
|
||||
AbsMogoApplication.getApp().sendBroadcast( intent );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
data.put("object", "辅助驾驶");
|
||||
data.put("action", seekHelpingStatus ? "2" : "1");
|
||||
data.put("des", "自身故障报警");
|
||||
data.put("v2x_warning_type", "20007");// 后台返回
|
||||
intent.putExtra("data", data.toString());
|
||||
AbsMogoApplication.getApp().sendBroadcast(intent);
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "error.");
|
||||
}
|
||||
}
|
||||
|
||||
public void onAccStatusChanged( boolean accOn ) {
|
||||
if ( accOn ) {
|
||||
if ( mIsFirstAccOn ) {
|
||||
public void onAccStatusChanged(boolean accOn) {
|
||||
if (accOn) {
|
||||
if (mIsFirstAccOn) {
|
||||
mIsFirstAccOn = false;
|
||||
return;
|
||||
}
|
||||
MogoServices.getInstance().initLocationServiceProcess( AbsMogoApplication.getApp() );
|
||||
MogoServices.getInstance().initLocationServiceProcess(AbsMogoApplication.getApp());
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().showADAS();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).start();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers();
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp()).start();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).removeMarkers();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
MogoServices.getInstance().refreshStrategy();
|
||||
}, 3_000L );
|
||||
}, 3_000L);
|
||||
} else {
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() ).stop();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager( AbsMogoApplication.getApp() ).removeMarkers();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp()).stop();
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMarkerManager(AbsMogoApplication.getApp()).removeMarkers();
|
||||
}
|
||||
}
|
||||
|
||||
public void onVrModeChanged( boolean isVrMode ) {
|
||||
VrModeController.getInstance().onVrModeChanged( isVrMode );
|
||||
public void onVrModeChanged(boolean isVrMode) {
|
||||
VrModeController.getInstance().onVrModeChanged(isVrMode);
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isSeekHelping()) {
|
||||
onSeekHelpingStatusChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void onTopViewStatusChanged( boolean visible ) {
|
||||
if ( visible ) {
|
||||
public void onTopViewStatusChanged(boolean visible) {
|
||||
if (visible) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
MapMarkerManager.getInstance().onCloseCurrentSelectedMarker();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "onTopViewStatusChanged" );
|
||||
} catch (Exception e) {
|
||||
Logger.e(TAG, e, "onTopViewStatusChanged");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,19 +58,21 @@ public class MogoRTKLocation {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
private LocationListener locationListener = new LocationListener() {
|
||||
private final LocationListener locationListener = new LocationListener() {
|
||||
@Override
|
||||
public void onLocationChanged( Location location ) {
|
||||
if ( location != null ) {
|
||||
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
|
||||
cloudLocationInfo.setAlt( location.getAltitude() );
|
||||
cloudLocationInfo.setHeading( location.getBearing() );
|
||||
cloudLocationInfo.setLat( location.getLatitude() );
|
||||
cloudLocationInfo.setLon( location.getLongitude() );
|
||||
cloudLocationInfo.setSpeed( location.getSpeed() );
|
||||
cloudLocationInfo.setSatelliteTime( location.getTime() );
|
||||
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
|
||||
SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo );
|
||||
if(location.getLatitude() != 0.0 && location.getLongitude() != 0.0){
|
||||
cloudLocationInfo.setAlt( location.getAltitude() );
|
||||
cloudLocationInfo.setHeading( location.getBearing() );
|
||||
cloudLocationInfo.setLat( location.getLatitude() );
|
||||
cloudLocationInfo.setLon( location.getLongitude() );
|
||||
cloudLocationInfo.setSpeed( location.getSpeed() );
|
||||
cloudLocationInfo.setSatelliteTime( location.getTime() );
|
||||
cloudLocationInfo.setSystemTime( System.currentTimeMillis() );
|
||||
SnapshotLocationController.getInstance().syncLocationInfo( cloudLocationInfo );
|
||||
}
|
||||
} else {
|
||||
Logger.e( TAG, "location == null" );
|
||||
}
|
||||
|
||||
@@ -81,6 +81,35 @@ public class CarIconDisplayStrategy {
|
||||
R.drawable.module_service_ic_warning_circle_orange_00046
|
||||
};
|
||||
|
||||
// F 系列才有这个帧动画
|
||||
public static final int[] sFrameVr = {
|
||||
R.drawable.module_service_ic_car_for_help_0000,
|
||||
R.drawable.module_service_ic_car_for_help_0001,
|
||||
R.drawable.module_service_ic_car_for_help_0002,
|
||||
R.drawable.module_service_ic_car_for_help_0003,
|
||||
R.drawable.module_service_ic_car_for_help_0004,
|
||||
R.drawable.module_service_ic_car_for_help_0005,
|
||||
R.drawable.module_service_ic_car_for_help_0006,
|
||||
R.drawable.module_service_ic_car_for_help_0007,
|
||||
R.drawable.module_service_ic_car_for_help_0008,
|
||||
R.drawable.module_service_ic_car_for_help_0009,
|
||||
R.drawable.module_service_ic_car_for_help_0010,
|
||||
R.drawable.module_service_ic_car_for_help_0011,
|
||||
R.drawable.module_service_ic_car_for_help_0012,
|
||||
R.drawable.module_service_ic_car_for_help_0013,
|
||||
R.drawable.module_service_ic_car_for_help_0014,
|
||||
R.drawable.module_service_ic_car_for_help_0015,
|
||||
R.drawable.module_service_ic_car_for_help_0016,
|
||||
R.drawable.module_service_ic_car_for_help_0017,
|
||||
R.drawable.module_service_ic_car_for_help_0018,
|
||||
R.drawable.module_service_ic_car_for_help_0019,
|
||||
R.drawable.module_service_ic_car_for_help_0020,
|
||||
R.drawable.module_service_ic_car_for_help_0021,
|
||||
R.drawable.module_service_ic_car_for_help_0022,
|
||||
R.drawable.module_service_ic_car_for_help_0023,
|
||||
R.drawable.module_service_ic_car_for_help_0024
|
||||
};
|
||||
|
||||
private static volatile CarIconDisplayStrategy sInstance;
|
||||
|
||||
private IMogoMarker mSeekHelpingMarker;
|
||||
@@ -165,6 +194,7 @@ public class CarIconDisplayStrategy {
|
||||
switch (msg.what) {
|
||||
case MSG_SEEK_HELPING_ANIM:
|
||||
try {
|
||||
stopAnim();
|
||||
playAnim();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -191,13 +221,20 @@ public class CarIconDisplayStrategy {
|
||||
|
||||
private void playAnim() {
|
||||
try {
|
||||
for (int i : sFrame) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
if (MarkerServiceHandler.getMogoStatusManager().isVrMode()) {
|
||||
for (int i : sFrameVr) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
} else {
|
||||
for (int i : sFrame) {
|
||||
mBitmapFrames.add(BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), i));
|
||||
}
|
||||
}
|
||||
|
||||
mSeekHelpingMarker = MarkerServiceHandler.getMarkerManager().addMarker(TAG,
|
||||
new MogoMarkerOptions()
|
||||
.icons(mBitmapFrames)
|
||||
.period(1)
|
||||
.period(20)
|
||||
.zIndex(0)
|
||||
.autoManager(false)
|
||||
.anchor(0.5f, 0.5f)
|
||||
|
||||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.2 KiB |
|
After Width: | Height: | Size: 9.8 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 96 KiB |
|
After Width: | Height: | Size: 117 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 159 KiB |
|
After Width: | Height: | Size: 168 KiB |
|
After Width: | Height: | Size: 176 KiB |
|
After Width: | Height: | Size: 183 KiB |
|
After Width: | Height: | Size: 186 KiB |
|
After Width: | Height: | Size: 198 KiB |
|
After Width: | Height: | Size: 203 KiB |
|
After Width: | Height: | Size: 214 KiB |
|
After Width: | Height: | Size: 218 KiB |
|
After Width: | Height: | Size: 227 KiB |
|
After Width: | Height: | Size: 228 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.v2x.scenario.scene.help;
|
||||
|
||||
import android.app.ActionBar;
|
||||
import android.content.Intent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -82,8 +83,8 @@ public class V2XSeekHelpButton implements IV2XButton {
|
||||
tvCancel.setOnClickListener(v -> {
|
||||
doAction();
|
||||
});
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams((int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_640),
|
||||
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140));
|
||||
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_150));
|
||||
V2XServiceManager.getMogoTopViewManager().addView(topView, layoutParams);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,12 +67,7 @@ public class V2XPushLiveCarWindow extends V2XBasWindow implements IV2XWindow<V2X
|
||||
mV2XLiveGSYVideoView = findViewById(R.id.videoPlayer);
|
||||
mIvReportHead = findViewById(R.id.ivReportHead);
|
||||
ImageView pushVideoClose = findViewById(R.id.pushVideoClose);
|
||||
pushVideoClose.setOnClickListener(v -> {
|
||||
//移除窗体
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.removeViewNoLinkage(this);
|
||||
});
|
||||
pushVideoClose.setOnClickListener(v -> close());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -55,6 +55,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
|
||||
: R.layout.window_see_carlive_video, this);
|
||||
CarZegoLiveVideoView mV2XCarLiveVideoView = findViewById(R.id.videoPlayer);
|
||||
tvCountDown = findViewById(R.id.tvCountDown);
|
||||
ImageView ivLiveVideoClose = findViewById(R.id.liveVideoClose);
|
||||
ivVideoPlayingSign = findViewById(R.id.ivVideoPlayingSign);
|
||||
mV2XCarLiveVideoView.addOnVideoStatusChangeListener(videoPlaying -> {
|
||||
isVideoPlay = videoPlaying;
|
||||
@@ -64,6 +65,7 @@ public class V2XVoiceCallLiveCarWindow extends V2XBasWindow
|
||||
stopCountDown();
|
||||
}
|
||||
});
|
||||
ivLiveVideoClose.setOnClickListener(v -> close());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#dd000000" />
|
||||
<solid android:color="#000000" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
</shape>
|
||||
@@ -275,6 +275,7 @@
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:background="@color/v2x_line_color"
|
||||
android:visibility="gone"
|
||||
android:alpha="0.3"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_play"
|
||||
app:layout_constraintStart_toEndOf="@+id/ll_event"
|
||||
|
||||
@@ -17,5 +17,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:src="@drawable/module_common_close_selector" />
|
||||
</RelativeLayout>
|
||||
@@ -19,5 +19,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:src="@drawable/module_common_close_selector" />
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:src="@drawable/module_v2x_vr_close" />
|
||||
</RelativeLayout>
|
||||
@@ -1,55 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_640"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:background="@drawable/bg_v2x_event_bg">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_event"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/icon_car_for_help"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_event"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="@dimen/dp_480"
|
||||
android:paddingLeft="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_40"
|
||||
android:text="正在为您发起求助"
|
||||
android:textColor="@color/v2x_white"
|
||||
android:textSize="@dimen/dp_32"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_event"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_0_5"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:background="@color/v2x_line_color"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_cancel"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="@dimen/dp_640"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_40"
|
||||
android:text="取消"
|
||||
android:textColor="@color/v2x_car_for_help_cancel"
|
||||
android:textSize="@dimen/dp_30"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:alpha="0.7"
|
||||
android:layout_marginTop="@dimen/dp_8"
|
||||
android:background="@drawable/bg_v2x_event_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_event"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginLeft="@dimen/dp_30"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/icon_car_for_help"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_event"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:maxWidth="@dimen/dp_480"
|
||||
android:paddingLeft="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_40"
|
||||
android:text="正在为您发起求助"
|
||||
android:textColor="@color/v2x_white"
|
||||
android:textSize="@dimen/dp_32"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_event"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/dp_0_5"
|
||||
android:layout_height="@dimen/dp_70"
|
||||
android:alpha="0.3"
|
||||
android:background="@color/v2x_line_color"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/tv_cancel"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_cancel"
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="@dimen/dp_40"
|
||||
android:paddingRight="@dimen/dp_40"
|
||||
android:text="取消"
|
||||
android:textColor="@color/v2x_car_for_help_cancel"
|
||||
android:textSize="@dimen/dp_30"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -12,4 +12,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/liveVideoClose"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:src="@drawable/module_v2x_vr_close" />
|
||||
|
||||
</RelativeLayout>
|
||||