This commit is contained in:
zhongchao
2021-04-01 10:57:55 +08:00
57 changed files with 884 additions and 223 deletions

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_PERSON_WARN_POLYLINE_MANAGER = "/v2xPersonWarnPolylineManager/api";
/**
* V2X 云端数据处理
*/

View File

@@ -145,4 +145,9 @@ public class V2XConst {
* */
public static final String V2X_FRONT_WARNING_MARKER = "V2X_FRONT_WARNING_MARKER";
/**
* V2X预警日志tag
*/
public static final String LOG_NAME_WARN = "liyz";
}

View File

@@ -92,6 +92,7 @@ public class V2XMarkerService implements V2XRefreshCallback<MarkerResponse> {
// 设置地图定位监听
V2XServiceManager.getMogoRegisterCenter()
.registerMogoLocationListener(MODULE_NAME, V2XLocationListener.getInstance());
V2XServiceManager.getMogoRegisterCenter().registerCarLocationChangedListener( MODULE_NAME, V2XLocationListener.getInstance());
Logger.d(MODULE_NAME, "V2X道路事件开启V2X地图气泡自动绘制。");
if (refreshHandler == null) {

View File

@@ -303,7 +303,7 @@ public class V2XModuleProvider implements
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
V2XServiceManager.getMapUIController().recoverLockMode();
Log.d("liyz", "V2XModuleProvider ------> ");
Log.d(V2XConst.LOG_NAME_WARN, "V2XModuleProvider ------> ");
//注册adas数据通道
V2XWaringManager.getInstance().registerAdasSocketMessage(mContext);
}

View File

@@ -16,6 +16,7 @@ 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.IMoGoPersonWarnPolylineManager;
import com.mogo.module.v2x.manager.IMoGoV2XCloundDataManager;
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
@@ -45,6 +46,7 @@ import com.mogo.service.share.IMogoTrafficUploadProvider;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
import com.mogo.service.strategy.IMogoRefreshStrategyController;
import com.mogo.service.v2x.DisplayEffectsInterface;
import com.mogo.service.windowview.IMogoTopViewManager;
import com.mogo.service.windowview.IMogoWindowManager;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
@@ -76,6 +78,7 @@ public class V2XServiceManager {
private static IMogoGeoSearch mIMogoGeoSearch;
private static IMogoSearchManager mIMogoSearchManager;
private static IMogoTopViewManager mMogoTopViewManager;
private static DisplayEffectsInterface displayEffectsManager;
private static IMogoStatusManager mMogoStatusManager;
private static IMogoWindowManager mIMogoWindowManager;
private static IMogoImageloader mImageLoader;
@@ -110,6 +113,7 @@ public class V2XServiceManager {
private static IMoGoV2XPolylineManager moGoV2XPolylineManager;
private static IMoGoV2XStatusManager moGoV2XStatusManager;
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
private static IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager;
private static IMoGoV2XCloundDataManager moGoV2XCloundDataManager;
private V2XServiceManager() {
@@ -135,6 +139,7 @@ public class V2XServiceManager {
mMogoEntranceButtonController = mMogoServiceApis.getEntranceButtonController();
mMogoActionManager = mMogoServiceApis.getActionManagerApi();
mMogoTopViewManager = mMogoServiceApis.getTopViewManager();
displayEffectsManager = mMogoServiceApis.getDisplayEffectsManager();
mIMogoSearchManager = mMogoServiceApis.getSearchManagerApi();
mIMogoMarkerService = mMogoServiceApis.getMarkerService();
mIMogoShareManager = mMogoServiceApis.getShareManager();
@@ -164,6 +169,7 @@ public class V2XServiceManager {
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);
moGoPersonWarnPolylineManager = (IMoGoPersonWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER).navigation(context);
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
}
@@ -178,6 +184,10 @@ public class V2XServiceManager {
return mMogoTopViewManager;
}
public static DisplayEffectsInterface getDisplayEffectsManager(){
return displayEffectsManager;
}
public static IMogoEntranceButtonController getMogoEntranceButtonController() {
return mMogoEntranceButtonController;
}
@@ -332,4 +342,13 @@ public class V2XServiceManager {
public static void setMoGoV2XCloundDataManager(IMoGoV2XCloundDataManager moGoV2XCloundDataManager) {
V2XServiceManager.moGoV2XCloundDataManager = moGoV2XCloundDataManager;
}
public static IMoGoPersonWarnPolylineManager getMoGoPersonWarnPolylineManager() {
return moGoPersonWarnPolylineManager;
}
public static void setMoGoPersonWarnPolylineManager(IMoGoPersonWarnPolylineManager moGoPersonWarnPolylineManager) {
V2XServiceManager.moGoPersonWarnPolylineManager = moGoPersonWarnPolylineManager;
}
}

View File

@@ -24,7 +24,6 @@ import static com.mogo.module.v2x.V2XServiceManager.getContext;
public class V2XWaringManager {
List<MogoLatLng> lonLats = new ArrayList<>();
List<ADASRecognizedResult> resultList = new ArrayList<>();
private Context mContext;
private static V2XWaringManager mV2XWaringManager;
@@ -51,7 +50,7 @@ public class V2XWaringManager {
* 注册长链接消息处理
*/
public void registerAdasSocketMessage(Context context) {
Logger.d("liyz", "开始注册Socket通道....");
Logger.d(V2XConst.LOG_NAME_WARN, "开始注册Socket通道....");
mContext = context;
//根据云端,绘制自车和交点,以及行人或二轮车与交点的绘制
@@ -64,7 +63,7 @@ public class V2XWaringManager {
* 反注册消息通道,不再进行接受
*/
public void unregisterAdasSocketMessage() {
Logger.w("liyz", "反注册Socket通道....");
Logger.w(V2XConst.LOG_NAME_WARN, "反注册Socket通道....");
if (v2XWarnMessageListener != null) {
V2XServiceManager
.getMoGoSocketManager()
@@ -94,9 +93,7 @@ public class V2XWaringManager {
* 处理adas返回的数据
*/
private void handleAdasData() {
Log.d("liyz", "V2XWaringManager ---- handleAdasData ---0-- ");
//清理
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
Log.d(V2XConst.LOG_NAME_WARN, "V2XWaringManager ---- handleAdasData ");
// 绘制连接线 TODO 来的是列表数据
DrawLineInfo info1 = new DrawLineInfo();
@@ -104,13 +101,12 @@ public class V2XWaringManager {
MogoLatLng endLatlng1 = new MogoLatLng(40.010906,116.423821);
info1.setStartLocation(startLatlng1);
info1.setEndLocation(endLatlng1);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(getContext(), info1);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info1);
// adas 每隔一秒传递的他车或行人数据
V2XServiceManager.getmIMogoADASController().addAdasRecognizedDataCallback(resultList -> {
// 绘制近景识别到的车辆,行人和二轮车 TODO
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
Log.d("liyz", "V2XWaringManager ---- handleAdasData ----- ");
//清理
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
@@ -121,7 +117,7 @@ public class V2XWaringManager {
MogoLatLng endLatlng = new MogoLatLng(39.971089,116.407384);
info.setStartLocation(startLatlng);
info.setEndLocation(endLatlng);
V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(mContext, info);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, info);
//更新数据
for (ADASRecognizedResult result : resultList) {
@@ -135,7 +131,7 @@ public class V2XWaringManager {
double lon = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLon();
double lat = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getLastLat();
Log.d("liyz", "lon = " + lon + "----lat = " + lat);
Log.d(V2XConst.LOG_NAME_WARN, "lon = " + lon + "----lat = " + lat);
//绘制自车数据 liyz
// DrawLineInfo info = new DrawLineInfo();

View File

@@ -25,8 +25,11 @@ import com.mogo.module.common.entity.MarkerUserInfo;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.module.service.MarkerServiceHandler;
import com.mogo.module.service.receiver.MogoReceiver;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
@@ -55,6 +58,7 @@ import java.util.List;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
@@ -269,6 +273,11 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
}
ivEvent.setImageResource(EventTypeUtils.getPoiTypeSrcVr(mNoveltyInfo.getPoiType()));
tvEvent.setText(EventTypeUtils.getPoiTypeStrVr(mNoveltyInfo.getPoiType()));
if (mNoveltyInfo.getPoiType() == V2XPoiTypeEnum.FOURS_FOG) {
}
V2XServiceManager.getDisplayEffectsManager().displayEffects(V2XPoiTypeEnum.FOURS_FOG);
// MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(ALERT_THE_FRONT_CRASH_WARNING_TOP, MogoReceiver.ACTION_V2X_FRONT_WARNING);
tvEventAddress.setText(mNoveltyInfo.getAddr());
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "");

View File

@@ -58,12 +58,12 @@ public class CloundWarningInfo {
/**
* 识别物经纬度
* */
private MogoLatLng startLocation;
public MogoLatLng startLocation;
/**
* 行人经纬度交点
*/
private MogoLatLng endLocation;
public MogoLatLng endLocation;
/**
* 停止线的纬度

View File

@@ -1,11 +1,13 @@
package com.mogo.module.v2x.listener;
import android.content.Context;
import android.location.Location;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.IMogoLocationListener;
import com.mogo.map.location.MogoLocation;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.search.geo.IMogoGeoSearchListener;
import com.mogo.map.search.geo.MogoGeocodeResult;
@@ -48,7 +50,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : V2X中用到的位置监听。处理刷新频率以及位置改变是否触发道路事件警报
* version: 1.0
*/
public class V2XLocationListener implements IMogoLocationListener, CarStatusListener {
public class V2XLocationListener implements IMogoLocationListener, CarStatusListener, IMogoCarLocationChangedListener2 {
private String TAG = "V2XLocationListener";
private MogoLocation mLastCarLocation;
@@ -71,8 +73,31 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
return mV2XLocationListener;
}
@Override
public void onCarLocationChanged( MogoLatLng latLng ) {
// do not impl
}
@Override
public void onCarLocationChanged2( Location location ) {
MogoLocation loc = new MogoLocation();
loc.setTime( loc.getTime());
loc.setAccuracy( location.getAccuracy() );
loc.setSpeed( location.getSpeed());
loc.setLongitude( location.getLongitude() );
loc.setLatitude( location.getLatitude() );
loc.setAltitude( location.getAltitude() );
loc.setBearing( location.getBearing() );
loc.setProvider( location.getProvider() );
// onLocationChangedImpl( loc );
}
@Override
public void onLocationChanged(MogoLocation location) {
onLocationChangedImpl(location);
}
private void onLocationChangedImpl(MogoLocation location){
try {
//Logger.d(V2XConst.MODULE_NAME, "V2X预警--onLocationChanged: " + GsonUtil.jsonFromObject(location));
// 刷新角度

View File

@@ -0,0 +1,21 @@
package com.mogo.module.v2x.listener;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.service.connection.IMogoOnMessageListener;
/**
* @author liujing
* @description 车路云—场景预警-云下发数据监听 前车/行人/摩托车/盲区碰撞预警
* @since: 2021/3/31
*/
public class V2XMessageListener_401013 implements IMogoOnMessageListener<V2XWarningEntity> {
@Override
public Class target() {
return null;
}
@Override
public void onMsgReceived(V2XWarningEntity obj) {
}
}

View File

@@ -1,22 +1,22 @@
package com.mogo.module.v2x.listener;
import com.mogo.module.common.entity.V2XWarningEntity;
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> {
public class V2XWarnMessageListener implements IMogoOnMessageListener<V2XWarningEntity> {
@Override
public Class<CloundWarningInfo> target() {
return CloundWarningInfo.class;
public Class<V2XWarningEntity> target() {
return V2XWarningEntity.class;
}
@Override
public void onMsgReceived(CloundWarningInfo info) {
public void onMsgReceived(V2XWarningEntity info) {
//Logger.d(MODULE_NAME, "V2XMessageListener_401011==V2X地图气泡数据刷新\n" + GsonUtil.jsonFromObject(response));
V2XUtils.runOnBackgroundThread(() -> {
// 解析不同的Marker类型然后对应的进行绘制

View File

@@ -0,0 +1,27 @@
package com.mogo.module.v2x.manager;
import android.content.Context;
import com.alibaba.android.arouter.facade.template.IProvider;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
/**
* 绘制可变宽度和渐变的线,
*/
public interface IMoGoPersonWarnPolylineManager extends IProvider {
/**
* 绘制连接线,人物和二轮车
*
* @param context
* @param info
*/
void drawPersonWarnPolyline(Context context, DrawLineInfo info);
/**
* 移除连接线
*/
void clearLine();
IMogoPolyline getMogoPersonWarnPolyline();
}

View File

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

View File

@@ -18,7 +18,7 @@ public interface IMoGoWarnPolylineManager extends IProvider {
* @param context
* @param info
*/
void drawableWarnPolyline(Context context, DrawLineInfo info);
void drawWarnPolyline(Context context, DrawLineInfo info);
/**
* 移除连接线

View File

@@ -0,0 +1,87 @@
package com.mogo.module.v2x.manager.impl;
import android.content.Context;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoPersonWarnPolylineManager;
import java.util.ArrayList;
import java.util.List;
/**
* 当前车辆与道路事件的连接线
*/
@Route(path = MoGoV2XServicePaths.PATH_V2X_PERSON_WARN_POLYLINE_MANAGER)
public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineManager {
private static IMogoPolyline mMogoPolyline;
@Override
public void drawPersonWarnPolyline(Context context, DrawLineInfo info) {
try {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
}
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
info.getStartLocation().lat, (float) info.getHeading(), true, true);
// 渐变色
List<Integer> colors = new ArrayList<>();
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
} else {
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
// 线条粗细,渐变,渐变色值
Log.d(V2XConst.LOG_NAME_WARN, "MoGoPersonWarnPolylineManager roadWidth = " + roadWidth);
options.width(roadWidth).useGradient(true).colorValues(colors);
// options.width(60).useGradient(true).colorValues(colors);
// 当前车辆位置
options.add(info.getStartLocation());
// 目标车辆位置
options.add(info.getEndLocation());
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void clearLine() {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
mMogoPolyline = null;
}
}
@Override
public void init(Context context) {
}
/**
* @return 绘制连接线的对象
*/
@Override
public IMogoPolyline getMogoPersonWarnPolyline() {
return mMogoPolyline;
}
}

View File

@@ -1,23 +1,31 @@
package com.mogo.module.v2x.manager.impl;
import android.content.Context;
import android.location.Location;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoCarLocationChangedListener2;
import com.mogo.map.overlay.IMogoPolyline;
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
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 java.util.Arrays;
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";
public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMogoCarLocationChangedListener2 {
private V2XWarningEntity mCloundWarningInfo;
@Override
public void init(Context context) {
@@ -25,29 +33,43 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager {
}
@Override
public void analysisV2XCloundDataEvent(CloundWarningInfo cloundWarningInfo) {
//TODO
//清理
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
public void analysisV2XCloundDataEvent(V2XWarningEntity cloundWarningInfo) {
mCloundWarningInfo = cloundWarningInfo;
//绘制连接线自车与交汇点连线
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 根据判断条件,决定是否画线或者删除线
//绘制识别物与交汇点连线 TODO
//绘制识别物与交汇点连线,并且更新连线数据
drawOtherObjectLine(cloundWarningInfo);
//二轮车和行人的移动和渲染
// SnapshotSetDataDrawer.getInstance().renderSnapshotData();
//更新数据连线数据 他车和自车
}
//自车的移动
//他车的移动
/**
* 绘制行人和二轮车连线,并且更新数据
*/
private void drawOtherObjectLine(V2XWarningEntity info) {
IMogoPolyline polyLine = V2XServiceManager.getMoGoPersonWarnPolylineManager().getMogoPersonWarnPolyline();
if (info != null) {
if (polyLine != null) {
polyLine.setPoints(Arrays.asList(new MogoLatLng(info.getLat(), info.getLon()),
new MogoLatLng(info.getCollisionLat(), info.getCollisionLon())));
} else {
DrawLineInfo lineInfo = new DrawLineInfo();
// MogoLatLng startLatlng = new MogoLatLng(39.968919,116.407642);
// MogoLatLng endLatlng = new MogoLatLng(40.010906,116.423821);
MogoLatLng startLatlng = new MogoLatLng(info.getLat(), info.getLon());
MogoLatLng endLatlng = new MogoLatLng(info.getCollisionLat(), info.getCollisionLon());
lineInfo.setStartLocation(startLatlng);
lineInfo.setEndLocation(endLatlng);
lineInfo.setHeading(info.heading);
V2XServiceManager.getMoGoPersonWarnPolylineManager().drawPersonWarnPolyline(getContext(), lineInfo);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "mCloundWarningInfo == null");
V2XServiceManager.getMoGoPersonWarnPolylineManager().clearLine();
}
}
@@ -55,4 +77,43 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager {
public void clearALLPOI() {
}
/**
* 自车定位 移动完成需要 3s消失 TODO
*/
@Override
public void onCarLocationChanged2(Location latLng) {
Log.d(V2XConst.LOG_NAME_WARN, "latLng = " + latLng.getLatitude() + "--" + latLng.getLongitude());
//当行人经纬度交点 经纬度不为空,开始画线,否则清理
//自车只需要关注移动
IMogoPolyline mogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
if (mCloundWarningInfo != null) {
if (mogoPolyline != null) {
mogoPolyline.setPoints(Arrays.asList(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()),
new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon())));
} else {
Log.e(V2XConst.LOG_NAME_WARN, "V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline() == null");
DrawLineInfo info = new DrawLineInfo(); // 对象 TODO
// MogoLatLng startLatlng = new MogoLatLng(39.968919, 116.407642);
// MogoLatLng endLatlng = new MogoLatLng(40.010906, 116.423821);
MogoLatLng startLatlng = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
MogoLatLng endLatlng = new MogoLatLng(mCloundWarningInfo.getCollisionLat(), mCloundWarningInfo.getCollisionLon());
info.setHeading(latLng.getBearing());
info.setStartLocation(startLatlng);
info.setEndLocation(endLatlng);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(getContext(), info);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "mCloundWarningInfo == null");
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
}
}
@Override
public void onCarLocationChanged(MogoLatLng latLng) {
}
}

View File

@@ -10,6 +10,7 @@ import com.mogo.map.overlay.MogoPolylineOptions;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.MoGoV2XServicePaths;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
@@ -27,7 +28,11 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
@Override
public void drawableWarnPolyline(Context context, DrawLineInfo info) {
public void drawWarnPolyline(Context context, DrawLineInfo info) {
if (info == null) {
return;
}
try {
if (mMogoPolyline != null) {
mMogoPolyline.remove();
@@ -36,19 +41,29 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions();
// 渐变色
// float roadWidth = V2XServiceManager.getMapUIController().getRoadWidth(info.getStartLocation().lon,
// info.getStartLocation().lat, (float) info.getHeading(), true, true);
List<Integer> colors = new ArrayList<>();
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
if (info.getType() != null) {
if (info.getType().equals("1")) { //预警 TODO
colors.add(0xFFFFA31A);
colors.add(0xFFFFA31A);
} else {
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
} else {
Log.e(V2XConst.LOG_NAME_WARN, "info.getType() == null ");
colors.add(0xFFE32F46);
colors.add(0xFFE32F46);
}
// Log.d(V2XConst.LOG_NAME_WARN, "MoGoWarnPolylineManager roadWidth = " + roadWidth);
// 线条粗细,渐变,渐变色值
options.width(60).useGradient(true).colorValues(colors);
// options.width(roadWidth).useGradient(true).colorValues(colors);
// 当前车辆位置
options.add(info.getStartLocation());
// 目标车辆位置
@@ -56,7 +71,6 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 绘制线的对象
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
Log.d("liyz", "MoGoWarnPolylineManager drawableWarnPolyline -----> ");
} catch (Exception e) {
e.printStackTrace();

View File

@@ -20,9 +20,9 @@ public class AdasDataBroadcastReceiver extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
try {
// ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
// Logger.d("liyz", "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult));
// Logger.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -->" + GsonUtil.jsonFromObject(adasResult));
String adasResult = (String) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
Log.d("liyz", "AdasDataBroadcastReceiver -----> ");
Log.d(V2XConst.LOG_NAME_WARN, "AdasDataBroadcastReceiver -----> ");
V2XWaringManager.getInstance().registerAdasSocketMessage(context);
} catch (Exception e) {

View File

@@ -25,7 +25,6 @@ public class SceneBroadcastReceiver extends BroadcastReceiver {
try {
V2XMessageEntity v2XMessageEntity = (V2XMessageEntity) intent.getSerializableExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY);
//Logger.d(TAG, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
Log.d("liyz", "SceneBroadcastReceiver ------->");
V2XScenarioManager.getInstance().handlerMessage(v2XMessageEntity);
} catch (Exception e) {
e.printStackTrace();

View File

@@ -1,10 +1,7 @@
package com.mogo.module.v2x.scenario.scene.warning;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.map.MogoLatLng;
import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.MogoMarkerOptions;
import com.mogo.module.common.MogoApisHandler;
@@ -13,9 +10,9 @@ import com.mogo.module.common.drawer.marker.MapMarkerAdapter;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XWarningEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.model.DrawLineInfo;
import com.mogo.module.v2x.scenario.view.IV2XMarker;
import com.mogo.utils.WorkThreadHandler;
@@ -41,19 +38,25 @@ public class V2XWarningMarker implements IV2XMarker {
markerShowEntity.setMarkerType(V2XConst.V2X_FRONT_WARNING_MARKER);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
clearPOI();
WorkThreadHandler.getInstance().postDelayed(() -> {
MogoMarkerOptions options = new MogoMarkerOptions()
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon());
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
Bitmap bitmap = BitmapFactory.decodeResource(AbsMogoApplication.getApp().getResources(), R.drawable.v2x_road_front_p_warning);
options.icon(bitmap);
options.icon3DRes(com.mogo.module.service.R.raw.people);
options.anchorColor("#FF4040");
IMogoMarker marker = V2XServiceManager.getMarkerManager().addMarker(markerShowEntity.getMarkerType(), options);
iMarkerView.setMarker(marker);
marker.setToTop();
}, 1000);
}, 0);
//如果有预警碰撞点,识别物与预警碰撞点之间连线,并执行平移动画
if (mMarkerEntity.getCollisionLat() > 0 && mMarkerEntity.getCollisionLon() != 0) {
drawLine();
smooth();
}
} else {
}
@@ -63,8 +66,21 @@ public class V2XWarningMarker implements IV2XMarker {
}
@Override
public void clearPOI() {
public void drawLine() {
DrawLineInfo drawLineInfo = new DrawLineInfo();
MogoLatLng slatLng = new MogoLatLng(mMarkerEntity.getLat(), mMarkerEntity.getLon());
MogoLatLng endLatLng = new MogoLatLng(mMarkerEntity.getCollisionLat(), mMarkerEntity.getCollisionLon());
drawLineInfo.setStartLocation(slatLng);
drawLineInfo.setEndLocation(endLatLng);
V2XServiceManager.getMoGoWarnPolylineManager().drawWarnPolyline(mContext, drawLineInfo);
}
public void smooth() {
}
@Override
public void clearPOI() {
V2XServiceManager.getMarkerManager().removeMarkers(V2XConst.V2X_FRONT_WARNING_MARKER);
}
}

View File

@@ -69,15 +69,16 @@ public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
break;
case 1:
case 2:
typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
typeImage.setImageResource(R.drawable.v2x_road_front_m_warning);
break;
default:
break;
}
distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "");
warningTextView.setText(mV2XWarningEntity.getTipContent());
warningTextView.setText(mV2XWarningEntity.getWarningContent());
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts());
}
//3秒后移除提示弹框
if (runnableV2XEvent == null) {
runnableV2XEvent = () -> {
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;

View File

@@ -103,6 +103,22 @@ public class EventTypeUtils {
case V2XPoiTypeEnum.FOURS_FOG:
src = R.drawable.v2x_icon_nongwu_vr;
break;
// 封路
case V2XPoiTypeEnum.ROAD_CLOSED:
src = R.drawable.v2x_icon_fenglu_vr;
break;
// 施工
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
src = R.drawable.v2x_icon_daolushigong_vr;
break;
// 事故
case V2XPoiTypeEnum.FOURS_ACCIDENT:
src = R.drawable.v2x_icon_jiaotongshigu_vr;
break;
// 交通检查
case V2XPoiTypeEnum.TRAFFIC_CHECK:
src = R.drawable.v2x_icon_jiaotongjiancha_vr;
break;
default:
src = R.drawable.v2x_icon_live_logo;
break;
@@ -125,6 +141,22 @@ public class EventTypeUtils {
case V2XPoiTypeEnum.FOURS_FOG:
str = "浓雾预警";
break;
// 封路
case V2XPoiTypeEnum.ROAD_CLOSED:
str = "前方封路";
break;
// 施工
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
str = "前方施工";
break;
// 事故
case V2XPoiTypeEnum.FOURS_ACCIDENT:
str = "前方交通事故";
break;
// 交通检查
case V2XPoiTypeEnum.TRAFFIC_CHECK:
str = "前方交通检查";
break;
default:
str = "其它道路事件";
break;