Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk

This commit is contained in:
wangcongtao
2021-03-30 18:37:23 +08:00
10 changed files with 269 additions and 24 deletions

View File

@@ -242,6 +242,8 @@ public class AMapWrapper implements IMogoMap {
}
}
return 0;
}
@Override

View File

@@ -37,6 +37,12 @@ public class MoGoV2XServicePaths {
@Keep
public static final String PATH_V2X_WARN_POLYLINE_MANAGER = "/v2xWarnPolylineManager/api";
/**
* V2X 云端数据处理
*/
@Keep
public static final String PATH_V2X_WARN_CLOUND_DATA_MANAGER = "/v2xWarnCloundDataManager/api";
}

View File

@@ -16,10 +16,12 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.v2x.alarm.V2XCalculateServer;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
import com.mogo.module.v2x.manager.impl.MoGoV2XCloundDataManager;
import com.mogo.module.v2x.network.V2XRefreshModel;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.realtime.entity.ADASRecognizedResult;
@@ -108,7 +110,7 @@ public class V2XServiceManager {
private static IMoGoV2XPolylineManager moGoV2XPolylineManager;
private static IMoGoV2XStatusManager moGoV2XStatusManager;
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
private static IMoGoV2XCloundDataManager moGoV2XCloundDataManager;
private V2XServiceManager() {
@@ -161,6 +163,7 @@ public class V2XServiceManager {
moGoV2XMarkerManager = (IMoGoV2XMarkerManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context);
moGoV2XPolylineManager = (IMoGoV2XPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context);
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
moGoV2XCloundDataManager = (IMoGoV2XCloundDataManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER).navigation(context);
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
}
@@ -321,4 +324,12 @@ public class V2XServiceManager {
public static void setmIMogoADASController(IMogoADASController mIMogoADASController) {
V2XServiceManager.mIMogoADASController = mIMogoADASController;
}
public static IMoGoV2XCloundDataManager getMoGoV2XCloundDataManager() {
return moGoV2XCloundDataManager;
}
public static void setMoGoV2XCloundDataManager(IMoGoV2XCloundDataManager moGoV2XCloundDataManager) {
V2XServiceManager.moGoV2XCloundDataManager = moGoV2XCloundDataManager;
}
}

View File

@@ -9,6 +9,7 @@ import com.mogo.module.common.MogoApisHandler;
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
import com.mogo.module.v2x.listener.V2XWarnMessageListener;
import com.mogo.realtime.entity.ADASRecognizedResult;
import com.mogo.utils.logger.Logger;
@@ -28,7 +29,7 @@ public class V2XWaringManager {
private static V2XWaringManager mV2XWaringManager;
//TODO 需要修改
private V2XMessageListener_401011 v2XMessageListener_401011;
private V2XWarnMessageListener v2XWarnMessageListener;
private V2XWaringManager() {
@@ -53,7 +54,9 @@ public class V2XWaringManager {
Logger.d("liyz", "开始注册Socket通道....");
mContext = context;
register401011();
//根据云端,绘制自车和交点,以及行人或二轮车与交点的绘制
registerWarnListener();
handleAdasData();
}
@@ -62,29 +65,28 @@ public class V2XWaringManager {
*/
public void unregisterAdasSocketMessage() {
Logger.w("liyz", "反注册Socket通道....");
if (v2XMessageListener_401011 != null) {
if (v2XWarnMessageListener != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401011, v2XMessageListener_401011);
.unregisterOnMessageListener(401011, v2XWarnMessageListener);
}
}
/**
* 道路事件,行人
* 道路事件,行人 TODO type
*/
private void register401011() {
v2XMessageListener_401011 = new V2XMessageListener_401011();
private void registerWarnListener() {
v2XWarnMessageListener = new V2XWarnMessageListener();
// 道路事件,在线车辆绘制
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401011,
v2XMessageListener_401011
);
v2XWarnMessageListener );
}
public V2XMessageListener_401011 getV2XMessageListener_401011() {
return v2XMessageListener_401011;
public V2XWarnMessageListener getV2XMessageListener() {
return v2XWarnMessageListener;
}
@@ -99,12 +101,11 @@ public class V2XWaringManager {
// 绘制连接线 TODO 来的是列表数据
DrawLineInfo info1 = new DrawLineInfo();
MogoLatLng startLatlng1 = new MogoLatLng(39.968919,116.407642);
MogoLatLng endLatlng1 = new MogoLatLng(39.977173,116.417555);
MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821);
info1.setStartLocation(startLatlng1);
info1.setEndLocation(endLatlng1);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
// adas 每隔一秒传递的他车或行人数据
V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
// 绘制近景识别到的车辆,行人和二轮车 TODO

View File

@@ -0,0 +1,108 @@
package com.mogo.module.v2x.entity.model;
import com.mogo.map.MogoLatLng;
/**
* @author lixiaopeng
* @description 云端警告下发数据(二轮车和弱势群体)
* @since 2021/3/30
*/
public class CloundWarningInfo {
/**
* 识别物体类型
*/
public int type;
/**
* 提示信息
*/
public String warningContent;
/**
* 道路唯一标识
*/
public String roadId;
/**
* 车道唯一标识
*/
public String laneId;
/**
* 识别物体唯一标识
*/
public String uuid;
/**
* 红绿灯颜色
*/
public String color;
/**
* 车ID 暂不使用
*/
public String carId;
/**
* 识别物体的纬度
*/
public double lat;
/**
* 识别物体的经度
*/
public double lon;
/**
* 识别物经纬度
* */
private MogoLatLng startLocation;
/**
* 行人经纬度交点
*/
private MogoLatLng endLocation;
/**
* 停止线的纬度
*/
public double stopLinelat;
/**
* 停止线的经度
*/
public double stopLinelon;
/**
* 车头朝向
*/
public double heading;
/**
* 系统时间 暂时没用
*/
public long systemTime;
/**
* 定位卫星时间 暂时没用
*/
public long satelliteTime;
/**
* 速度 暂时没用
*/
public double speed;
/**
* 莫顿码 暂时没用
*/
public long mortonCode;
/**
* 停车线距离
*/
public double distance;
}

View File

@@ -18,6 +18,8 @@ public class DrawLineInfo {
//结束点位置
private MogoLatLng endLocation;
private double heading;
public String getType() {
return type;
}
@@ -41,4 +43,12 @@ public class DrawLineInfo {
public void setEndLocation(MogoLatLng endLocation) {
this.endLocation = endLocation;
}
public double getHeading() {
return heading;
}
public void setHeading(double heading) {
this.heading = heading;
}
}

View File

@@ -0,0 +1,31 @@
package com.mogo.module.v2x.listener;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.connection.IMogoOnMessageListener;
/**
* desc: 下发的云端预警数据
*/
public class V2XWarnMessageListener implements IMogoOnMessageListener<CloundWarningInfo> {
@Override
public Class<CloundWarningInfo> target() {
return CloundWarningInfo.class;
}
@Override
public void onMsgReceived(CloundWarningInfo info) {
//Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新\n" + GsonUtil.jsonFromObject(response));
V2XUtils.runOnBackgroundThread(() -> {
// 解析不同的Marker类型然后对应的进行绘制
if (info != null) {
// 解析存储道路事件 liyz
V2XServiceManager.getMoGoV2XCloundDataManager().analysisV2XCloundDataEvent(info);
}
});
}
}

View File

@@ -0,0 +1,21 @@
package com.mogo.module.v2x.manager;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
/**
* desc: V2X 处理云端预警消息
*/
public interface IMoGoV2XCloundDataManager extends IProvider {
/**
* 处理下发数据
*/
void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo);
/**
* 清除 所有的 POI
*/
void clearALLPOI();
}

View File

@@ -0,0 +1,58 @@
package com.mogo.module.v2x.manager.impl;
import android.content.Context;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.MogoLatLng;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.CloundWarningInfo;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import static com.mogo.module.v2x.V2XServiceManager.getContext;
/**
* desc : V2X 服务端下发数据处理 点的绘制
*/
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_CLOUND_DATA_MANAGER)
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager {
private static final String TAG = "MoGoV2XCloundDataManager";
@Override
public void init(Context context) {
}
@Override
public void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo) {
//TODO
//清理
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
//绘制连接线自车与交汇点连线
DrawLineInfo info1 = new DrawLineInfo();
MogoLatLng startLatlng1 = new MogoLatLng(39.968919,116.407642);
MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821);
info1.setStartLocation(startLatlng1);
info1.setEndLocation(endLatlng1);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
//绘制识别物与交汇点连线 TODO
//更新数据连线数据 他车和自车
//自车的移动
//他车的移动
}
@Override
public void clearALLPOI() {
}
}

View File

@@ -39,16 +39,13 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 渐变色
List<Integer> colors = new ArrayList<>();
// if (info.getType().equals("1")) { //预警 TODO
// colors.add(0xFFFFA31A);
// colors.add(0xFFFFA31A);
// } else {
// colors.add(0xFFE32F46);
// colors.add(0xFFE32F46);
// }
colors.add(0xFF3036);
colors.add(0xFF3036);
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
} else {
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
// 线条粗细,渐变,渐变色值
options.width(60).useGradient(true).colorValues(colors);