Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
This commit is contained in:
@@ -42,6 +42,8 @@ dependencies {
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.accountsdk
|
||||
api rootProject.ext.dependencies.mogoaicloudrealtime
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
api rootProject.ext.dependencies.ttsbase
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.mogo.commons.data;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description adas识别数据需要转换一下
|
||||
* @since 2021/4/23
|
||||
*/
|
||||
public class ADASRecognizedResultConvert {
|
||||
|
||||
/**
|
||||
* 识别物体类型
|
||||
*/
|
||||
public int type;
|
||||
|
||||
/**
|
||||
* 识别物体唯一标识
|
||||
*/
|
||||
public String uuid;
|
||||
|
||||
/**
|
||||
* 红绿灯颜色
|
||||
*/
|
||||
public String color;
|
||||
|
||||
/**
|
||||
* 车ID
|
||||
*/
|
||||
public String carId;
|
||||
|
||||
/**
|
||||
* 识别物体的纬度
|
||||
*/
|
||||
public double lat;
|
||||
|
||||
/**
|
||||
* 识别物体的经度
|
||||
*/
|
||||
public double lon;
|
||||
|
||||
/**
|
||||
* 车头朝向
|
||||
*/
|
||||
public double heading;
|
||||
|
||||
/**
|
||||
* 系统时间
|
||||
*/
|
||||
public long systemTime;
|
||||
|
||||
/**
|
||||
* 定位卫星时间
|
||||
*/
|
||||
public long satelliteTime;
|
||||
|
||||
/**
|
||||
* 海拔
|
||||
*/
|
||||
public double alt;
|
||||
|
||||
/**
|
||||
* 速度
|
||||
*/
|
||||
public double speed;
|
||||
|
||||
/**
|
||||
* 莫顿码
|
||||
*/
|
||||
public long mortonCode;
|
||||
|
||||
/**
|
||||
* 实际距离
|
||||
* 使用distanceX和distanceY计算
|
||||
*/
|
||||
public double distance;
|
||||
|
||||
/**
|
||||
* 数据来源精度
|
||||
* 0:普通定位
|
||||
* 1:高精定位
|
||||
*/
|
||||
public int dataAccuracy;
|
||||
|
||||
/**
|
||||
* 道路ID
|
||||
*/
|
||||
private String roadId;
|
||||
|
||||
/**
|
||||
* 车道ID-2D路段
|
||||
*/
|
||||
private String laneId;
|
||||
|
||||
/**
|
||||
* 车道号:中心线编号为0,中心线右侧编号为负数,3车道通行Road的车道编号,0,-1,-2,-3
|
||||
*/
|
||||
private int laneNum;
|
||||
|
||||
/**
|
||||
* 限速
|
||||
*/
|
||||
private double rateLimiting;
|
||||
|
||||
/**
|
||||
* 车道宽度
|
||||
*/
|
||||
private double roadWidth;
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.commons.debug;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
@@ -28,7 +26,7 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sDebug true - 调试模式 false - 非调试模式
|
||||
*/
|
||||
public static void setDebug( boolean sDebug ) {
|
||||
public static void setDebug(boolean sDebug) {
|
||||
DebugConfig.sDebug = sDebug;
|
||||
}
|
||||
|
||||
@@ -69,7 +67,7 @@ public class DebugConfig {
|
||||
*/
|
||||
public static final int AI_TYPE_SPEECH = 2;
|
||||
|
||||
private static int sAIType = AI_TYPE_TXZ;
|
||||
private static final int sAIType = AI_TYPE_TXZ;
|
||||
|
||||
/**
|
||||
* 自研车机
|
||||
@@ -116,7 +114,7 @@ public class DebugConfig {
|
||||
* {@link #NET_MODE_DEMO}
|
||||
* {@link #NET_MODE_RELEASE}
|
||||
*/
|
||||
public static void setNetMode( int netMode ) {
|
||||
public static void setNetMode(int netMode) {
|
||||
DebugConfig.sNetMode = netMode;
|
||||
}
|
||||
|
||||
@@ -129,7 +127,7 @@ public class DebugConfig {
|
||||
return sLaunchLocationService;
|
||||
}
|
||||
|
||||
public static void setLaunchLocationService( boolean launchLocationService ) {
|
||||
public static void setLaunchLocationService(boolean launchLocationService) {
|
||||
DebugConfig.sLaunchLocationService = launchLocationService;
|
||||
}
|
||||
|
||||
@@ -142,7 +140,7 @@ public class DebugConfig {
|
||||
return sUseCustomNavi;
|
||||
}
|
||||
|
||||
public static void setUseCustomNavi( boolean sUseCustomNavi ) {
|
||||
public static void setUseCustomNavi(boolean sUseCustomNavi) {
|
||||
DebugConfig.sUseCustomNavi = sUseCustomNavi;
|
||||
}
|
||||
|
||||
@@ -151,7 +149,7 @@ public class DebugConfig {
|
||||
*
|
||||
* @param type {@link #CAR_MACHINE_TYPE_SELF_INNOVATE} {@link #CAR_MACHINE_TYPE_BYD}
|
||||
*/
|
||||
public static void setCarMachineType( int type ) {
|
||||
public static void setCarMachineType(int type) {
|
||||
sCarMachineType = type;
|
||||
}
|
||||
|
||||
@@ -173,7 +171,7 @@ public class DebugConfig {
|
||||
return sIsLauncher;
|
||||
}
|
||||
|
||||
public static void setLauncher( boolean isLauncher ) {
|
||||
public static void setLauncher(boolean isLauncher) {
|
||||
DebugConfig.sIsLauncher = isLauncher;
|
||||
}
|
||||
|
||||
@@ -183,7 +181,7 @@ public class DebugConfig {
|
||||
return sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) {
|
||||
public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) {
|
||||
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
@@ -193,7 +191,7 @@ public class DebugConfig {
|
||||
return sUseCustomMap;
|
||||
}
|
||||
|
||||
public static void setUseCustomMap( boolean sUseCustomMap ) {
|
||||
public static void setUseCustomMap(boolean sUseCustomMap) {
|
||||
DebugConfig.sUseCustomMap = sUseCustomMap;
|
||||
}
|
||||
|
||||
@@ -206,13 +204,13 @@ public class DebugConfig {
|
||||
return sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
public static void setActiveAIAssistFlag( boolean sActiveAIAssistFlag ) {
|
||||
public static void setActiveAIAssistFlag(boolean sActiveAIAssistFlag) {
|
||||
DebugConfig.sActiveAIAssistFlag = sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
private static boolean useMockObuData;
|
||||
|
||||
public static void setUseMockObuData( boolean use ) {
|
||||
public static void setUseMockObuData(boolean use) {
|
||||
useMockObuData = use;
|
||||
}
|
||||
|
||||
@@ -231,13 +229,13 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sProductFlavor
|
||||
*/
|
||||
public static void setProductFlavor( String sProductFlavor ) {
|
||||
public static void setProductFlavor(String sProductFlavor) {
|
||||
DebugConfig.sProductFlavor = sProductFlavor;
|
||||
}
|
||||
|
||||
private static String sSocketAppId;
|
||||
|
||||
public static void setSocketAppId( String sSocketAppId ) {
|
||||
public static void setSocketAppId(String sSocketAppId) {
|
||||
DebugConfig.sSocketAppId = sSocketAppId;
|
||||
}
|
||||
|
||||
@@ -254,14 +252,14 @@ public class DebugConfig {
|
||||
return sRoadEventAnimated;
|
||||
}
|
||||
|
||||
public static void setRoadEventAnimated( boolean sRoadEventAnimated ) {
|
||||
public static void setRoadEventAnimated(boolean sRoadEventAnimated) {
|
||||
DebugConfig.sRoadEventAnimated = sRoadEventAnimated;
|
||||
}
|
||||
|
||||
|
||||
private static boolean sLoadGuideModule = false;
|
||||
|
||||
public static void setLoadGuideModule( boolean sLoadGuideModule ) {
|
||||
public static void setLoadGuideModule(boolean sLoadGuideModule) {
|
||||
DebugConfig.sLoadGuideModule = sLoadGuideModule;
|
||||
}
|
||||
|
||||
@@ -277,7 +275,7 @@ public class DebugConfig {
|
||||
|
||||
private static boolean isSkinSupported = false;
|
||||
|
||||
public static void setSkinSupported( boolean isSkinSupported ) {
|
||||
public static void setSkinSupported(boolean isSkinSupported) {
|
||||
DebugConfig.isSkinSupported = isSkinSupported;
|
||||
}
|
||||
|
||||
@@ -290,7 +288,7 @@ public class DebugConfig {
|
||||
*/
|
||||
private static boolean isSupportedSearchDestinationOnlineCarList = false;
|
||||
|
||||
public static void setSupportedSearchDestinationOnlineCarList( boolean isSupportedSearchDestinationOnlineCarList ) {
|
||||
public static void setSupportedSearchDestinationOnlineCarList(boolean isSupportedSearchDestinationOnlineCarList) {
|
||||
DebugConfig.isSupportedSearchDestinationOnlineCarList = isSupportedSearchDestinationOnlineCarList;
|
||||
}
|
||||
|
||||
@@ -303,7 +301,7 @@ public class DebugConfig {
|
||||
*/
|
||||
private static boolean isScheduleCalculateNotHomeCompanyDistanceForPush = false;
|
||||
|
||||
public static void setScheduleCalculateNotHomeCompanyDistanceForPush( boolean isScheduleCalculateNotHomeCompanyDistanceForPush ) {
|
||||
public static void setScheduleCalculateNotHomeCompanyDistanceForPush(boolean isScheduleCalculateNotHomeCompanyDistanceForPush) {
|
||||
DebugConfig.isScheduleCalculateNotHomeCompanyDistanceForPush = isScheduleCalculateNotHomeCompanyDistanceForPush;
|
||||
}
|
||||
|
||||
@@ -316,7 +314,7 @@ public class DebugConfig {
|
||||
*/
|
||||
private static boolean isSupportLauncherCardRefreshStrategy = false;
|
||||
|
||||
public static void setSupportLauncherCardRefreshStrategy( boolean isSupportLauncherCardRefreshStrategy ) {
|
||||
public static void setSupportLauncherCardRefreshStrategy(boolean isSupportLauncherCardRefreshStrategy) {
|
||||
DebugConfig.isSupportLauncherCardRefreshStrategy = isSupportLauncherCardRefreshStrategy;
|
||||
}
|
||||
|
||||
@@ -330,7 +328,7 @@ public class DebugConfig {
|
||||
return obuType;
|
||||
}
|
||||
|
||||
public static void setObuType( int type ) {
|
||||
public static void setObuType(int type) {
|
||||
obuType = type;
|
||||
}
|
||||
|
||||
@@ -339,7 +337,7 @@ public class DebugConfig {
|
||||
*/
|
||||
private static boolean needRequestUserInfo = false;
|
||||
|
||||
public static void setNeedRequestUserInfo( boolean needRequestUserInfo ) {
|
||||
public static void setNeedRequestUserInfo(boolean needRequestUserInfo) {
|
||||
DebugConfig.needRequestUserInfo = needRequestUserInfo;
|
||||
}
|
||||
|
||||
@@ -356,13 +354,13 @@ public class DebugConfig {
|
||||
return isMapBased;
|
||||
}
|
||||
|
||||
public static void setMapBased( boolean isMapBased ) {
|
||||
public static void setMapBased(boolean isMapBased) {
|
||||
DebugConfig.isMapBased = isMapBased;
|
||||
}
|
||||
|
||||
private static boolean isNeedLoadGuideModule = true;
|
||||
|
||||
public static void setNeedLoadGuideModule( boolean isNeedLoadGuideModule ) {
|
||||
public static void setNeedLoadGuideModule(boolean isNeedLoadGuideModule) {
|
||||
DebugConfig.isNeedLoadGuideModule = isNeedLoadGuideModule;
|
||||
}
|
||||
|
||||
@@ -376,7 +374,7 @@ public class DebugConfig {
|
||||
return isNeedHideAdasWhenShare;
|
||||
}
|
||||
|
||||
public static void setNeedHideAdasWhenShare( boolean isNeedHideAdas ) {
|
||||
public static void setNeedHideAdasWhenShare(boolean isNeedHideAdas) {
|
||||
DebugConfig.isNeedHideAdasWhenShare = isNeedHideAdas;
|
||||
}
|
||||
|
||||
@@ -389,7 +387,7 @@ public class DebugConfig {
|
||||
return sIsNeedUploadCoordinatesInTime;
|
||||
}
|
||||
|
||||
public static void setNeedUploadCoordinatesInTime( boolean sIsNeedUploadCoordinatesInTime ) {
|
||||
public static void setNeedUploadCoordinatesInTime(boolean sIsNeedUploadCoordinatesInTime) {
|
||||
DebugConfig.sIsNeedUploadCoordinatesInTime = sIsNeedUploadCoordinatesInTime;
|
||||
}
|
||||
|
||||
@@ -402,7 +400,7 @@ public class DebugConfig {
|
||||
return sIsUseAdasRtkLocationInfo;
|
||||
}
|
||||
|
||||
public static void setUseAdasRtkLocationInfo( boolean sIsUseAdasRtkLocationInfo ) {
|
||||
public static void setUseAdasRtkLocationInfo(boolean sIsUseAdasRtkLocationInfo) {
|
||||
DebugConfig.sIsUseAdasRtkLocationInfo = sIsUseAdasRtkLocationInfo;
|
||||
}
|
||||
|
||||
@@ -412,17 +410,17 @@ public class DebugConfig {
|
||||
return sIsNotSmooth;
|
||||
}
|
||||
|
||||
public static void setNotSmooth( boolean sIsNotSmooth ) {
|
||||
public static void setNotSmooth(boolean sIsNotSmooth) {
|
||||
DebugConfig.sIsNotSmooth = sIsNotSmooth;
|
||||
}
|
||||
|
||||
public static boolean isOCHModule() {
|
||||
return sProductFlavor != null && sProductFlavor.startsWith( "foch" );
|
||||
return sProductFlavor != null && sProductFlavor.startsWith("foch");
|
||||
}
|
||||
|
||||
public static int sSelfCarSpeedYOffset = 20;
|
||||
|
||||
public static void setSelfCarSpeedYOffset( int sSelfCarSpeedYOffset ) {
|
||||
public static void setSelfCarSpeedYOffset(int sSelfCarSpeedYOffset) {
|
||||
DebugConfig.sSelfCarSpeedYOffset = sSelfCarSpeedYOffset;
|
||||
}
|
||||
|
||||
@@ -436,20 +434,28 @@ public class DebugConfig {
|
||||
public static final int sDownloadSnapshot = 2;
|
||||
public static final int sAutoPilotStatus = 3;
|
||||
public static final int sDownloadLink = 4;
|
||||
public static final int sLon = 5;
|
||||
public static final int sLat = 6;
|
||||
|
||||
public static String[] sStatus = new String[]{
|
||||
"false",
|
||||
"false",
|
||||
"false",
|
||||
"0",
|
||||
"false"
|
||||
"false",
|
||||
"0",
|
||||
"0"
|
||||
};
|
||||
|
||||
public synchronized static void setStatus( int type, boolean status ) {
|
||||
sStatus[type] = String.valueOf( status );
|
||||
public synchronized static void setStatus(int type, boolean status) {
|
||||
sStatus[type] = String.valueOf(status);
|
||||
}
|
||||
|
||||
public synchronized static void setAutoPilotStatus( String status ) {
|
||||
public synchronized static void setStatusData(int type, double data) {
|
||||
sStatus[type] = String.valueOf(data);
|
||||
}
|
||||
|
||||
public synchronized static void setAutoPilotStatus(String status) {
|
||||
sStatus[sAutoPilotStatus] = status;
|
||||
}
|
||||
|
||||
@@ -457,13 +463,21 @@ public class DebugConfig {
|
||||
return sStatus[sAutoPilotStatus];
|
||||
}
|
||||
|
||||
public synchronized static String getStatus( int type, boolean set2False ) {
|
||||
public synchronized static String getStatus(int type, boolean set2False) {
|
||||
String result = sStatus[type];
|
||||
if ( set2False ) {
|
||||
if (set2False) {
|
||||
sStatus[type] = "false";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public synchronized static String getStatusData(int type){
|
||||
if(type > 4){
|
||||
return sStatus[type].toString();
|
||||
}else{
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isUseAdasRecognize = true;
|
||||
|
||||
@@ -471,7 +485,7 @@ public class DebugConfig {
|
||||
isUseAdasRecognize = status;
|
||||
}
|
||||
|
||||
public static boolean isUseAdasRecognize(){
|
||||
public static boolean isUseAdasRecognize() {
|
||||
return isUseAdasRecognize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -1044,7 +1045,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
//liyz
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -817,7 +818,7 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
//liyz
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -300,7 +301,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setAdasRecognizedResult(result);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@ import android.view.ViewGroup;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.autonavi.nge.map.LonLat;
|
||||
import com.mogo.commons.data.ADASRecognizedResultConvert;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
@@ -35,6 +33,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
@@ -288,15 +287,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
|
||||
}
|
||||
|
||||
private ADASRecognizedResultConvert mAdasResultConvert;
|
||||
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
Log.d("liyz", "------- setAdasRecognizedResult ------>result = " + result);
|
||||
mAdasResultConvert = GsonUtil.objectFromJson(result, ADASRecognizedResultConvert.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (checkAMapView()) {
|
||||
@@ -773,7 +763,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
if (mSelfMarker == null) { //TODO mAdasResultConvert
|
||||
// Log.d("liyz", "-------1------>");
|
||||
try {
|
||||
mSelfMarker = mMapView.getMapAutoViewHelper().getMyLocationStyle().getSelfMarker();
|
||||
mSelfMarker.setInfoWindowEnable(true);
|
||||
@@ -781,15 +770,28 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
} catch (Exception e) {
|
||||
}
|
||||
// } else {
|
||||
// Log.d("liyz", "-------2------>");
|
||||
// mSelfMarker.marker3DIcon(R.raw.people);
|
||||
// WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
// mSelfMarker.marker3DIcon(R.raw.people);
|
||||
// }, 10000);
|
||||
|
||||
// if (mAdasResult.type == 1) { //通过不同的方向类型来改变车模,目前暂定三种模型,还未定
|
||||
// Log.d("liyz", "-------1------>")
|
||||
// mSelfMarker.marker3DIcon(R.raw.people);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
showSelfSpeed(location.getSpeed());
|
||||
}
|
||||
|
||||
private ADASRecognizedResult mAdasResult;
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
mAdasResult = result;
|
||||
}
|
||||
|
||||
|
||||
private TextView mSpeedView = null;
|
||||
private int mLastYOffset = 20;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.zhidaoauto.map.sdk.open.MapAutoApi;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -359,7 +360,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
if (mClient != null) {
|
||||
mClient.setAdasRecognizedResult(result);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import androidx.annotation.Nullable;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -236,7 +237,7 @@ public interface IMogoMapUIController {
|
||||
*/
|
||||
void changeBearing( float bearing );
|
||||
|
||||
void setAdasRecognizedResult(String result);
|
||||
void setAdasRecognizedResult(ADASRecognizedResult result);
|
||||
|
||||
/**
|
||||
* 获取瓦片id
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import org.json.JSONObject;
|
||||
@@ -403,7 +404,7 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAdasRecognizedResult(String result) {
|
||||
public void setAdasRecognizedResult(ADASRecognizedResult result) {
|
||||
initDelegate();
|
||||
if (mDelegate != null) {
|
||||
mDelegate.setAdasRecognizedResult(result);
|
||||
|
||||
@@ -11,12 +11,12 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 实时坐标数据处理中心
|
||||
*/
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/12/14
|
||||
*
|
||||
* 实时坐标数据处理中心
|
||||
*/
|
||||
class SnapshotLocationController {
|
||||
|
||||
private static final String TAG = "SnapshotLocationController";
|
||||
@@ -27,9 +27,9 @@ class SnapshotLocationController {
|
||||
}
|
||||
|
||||
public static SnapshotLocationController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SnapshotLocationController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (SnapshotLocationController.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new SnapshotLocationController();
|
||||
}
|
||||
}
|
||||
@@ -44,10 +44,10 @@ class SnapshotLocationController {
|
||||
private CloudLocationInfo mLastLocationInfo = null;
|
||||
|
||||
// GPS(1s1次) RTK(OS侧)缓存数据,
|
||||
private final List< CloudLocationInfo > mLocationList = new ArrayList<>();
|
||||
private final List<CloudLocationInfo> mLocationList = new ArrayList<>();
|
||||
|
||||
// adda 工控机数据缓存
|
||||
private final List< CloudLocationInfo > mMachineCacheList = new ArrayList<>();
|
||||
private final List<CloudLocationInfo> mMachineCacheList = new ArrayList<>();
|
||||
|
||||
private int mDataAccuracy = 0;
|
||||
private double mCurSpeed;
|
||||
@@ -59,15 +59,15 @@ class SnapshotLocationController {
|
||||
*
|
||||
* @param cli {@link CloudLocationInfo}
|
||||
*/
|
||||
public void syncLocationInfo( CloudLocationInfo cli ) {
|
||||
if ( cli == null ) {
|
||||
public void syncLocationInfo(CloudLocationInfo cli) {
|
||||
if (cli == null) {
|
||||
return;
|
||||
}
|
||||
mLastLocationInfo = cli;
|
||||
mCurSpeed = cli.getSpeed();
|
||||
mCurLon = cli.getLon();
|
||||
mCurLat = cli.getLat();
|
||||
mLocationList.add( cli );
|
||||
mLocationList.add(cli);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,33 +75,39 @@ class SnapshotLocationController {
|
||||
*
|
||||
* @param data JSON结构化数据
|
||||
*/
|
||||
public void syncAdasLocationInfo( JSONObject data ) {
|
||||
if ( data == null ) {
|
||||
public void syncAdasLocationInfo(JSONObject data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
DebugConfig.setStatus( DebugConfig.sLocation, true );
|
||||
Logger.d( TAG, "同步到rtk数据" );
|
||||
double lon = data.optDouble( "lon", -1 );
|
||||
double lat = data.optDouble( "lat", -1 );
|
||||
double alt = data.optDouble( "alt", -1 );
|
||||
double heading = data.optDouble( "heading", -1 );
|
||||
double acceleration = data.optDouble( "acceleration", -1 );
|
||||
double yawRate = data.optDouble( "yawRate", -1 );
|
||||
double speed = data.optDouble( "speed", -1 );
|
||||
long satelliteTime = data.optLong( "satelliteTime" );
|
||||
long systemTime = data.optLong( "systemTime" );
|
||||
//测试面板状态同步
|
||||
DebugConfig.setStatus(DebugConfig.sLocation, true);
|
||||
|
||||
Logger.d(TAG, "同步到rtk数据");
|
||||
double lon = data.optDouble("lon", -1);
|
||||
double lat = data.optDouble("lat", -1);
|
||||
double alt = data.optDouble("alt", -1);
|
||||
double heading = data.optDouble("heading", -1);
|
||||
double acceleration = data.optDouble("acceleration", -1);
|
||||
double yawRate = data.optDouble("yawRate", -1);
|
||||
double speed = data.optDouble("speed", -1);
|
||||
long satelliteTime = data.optLong("satelliteTime");
|
||||
long systemTime = data.optLong("systemTime");
|
||||
|
||||
//测试面板状态同步
|
||||
DebugConfig.setStatusData(DebugConfig.sLon, lon);
|
||||
DebugConfig.setStatusData(DebugConfig.sLat, lat);
|
||||
|
||||
CloudLocationInfo cloudLocationInfo = new CloudLocationInfo();
|
||||
cloudLocationInfo.setAlt( alt );
|
||||
cloudLocationInfo.setHeading( heading );
|
||||
cloudLocationInfo.setLat( lat );
|
||||
cloudLocationInfo.setLon( lon );
|
||||
cloudLocationInfo.setSpeed( speed );
|
||||
cloudLocationInfo.setSatelliteTime( satelliteTime );
|
||||
cloudLocationInfo.setSystemTime( systemTime );
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon,lat)));
|
||||
cloudLocationInfo.setAlt(alt);
|
||||
cloudLocationInfo.setHeading(heading);
|
||||
cloudLocationInfo.setLat(lat);
|
||||
cloudLocationInfo.setLon(lon);
|
||||
cloudLocationInfo.setSpeed(speed);
|
||||
cloudLocationInfo.setSatelliteTime(satelliteTime);
|
||||
cloudLocationInfo.setSystemTime(systemTime);
|
||||
cloudLocationInfo.setTileId(String.valueOf(MogoApisHandler.getInstance().getApis().getMapServiceApi().getMapUIController().getTileId(lon, lat)));
|
||||
mLastLocationInfo = cloudLocationInfo;
|
||||
mMachineCacheList.add( cloudLocationInfo );
|
||||
mMachineCacheList.add(cloudLocationInfo);
|
||||
|
||||
mCurSpeed = cloudLocationInfo.getSpeed();
|
||||
mCurLon = cloudLocationInfo.getLon();
|
||||
@@ -113,29 +119,29 @@ class SnapshotLocationController {
|
||||
*
|
||||
* @return 坐标合集
|
||||
*/
|
||||
public List< CloudLocationInfo > getSendLocationData() {
|
||||
public List<CloudLocationInfo> getSendLocationData() {
|
||||
|
||||
List< CloudLocationInfo > list = null;
|
||||
if ( mMachineCacheList != null ) {
|
||||
List<CloudLocationInfo> list = null;
|
||||
if (mMachineCacheList != null) {
|
||||
mDataAccuracy = 1;
|
||||
list = new ArrayList<>( mMachineCacheList );
|
||||
list = new ArrayList<>(mMachineCacheList);
|
||||
mMachineCacheList.clear();
|
||||
}
|
||||
if ( list == null || list.isEmpty() ) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
mDataAccuracy = 0;
|
||||
if ( mLocationList != null ) {
|
||||
list = new ArrayList<>( mLocationList );
|
||||
if (mLocationList != null) {
|
||||
list = new ArrayList<>(mLocationList);
|
||||
mLocationList.clear();
|
||||
}
|
||||
}
|
||||
if ( list == null || list.isEmpty() ) {
|
||||
if ( mLastLocationInfo != null ) {
|
||||
if (list == null || list.isEmpty()) {
|
||||
if (mLastLocationInfo != null) {
|
||||
list = new ArrayList();
|
||||
list.add( mLastLocationInfo );
|
||||
list.add(mLastLocationInfo);
|
||||
mLastLocationInfo = null;
|
||||
}
|
||||
}
|
||||
Logger.d( TAG, "upload loc size = %s", list == null ? 0 : list.size() );
|
||||
Logger.d(TAG, "upload loc size = %s", list == null ? 0 : list.size());
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -145,7 +151,7 @@ class SnapshotLocationController {
|
||||
* @return 精度
|
||||
*/
|
||||
public int getDataAccuracy() {
|
||||
Logger.d( TAG, "upload loc accuracy = %s", mDataAccuracy );
|
||||
Logger.d(TAG, "upload loc accuracy = %s", mDataAccuracy);
|
||||
return mDataAccuracy;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = "/service/base/info" )
|
||||
@Route(path = "/service/base/info")
|
||||
class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
private static final String TAG = "MogoMainService";
|
||||
@@ -39,10 +39,10 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
Logger.d( TAG, "基本服务启动" );
|
||||
Logger.d(TAG, "基本服务启动");
|
||||
mServiceApis = MogoApisHandler.getInstance().getApis();
|
||||
initAndStartLocation();
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
loadBaseModules();
|
||||
startTanluService();
|
||||
initADAS();
|
||||
@@ -56,53 +56,61 @@ class MogoMainService extends Service implements IMogoLocationListener {
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind( Intent intent ) {
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand( Intent intent, int flags, int startId ) {
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private void initAndStartLocation() {
|
||||
Logger.d( TAG, "开始定位" );
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient( AbsMogoApplication.getApp() );
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start( 2_000L );
|
||||
Logger.d(TAG, "开始定位");
|
||||
if (mServiceApis != null) {
|
||||
mLocationClient = mServiceApis.getMapServiceApi().getSingletonLocationClient(AbsMogoApplication.getApp());
|
||||
mLocationClient.addLocationListener(this);
|
||||
mLocationClient.start(2_000L);
|
||||
}
|
||||
}
|
||||
|
||||
private void initGpsSimulatorListener() {
|
||||
mServiceApis.getMapServiceApi().getNavi( this ).registerCarLocationChangedListener( EventDispatchCenter.getInstance() );
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getMapServiceApi().getNavi(this).registerCarLocationChangedListener(EventDispatchCenter.getInstance());
|
||||
}
|
||||
}
|
||||
|
||||
private void loadBaseModules() {
|
||||
Logger.d( TAG, "加载基本模块" );
|
||||
Logger.d(TAG, "加载基本模块");
|
||||
MogoModulesManager.getInstance().loadBaseModule();
|
||||
}
|
||||
|
||||
private void startTanluService() {
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
Logger.d( TAG, "startTanluService ---------- " );
|
||||
mServiceApis.getTanluApi().startTanluService();
|
||||
UiThreadHandler.postDelayed(() -> {
|
||||
Logger.d(TAG, "startTanluService ---------- ");
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getTanluApi().startTanluService();
|
||||
}
|
||||
}, 2_000L
|
||||
);
|
||||
}
|
||||
|
||||
private void initADAS() {
|
||||
mServiceApis.getAdasControllerApi().init( AbsMogoApplication.getApp() );
|
||||
if (mServiceApis != null) {
|
||||
mServiceApis.getAdasControllerApi().init(AbsMogoApplication.getApp());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged( location );
|
||||
public void onLocationChanged(MogoLocation location) {
|
||||
EventDispatchCenter.getInstance().onLocationChanged(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
if ( mLocationClient != null ) {
|
||||
mLocationClient.removeLocationListener( this );
|
||||
if (mLocationClient != null) {
|
||||
mLocationClient.removeLocationListener(this);
|
||||
mLocationClient.stop();
|
||||
mLocationClient.destroy();
|
||||
mLocationClient = null;
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.MarkerDrawer;
|
||||
@@ -61,6 +62,7 @@ public class MarkerServiceHandler {
|
||||
private static IMogoFragmentManager sFragmentManager;
|
||||
private static ICarsChattingProvider sCarChatting;
|
||||
private static IV2XProvider sIV2XProvider;
|
||||
private static IMogoOverlayManager sIMogoOverlayManager;
|
||||
|
||||
// private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
|
||||
@@ -77,6 +79,7 @@ public class MarkerServiceHandler {
|
||||
sMogoSocketManager = sApis.getSocketManagerApi( context );
|
||||
sMogoAnalytics = sApis.getAnalyticsApi();
|
||||
sMarkerManager = sMapService.getMarkerManager( context );
|
||||
sIMogoOverlayManager = sMapService.getOverlayManager(context);
|
||||
sNavi = sMapService.getNavi( context );
|
||||
sMapUIController = sMapService.getMapUIController();
|
||||
sLocationClient = sMapService.getSingletonLocationClient( context );
|
||||
@@ -87,7 +90,6 @@ public class MarkerServiceHandler {
|
||||
sADASController = sApis.getAdasControllerApi();
|
||||
sLauncher = sApis.getLauncherApi();
|
||||
sFragmentManager = sApis.getFragmentManagerApi();
|
||||
|
||||
sCarChatting = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context );
|
||||
sIV2XProvider = sApis.getV2XListenerManager();
|
||||
|
||||
@@ -172,7 +174,15 @@ public class MarkerServiceHandler {
|
||||
return sCarChatting;
|
||||
}
|
||||
|
||||
// public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
public static IMogoOverlayManager getsIMogoOverlayManager() {
|
||||
return sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
public static void setsIMogoOverlayManager(IMogoOverlayManager sIMogoOverlayManager) {
|
||||
MarkerServiceHandler.sIMogoOverlayManager = sIMogoOverlayManager;
|
||||
}
|
||||
|
||||
// public static IMogoGpsSimulatorManager getGpsSimulatorManager() {
|
||||
// return sGpsSimulatorManager;
|
||||
// }
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,7 @@ import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -16,6 +17,7 @@ import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.ModuleNames;
|
||||
@@ -36,12 +38,15 @@ import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.common.utils.CloudPoiManager;
|
||||
import com.mogo.module.common.utils.Trigonometric;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.service.network.RefreshCallback;
|
||||
import com.mogo.module.service.network.RefreshModel;
|
||||
import com.mogo.module.service.polyline.LimberCollisionPolyline;
|
||||
import com.mogo.realtime.api.MoGoAiCloudRealTime;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.MogoSnapshotSetData;
|
||||
@@ -62,6 +67,7 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -161,24 +167,58 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
msg.sendToTarget();
|
||||
}
|
||||
} );
|
||||
|
||||
// adas 每隔一秒传递的数据
|
||||
MarkerServiceHandler.getApis().getAdasControllerApi().addAdasRecognizedDataCallback( resultList -> {
|
||||
// 绘制近景识别到的车辆
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
//绘制他车的线 liyz
|
||||
|
||||
//添加自车的定位图标,碰撞只有一个预警 TODO
|
||||
//添加自车的定位图标,碰撞只有一个预警,还需要和adas 联调,还需要改 liyz
|
||||
// ADASRecognizedResult result = null;
|
||||
// for (int i = 0; i < resultList.size(); i++) {
|
||||
// result = resultList.get(i);
|
||||
// if (result.type) { //找出可能碰撞的车
|
||||
// result = resultList.get(i);
|
||||
// }
|
||||
|
||||
//绘制他车的线,从列表中查出可能碰撞的车的经纬度(没有或者只有一个),然后预设20米的长度
|
||||
//绘制碰撞的他车指引线,需要实时给数据更新 TODO
|
||||
// drawLimberCollisionPolyline(result);
|
||||
// }
|
||||
//
|
||||
// //通过这个传值 ADASRecognizedResult
|
||||
// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(GsonUtil.jsonFromObject(result));
|
||||
|
||||
// //通过这个传值到 AMapViewWrapper,根据数据更新自车的模型数据 ADASRecognizedResult
|
||||
// MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().setAdasRecognizedResult(result);
|
||||
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时绘制连线
|
||||
* @param result
|
||||
*/
|
||||
private void drawLimberCollisionPolyline(ADASRecognizedResult result) {
|
||||
if (result != null) {
|
||||
IMogoPolyline polyLine = LimberCollisionPolyline.getInstance().getPolyLine();
|
||||
MogoLatLng startLatLng = new MogoLatLng(result.lat, result.lon);
|
||||
MogoLatLng endLatlng = Trigonometric.getNewLocation(startLatLng, 20, result.heading);
|
||||
Log.d(TAG, "红色区域起始点 = " + startLatLng.lon + "," + startLatLng.lat
|
||||
+ "终点" + endLatlng.lon + "," + endLatlng.lat + "--heading =" + result.heading);
|
||||
if (polyLine != null) {
|
||||
Log.d(TAG, "drawStopLine polyLine != null");
|
||||
polyLine.setPoints(Arrays.asList(startLatLng, endLatlng));
|
||||
} else {
|
||||
List<MogoLatLng> latLngs = new ArrayList<>();
|
||||
latLngs.add(startLatLng);
|
||||
latLngs.add(endLatlng);
|
||||
LimberCollisionPolyline.getInstance().draw((float) result.roadWidth, latLngs);
|
||||
}
|
||||
} else {
|
||||
LimberCollisionPolyline.getInstance().clearLine();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Handler mSnapshotHandler = new Handler( WorkThreadHandler.newInstance( "snapshot-thread" ).getLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.mogo.module.service.polyline;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 前车碰撞的画线
|
||||
* @since 2021/4/25
|
||||
*/
|
||||
public class LimberCollisionPolyline {
|
||||
|
||||
private volatile static LimberCollisionPolyline mInstance = null;
|
||||
|
||||
private IMogoPolyline mMoGoPolyline;
|
||||
// 连接线参数
|
||||
private MogoPolylineOptions mPolylineOptions;
|
||||
// 线路径集合
|
||||
private List<MogoLatLng> mPolylinePointList;
|
||||
|
||||
|
||||
public static LimberCollisionPolyline getInstance() {
|
||||
if (mInstance == null) {
|
||||
synchronized (LimberCollisionPolyline.class) {
|
||||
if (mInstance == null) {
|
||||
mInstance = new LimberCollisionPolyline();
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
protected LimberCollisionPolyline() {
|
||||
mPolylineOptions = new MogoPolylineOptions();
|
||||
// 绘制路径集合
|
||||
mPolylinePointList = new ArrayList<>();
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline draw(float width, List<MogoLatLng> polylinePoint) {
|
||||
try {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mPolylinePointList.clear();
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
// colors.add(0x0DE32F46);
|
||||
colors.add(0xD9E32F46);
|
||||
colors.add(0x0DE32F46);
|
||||
|
||||
// 线条粗细,渐变,渐变色值 TODO liyz 宽度需要传过来
|
||||
options.width(60).useGradient(true).colorValues(colors);
|
||||
for (int i = 0; i < polylinePoint.size(); i++) {
|
||||
options.add(polylinePoint.get(i));
|
||||
}
|
||||
// 绘制线的对象
|
||||
mMoGoPolyline = MarkerServiceHandler.getsIMogoOverlayManager().addPolyline(options);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
|
||||
public IMogoPolyline getPolyLine() {
|
||||
return mMoGoPolyline;
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMoGoPolyline != null) {
|
||||
mMoGoPolyline.remove();
|
||||
mMoGoPolyline = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
public
|
||||
/**
|
||||
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2021/3/17
|
||||
*
|
||||
* 环境状态
|
||||
*/
|
||||
class EnvStatusManager {
|
||||
public class EnvStatusManager {
|
||||
|
||||
private static volatile EnvStatusManager sInstance;
|
||||
|
||||
@@ -30,9 +30,9 @@ class EnvStatusManager {
|
||||
}
|
||||
|
||||
public static EnvStatusManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( EnvStatusManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (EnvStatusManager.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new EnvStatusManager();
|
||||
}
|
||||
}
|
||||
@@ -51,13 +51,13 @@ class EnvStatusManager {
|
||||
|
||||
private WindowManagerView mPanelView;
|
||||
private TextView mStatusTv;
|
||||
private Handler mMainHandler = new Handler( Looper.getMainLooper() ) {
|
||||
private final Handler mMainHandler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( mPanelView.isShowing() ) {
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (mPanelView.isShowing()) {
|
||||
renderStatus();
|
||||
mMainHandler.sendEmptyMessageDelayed( MSG, 5_000L );
|
||||
mMainHandler.sendEmptyMessageDelayed(MSG, 5_000L);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -69,54 +69,54 @@ class EnvStatusManager {
|
||||
"近景",
|
||||
"下发",
|
||||
"AUTO",
|
||||
"长链"
|
||||
"长链",
|
||||
"经度",
|
||||
"纬度"
|
||||
};
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for ( int i = 0; i < sStatusName.length; i++ ) {
|
||||
stringBuilder.append( sStatusName[i] ).append( ":" );
|
||||
if ( i != 3 ) {
|
||||
stringBuilder.append( "true".equals( DebugConfig.getStatus( i, true ) ) ? "正常" : "异常" ).append( "\n" );
|
||||
for (int i = 0; i < sStatusName.length; i++) {
|
||||
stringBuilder.append(sStatusName[i]).append(":");
|
||||
if (i == 3) {
|
||||
stringBuilder.append(DebugConfig.getAutoPilotStatus()).append("\n");
|
||||
} else if (i == 5 || i == 6) {
|
||||
stringBuilder.append(DebugConfig.getStatusData(i)).append("\n");
|
||||
} else {
|
||||
stringBuilder.append( DebugConfig.getAutoPilotStatus() ).append( "\n" );
|
||||
stringBuilder.append("true".equals(DebugConfig.getStatus(i, true)) ? "正常" : "异常").append("\n");
|
||||
}
|
||||
}
|
||||
mStatusTv.setText( stringBuilder );
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mStatusTv.setTextColor( Color.WHITE );
|
||||
mStatusTv.setText(stringBuilder);
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
mStatusTv.setTextColor(Color.WHITE);
|
||||
} else {
|
||||
if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi()
|
||||
.getCurrentSkinMode() == EnumMapUI.Type_Light ) {
|
||||
mStatusTv.setTextColor( Color.BLACK );
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi()
|
||||
.getCurrentSkinMode() == EnumMapUI.Type_Light) {
|
||||
mStatusTv.setTextColor(Color.BLACK);
|
||||
} else {
|
||||
mStatusTv.setTextColor( Color.WHITE );
|
||||
mStatusTv.setTextColor(Color.WHITE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showPanel( Context context ) {
|
||||
if ( mPanelView == null ) {
|
||||
mPanelView = new WindowManagerView.Builder( context )
|
||||
.contentView( R.layout.module_services_status_panel )
|
||||
.position( 0, 100 )
|
||||
.size( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT )
|
||||
.gravity( Gravity.TOP )
|
||||
public void showPanel(Context context) {
|
||||
if (mPanelView == null) {
|
||||
mPanelView = new WindowManagerView.Builder(context)
|
||||
.contentView(R.layout.module_services_status_panel)
|
||||
.position(0, 100)
|
||||
.size(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
.gravity(Gravity.TOP)
|
||||
.showInWindowManager();
|
||||
mPanelView.attachTouchEvent( ( ( view, xPos, yPos ) -> {
|
||||
closePanel();
|
||||
} ) );
|
||||
mPanelView.findViewById( R.id.module_services_status_iv ).setOnClickListener( view -> {
|
||||
closePanel();
|
||||
} );
|
||||
mStatusTv = mPanelView.findViewById( R.id.module_services_status_tv );
|
||||
mPanelView.attachTouchEvent(((view, xPos, yPos) -> closePanel()));
|
||||
mPanelView.findViewById(R.id.module_services_status_iv).setOnClickListener(view -> closePanel());
|
||||
mStatusTv = mPanelView.findViewById(R.id.module_services_status_tv);
|
||||
}
|
||||
mPanelView.show();
|
||||
mMainHandler.sendEmptyMessageDelayed( MSG, 0L );
|
||||
mMainHandler.sendEmptyMessageDelayed(MSG, 0L);
|
||||
}
|
||||
|
||||
public void closePanel() {
|
||||
if ( mPanelView != null ) {
|
||||
if (mPanelView != null) {
|
||||
mPanelView.dismiss();
|
||||
mMainHandler.removeMessages( MSG );
|
||||
mMainHandler.removeMessages(MSG);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
|
||||
*/
|
||||
public class V2XWaringManager {
|
||||
|
||||
List<MogoLatLng> lonLats = new ArrayList<>();
|
||||
private Context mContext;
|
||||
|
||||
private static V2XWaringManager mV2XWaringManager;
|
||||
@@ -111,7 +110,6 @@ public class V2XWaringManager {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,43 +149,6 @@ public class V2XWaringManager {
|
||||
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
//测试数据
|
||||
testData(adasResult);
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据,避免重复。
|
||||
// V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
|
||||
// // 处理他车车身变色,这个可以使用 TODO
|
||||
// AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
//
|
||||
// // adas自车定位,显示红色碰撞预警图,以及解除碰撞
|
||||
// double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
|
||||
// double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
|
||||
// //需要把自车的经纬度前移到车头,然后打点红色的marker
|
||||
//
|
||||
// } );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加2d的碰撞 marker
|
||||
*
|
||||
* @param markerShowEntity
|
||||
* @return
|
||||
*/
|
||||
private IMogoMarker drawMarker2dResource(MarkerShowEntity markerShowEntity) {
|
||||
MogoLatLng mogoLatLng = new MogoLatLng(markerShowEntity.getMarkerLocation().getLat(), markerShowEntity.getMarkerLocation().getLon());
|
||||
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 8, 180);
|
||||
MogoMarkerOptions optionsRipple = new MogoMarkerOptions()
|
||||
.latitude(newLocation.getLat())
|
||||
.longitude(newLocation.getLon())
|
||||
.anchor(1.0f, 1.0f)
|
||||
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
|
||||
optionsRipple
|
||||
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
|
||||
IMogoMarker marker = MogoApisHandler.getInstance().getApis().getMapServiceApi().getMarkerManager(mContext).addMarker(markerShowEntity.getMarkerType(), optionsRipple);
|
||||
|
||||
marker.setInfoWindowAdapter(new AheadCollisionWindow3DAdapter(mContext));
|
||||
marker.showInfoWindow();
|
||||
return marker;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user