优化显示逻辑
This commit is contained in:
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.3.9'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.4.0'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -1031,7 +1031,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
bean.setLon(lon);
|
||||
bean.setGnss_speed(((float) speed));
|
||||
bean.setLat(lat);
|
||||
Logger.d("ADASCOOR", "使用rtk定位数据%s", GsonUtil.jsonFromObject(bean));
|
||||
mMapView.getLocationClient().updateRTKAutoPilotLocation(bean);
|
||||
}
|
||||
|
||||
|
||||
@@ -484,37 +484,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// MarkerTranslateAnimation animation = new MarkerTranslateAnimation( newPoints );
|
||||
// animation.setDuration( duration );
|
||||
// animation.setAnimationListener( new MarkerAnimationListener() {
|
||||
// @Override
|
||||
// public void onAnimationStart( @NotNull Animation animation ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationEnd( @NotNull Animation animation ) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// long lastTime = 0L;
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimationRepeat( @NotNull Animation animation ) {
|
||||
// if ( lastTime == 0L ) {
|
||||
// lastTime = System.currentTimeMillis();
|
||||
// return;
|
||||
// }
|
||||
// Logger.d( TAG, "frame cost = %s", System.currentTimeMillis() - lastTime );
|
||||
// lastTime = System.currentTimeMillis();
|
||||
// }
|
||||
// } );
|
||||
// mMarker.setTranslateAnimation( animation );
|
||||
// mMarker.startAnimation();
|
||||
|
||||
mMarker.startSmooth( newPoints, ( int ) duration );
|
||||
// mMarker.addDynamicAnchorPostion( newPoints.get( newPoints.size() - 1 ), ( int ) duration );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -537,7 +507,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
@Override
|
||||
public void use3DResource( int model3D ) {
|
||||
try {
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().anchorColor( "#00FF00" ).marker3DIcon( model3D ) );
|
||||
mMarker.setMarkerOptions( mMarker.getMarkeOptions().marker3DIcon( model3D ) );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "use3DResource" );
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
renderRef.addDynamicAnchorPosition( renderLoc, ( float ) recognizedListResult.heading, intervalRef );
|
||||
} );
|
||||
|
||||
// marker.setAnchorColor( getModelRenderColor(recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading) );
|
||||
marker.setAnchorColor( getModelRenderColor(recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading) );
|
||||
} else {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
@@ -258,8 +258,8 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.gps( true )
|
||||
.anchorColor( getModelRenderColor( CloudRoadData.FROM_ADAS, recognizedListResult.type ) )
|
||||
// .anchorColor( getModelRenderColor(recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading) )
|
||||
// .anchorColor( getModelRenderColor( CloudRoadData.FROM_ADAS, recognizedListResult.type ) )
|
||||
.anchorColor( getModelRenderColor(recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading) )
|
||||
.controlAngle( true )
|
||||
.resName( mMarkerCachesResMd5Values.get( resIdVal ) )
|
||||
.icon3DRes( resId )
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
@@ -188,6 +189,7 @@ class BaseDrawer {
|
||||
|
||||
/**
|
||||
* 是否展示车速
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@@ -262,9 +264,8 @@ class BaseDrawer {
|
||||
protected String getModelRenderColor( double speed, double lon, double lat, double angle ) {
|
||||
|
||||
// 距离策略
|
||||
double curLon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
double curLat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
double distance = CoordinateUtils.calculateLineDistance( lon, lat, curLon, curLat ) * 100;
|
||||
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 ) {
|
||||
@@ -274,7 +275,7 @@ class BaseDrawer {
|
||||
// 他车车速和自车车速对比速度策略
|
||||
// 自车速度 >= 50% 危险
|
||||
// 10% < 自车速度 < 50% 警告
|
||||
double curSpeed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed();
|
||||
double curSpeed = getCurSpeed();
|
||||
if ( curSpeed > 0 && speed > curSpeed ) {
|
||||
double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
|
||||
if ( rate >= 50 ) {
|
||||
@@ -288,6 +289,36 @@ class BaseDrawer {
|
||||
return Car3DModelColor.Normal.color;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前自车速度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private double getCurSpeed() {
|
||||
double speed = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastSpeed();
|
||||
if ( speed <= 0 ) {
|
||||
speed = SnapshotLocationController.getInstance().getCurSpeed();
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回当前自车经纬度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private double[] getCurCoordinates() {
|
||||
double coordinates[] = {
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon(),
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat(),
|
||||
};
|
||||
if ( coordinates[0] <= 0 ) {
|
||||
coordinates[0] = SnapshotLocationController.getInstance().getCurLon();
|
||||
coordinates[1] = SnapshotLocationController.getInstance().getCurLat();
|
||||
}
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 模型颜色
|
||||
|
||||
@@ -80,8 +80,6 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
|
||||
private final Map< String, CloudRoadData > mLastPositions = new ConcurrentHashMap<>();
|
||||
|
||||
private final Map< String, Long > mLastPositionExecutionTime = new HashMap<>();
|
||||
|
||||
private boolean mIsVrMode = false;
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.service.uploadintime;
|
||||
package com.mogo.module.common.uploadintime;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
@@ -50,6 +50,10 @@ class SnapshotLocationController {
|
||||
private List< CloudLocationInfo > mLocationList = new ArrayList<>();
|
||||
private int mDataAccuracy = 0;
|
||||
|
||||
private double mCurSpeed;
|
||||
private double mCurLon;
|
||||
private double mCurLat;
|
||||
|
||||
/**
|
||||
* 同步从定位来的数据(也可能是rtk)
|
||||
*
|
||||
@@ -60,6 +64,9 @@ class SnapshotLocationController {
|
||||
return;
|
||||
}
|
||||
mLastLocationInfo = cli;
|
||||
mCurSpeed = mLastLocationInfo.getSpeed();
|
||||
mCurLon = mLastLocationInfo.getLon();
|
||||
mCurLat = mLastLocationInfo.getLat();
|
||||
mLocationList.add( cli );
|
||||
}
|
||||
|
||||
@@ -97,6 +104,10 @@ class SnapshotLocationController {
|
||||
cloudLocationInfo.setSystemTime( systemTime );
|
||||
mLastLocationInfo = cloudLocationInfo;
|
||||
mMachineCacheList.add( cloudLocationInfo );
|
||||
|
||||
mCurSpeed = mLastLocationInfo.getSpeed();
|
||||
mCurLon = mLastLocationInfo.getLon();
|
||||
mCurLat = mLastLocationInfo.getLat();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -139,4 +150,16 @@ class SnapshotLocationController {
|
||||
Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy );
|
||||
return mDataAccuracy;
|
||||
}
|
||||
|
||||
public double getCurSpeed() {
|
||||
return mCurSpeed;
|
||||
}
|
||||
|
||||
public double getCurLon() {
|
||||
return mCurLon;
|
||||
}
|
||||
|
||||
public double getCurLat() {
|
||||
return mCurLat;
|
||||
}
|
||||
}
|
||||
@@ -93,9 +93,11 @@ class MapControlCommandHandler {
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_SPEAK_REMAIN:
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_OPEN_VR:
|
||||
case VoiceConstants.CMD_MAP_OPEN_VR_UN_WAKEUP:
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeToVRMode();
|
||||
break;
|
||||
case VoiceConstants.CMD_MAP_CLOSE_VR:
|
||||
case VoiceConstants.CMD_MAP_CLOSE_VR_UN_WAKEUP:
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().changeTo2dMode();
|
||||
break;
|
||||
|
||||
@@ -48,10 +48,26 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
|
||||
@Override
|
||||
public void changeTo2dMode() {
|
||||
try {
|
||||
mMogoMapView.getMap().getUIController()
|
||||
.changeMapMode(
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.getCurrentSkinMode()
|
||||
);
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToVRMode() {
|
||||
try {
|
||||
mMogoMapView.getMap().getUIController().changeMapMode( EnumMapUI.Type_VR);
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -221,6 +221,8 @@ public class VoiceConstants {
|
||||
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DRAFT_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_DETAIL_MODE );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_SPEAK_REMAIN );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_OPEN_VR );
|
||||
sCmds.add( VoiceConstants.CMD_MAP_CLOSE_VR );
|
||||
|
||||
// 退到后台不注销的命令
|
||||
sUnUnRegisterCmds.add( VoiceConstants.CMD_MAP_CONTINUE_NAVI_MODE );
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy;
|
||||
import com.mogo.module.common.map.Scene;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.service.autopilot.AutoPilotRemoteController;
|
||||
import com.mogo.module.service.handler.MainLooperHandler;
|
||||
import com.mogo.module.service.handler.RefreshWorkThreadHandler;
|
||||
@@ -47,7 +48,6 @@ import com.mogo.module.service.refresh.CustomRefreshStrategy;
|
||||
import com.mogo.module.service.refresh.RefreshObject;
|
||||
import com.mogo.module.service.strategy.CarIconDisplayStrategy;
|
||||
import com.mogo.module.service.ttsConfig.TtsConfigModleData;
|
||||
import com.mogo.module.service.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
import com.mogo.service.adas.IMogoAdasCarDataCallback;
|
||||
@@ -945,7 +945,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, true );
|
||||
MapCenterPointStrategy.resetByChangeMode();
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "你已进入鹰眼模式" );
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已开启鹰眼模式" );
|
||||
mLastStatusIsVr = true;
|
||||
}
|
||||
} else {
|
||||
@@ -954,7 +954,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().setVrMode( TAG, false );
|
||||
MapCenterPointStrategy.resetByChangeMode();
|
||||
MapMarkerManager.getInstance().redrawMarkerByStyleChanged();
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "你已离开鹰眼模式" );
|
||||
AIAssist.getInstance( mContext ).speakTTSVoice( "已退出鹰眼模式" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.carinfo.CarStateInfo;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
|
||||
@@ -32,10 +32,10 @@ import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.dialog.WMDialog;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.status.EnvStatusManager;
|
||||
import com.mogo.module.service.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
|
||||
@@ -8,7 +8,7 @@ import android.location.LocationManager;
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.service.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.mogo.module.service.marker;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/27
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class AdasRecognizedType {
|
||||
//背景
|
||||
public static final int classIdBackground = 0;
|
||||
//人
|
||||
public static final int classIdPerson = 1;
|
||||
//自行车
|
||||
public static final int classIdBicycle = 2;
|
||||
//小轿车
|
||||
public static final int classIdCar = 3;
|
||||
//摩托车
|
||||
public static final int classIdMoto = 4;
|
||||
//红绿灯
|
||||
public static final int classIdTrafficSign = 5;
|
||||
//bus
|
||||
public static final int classIdTrafficBus = 6;
|
||||
//track
|
||||
public static final int classIdTrafficTruck = 8;
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.module.service.spi;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.api.IRealTimeProvider;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
|
||||
Reference in New Issue
Block a user