This commit is contained in:
zhongchao
2021-05-07 20:33:45 +08:00
44 changed files with 253 additions and 863 deletions

View File

@@ -115,7 +115,7 @@ public class V2XSocketManager {
if (mV2XMessageListener_402000 != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401019, mV2XMessageListener_402000);
.unregisterOnMessageListener(402000, mV2XMessageListener_402000);
}
}

View File

@@ -31,9 +31,13 @@ public class V2XOptimalRouteDataRes implements Serializable {
*/
private int most_lane_num;
/**
* 线性经纬度轨迹列表
* Wgs84坐标系线性经纬度轨迹列表
**/
private List<MogoLatLng> locus_list;
/**
* 高德坐标系Gcj线性经纬度轨迹列表
**/
private List<MogoLatLng> gd_locus_list;
public String getSn() {
return sn;
@@ -90,4 +94,12 @@ public class V2XOptimalRouteDataRes implements Serializable {
public void setLocus_list(List<MogoLatLng> locus_list) {
this.locus_list = locus_list;
}
public List<MogoLatLng> getGd_locus_list() {
return gd_locus_list;
}
public void setGd_locus_list(List<MogoLatLng> gd_locus_list) {
this.gd_locus_list = gd_locus_list;
}
}

View File

@@ -31,8 +31,8 @@ public class V2XMessageListener_402000 implements IMogoOnMessageListener<V2XOpti
public void onMsgReceived(V2XOptimalRouteDataRes message) {
// 将接收到的数据转换成最优车道推荐的场景数据
if (message != null
&& message.getLocus_list() != null
&& !message.getLocus_list().isEmpty()) {
&& message.getGd_locus_list() != null
&& !message.getGd_locus_list().isEmpty()) {
Logger.i(MODULE_NAME, "V2XMessageListener_402000" + GsonUtil.jsonFromObject(message));
V2XMessageEntity<V2XOptimalRouteDataRes> v2xMessageEntity = new V2XMessageEntity<>();

View File

@@ -37,7 +37,7 @@ public class MoGoPersonWarnPolylineManager implements IMoGoPersonWarnPolylineMan
}
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions().setGps(true);
MogoPolylineOptions options = new MogoPolylineOptions().setGps(false);
// 渐变色
List<Integer> colors = new ArrayList<>();

View File

@@ -44,7 +44,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
private static String WARNING_ARROWS = "WARNING_ARROWS";
private V2XWarningEntity mCloundWarningInfo;
private static String TAG = "MoGoV2XCloundDataManager";
private boolean isSelfLineClear;
private boolean isSelfLineClear = true;//绘制线是否已被清除
private List fillPoints = new ArrayList();//停止线经纬度合集
private boolean isFirstLocation = false;
private MogoLatLng carLocation = new MogoLatLng(
@@ -158,7 +158,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
float distance = CoordinateUtils.calculateLineDistance(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat);
//扩展点为了渐变色添加
addMiddleLoc = Trigonometric.getNewLocation(startLatlng, distance / 2, Trigonometric.getAngle(startLatlng.lon, startLatlng.lat, endLatlng.lon, endLatlng.lat));
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lat + "," + startLatlng.lon +
Log.d(TAG, "自车为起点绘制 自车;" + startLatlng.lon + "," + startLatlng.lat +
"中间扩展点" + addMiddleLoc.lon + "," + addMiddleLoc.lat + "终点:" + endLatlng.lon + "," + endLatlng.lat);
if (mogoPolyline != null) {
@@ -306,11 +306,11 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
/**
* 自车定位 移动完成需要 3s消失,这里何时清理,应该是没有数据的时候
* 地图侧回调回的定位Location为高德坐标
*/
@Override
public void onCarLocationChanged2(Location latLng) {
// Log.d(V2XConst.LOG_NAME_WARN, "onCarLocationChanged2 lat = " + latLng.getLatitude() + "--lon =" + latLng.getLongitude() + "---isSelfLineClear = " + isSelfLineClear);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() && isSelfLineClear == false) {
//当行人经纬度交点 开始画线,否则清理
if (mCloundWarningInfo != null) {
mCloundWarningInfo.setCarLocation(new MogoLatLng(latLng.getLatitude(), latLng.getLongitude()));
@@ -318,6 +318,7 @@ public class MoGoV2XCloundDataManager implements IMoGoV2XCloundDataManager, IMog
drawSelfCarLine(latLng.getLongitude(), latLng.getLatitude(), latLng.getBearing());
}
carLocation = new MogoLatLng(latLng.getLatitude(), latLng.getLongitude());
Log.d("车行驶的轨迹---", String.valueOf(latLng.getLongitude()) + "," + String.valueOf(latLng.getLatitude()));
}
@Override

View File

@@ -42,7 +42,7 @@ public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
// 连接线参数
MogoPolylineOptions options = new MogoPolylineOptions()
.setGps(true);
.setGps(false);
List<Integer> colors = new ArrayList<>();
if (info.getDirection() == ALERT_THE_FRONT_CRASH_WARNING_TOP) {

View File

@@ -57,7 +57,7 @@ public class V2XOptimalRouteOverlay {
}
}
mPolylineColors.addAll(ColorUtils.gradientAlpha("#002965ED", "#FF2965ED", mPolylinePointList.size() / 3));
mPolylineColors.addAll(ColorUtils.getGradientAlpha("#002965ED", "#FF2965ED", "#002965ED", mPolylinePointList.size()));
// 替换路径集合
mPolylineOptions.points(mPolylinePointList);

View File

@@ -55,7 +55,7 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
@Override
public void speakTTSVoice(@Nullable String msg, IMogoVoiceCmdCallBack callBack) {
if (!TextUtils.isEmpty(msg)) {
Logger.w(V2XConst.MODULE_NAME, "调用TTS播放语音" + msg);
Logger.d(V2XConst.MODULE_NAME, "调用TTS播放语音" + msg);
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(msg, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack);
}
}

View File

@@ -1,6 +1,5 @@
package com.mogo.module.v2x.scenario.scene.route;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XOptimalRouteDataRes;
@@ -21,7 +20,7 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XOptimalRouteD
@Override
public void drawPOI(V2XOptimalRouteDataRes entity) {
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "drawPOI 绘制VR Marker");
Logger.d(V2XConst.MODULE_NAME + "_" + TAG, "drawPOI 绘制VR Marker");
try {
// 清除道路事件
@@ -29,7 +28,7 @@ public class V2XOptimalRouteVREventMarker implements IV2XMarker<V2XOptimalRouteD
.getMoGoV2XMarkerManager().clearALLPOI();
// 绘制引导线
V2XOptimalRouteObserver.getInstance()
.setPolylinePoint(entity.getLocus_list());
.setPolylinePoint(entity.getGd_locus_list());
} catch (Exception e) {
e.printStackTrace();
}

View File

@@ -421,38 +421,6 @@ public class TestOnLineCarUtils {
return null;
}
/**
* 模拟H5推送场景---推送VR场景信息
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushVR() {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_vr_event_data_yongdu_gongsi_1);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟最优路线推送
@@ -461,7 +429,7 @@ public class TestOnLineCarUtils {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_vr_event_data_yongdu_gongsi_1);
.openRawResource(R.raw.test_data_v2x_zuiyouluxian);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];