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

@@ -91,8 +91,8 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
MogoLatLng mogoLatLng = new MogoLatLng(data.getCollisionLat(), data.getCollisionLon());
//2D资源图片位置调整
MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180);
MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
// MogoLatLng stopLineNew = Trigonometric.getNewLocation(data.getStopLines().get(1), 5, 180);
// MogoLatLng newLocation = Trigonometric.getNewLocation(mogoLatLng, 5, 180);
IMogoMarker marker = drawMarker(markerShowEntity, modeResType(data.getType()));
//识别物
@@ -101,8 +101,11 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
//识别物下方的红色圆圈
bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(),
data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000);
data.getDirection() == 1 ? data.getStopLines().get(1).lat : data.getCollisionLat(),
data.getDirection() == 1 ? data.getStopLines().get(1).lon : data.getCollisionLon()), (float) data.getHeading(), 5000);
// bottomMarker.addDynamicAnchorPosition(new MogoLatLng(
// data.getDirection() == 1 ? stopLineNew.lat : newLocation.getLat(),
// data.getDirection() == 1 ? stopLineNew.lon : newLocation.getLon()), (float) data.getHeading(), 5000);
//移动完成以后3s后消失
UiThreadHandler.postDelayed(() -> {
marker.remove();
@@ -134,7 +137,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon())
.setGps(true);
.setGps(false);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(modeResType)); //TODO
options.anchorColor("#FB3C3CFF"); //红色#FF3036 蓝色:#256BFF
@@ -150,7 +153,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
.latitude(location.getLat())
.longitude(location.getLon())
.set3DMode(true)
.setGps(true)
.setGps(false)
.controlAngle(true)
.icon3DRes(getModelRes(type))
.anchorColor("#FB3C3CFF")
@@ -169,7 +172,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
.latitude(newLocation.getLat())
.longitude(newLocation.getLon())
.anchor(1.0f, 1.0f)
.setGps(true)
.setGps(false)
.zIndex(MarkerDrawer.MARKER_Z_INDEX_HIGH);
optionsRipple
.icon(ViewUtils.fromView(new EmptyMarkerView(mContext)));
@@ -211,7 +214,7 @@ public class V2XWarnDataDrawer extends BaseDrawer implements IMogoStatusChangedL
.object(markerShowEntity)
.latitude(markerShowEntity.getMarkerLocation().getLat())
.longitude(markerShowEntity.getMarkerLocation().getLon())
.setGps(true);
.setGps(false);
IMarkerView iMarkerView = MapMarkerAdapter.getMarkerView(mContext, markerShowEntity, options);
options.icon3DRes(getModelRes(9));
options.anchorColor("#FB3C3CFF");

View File

@@ -30,7 +30,7 @@
android:id="@+id/fl_speed"
android:layout_width="@dimen/dp_300"
android:layout_height="@dimen/dp_300"
android:layout_marginLeft="@dimen/dp_10"
android:layout_marginLeft="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_10"
android:background="@drawable/yi_biao_pan_bg_nor"
android:elevation="@dimen/dp_10"

View File

@@ -57,7 +57,7 @@
android:id="@+id/warning_right"
android:layout_width="@dimen/dp_390"
android:layout_height="match_parent"
android:layout_marginLeft="@dimen/module_main_id_warning_view_marginLeft"
android:layout_gravity="right"
android:background="@drawable/module_main_warning_bkg_right"
android:visibility="gone" />

View File

@@ -34,5 +34,4 @@
<dimen name="module_main_event_panel_fragment_paddingLeft">18px</dimen>
<dimen name="module_main_event_panel_fragment_paddingRight">18px</dimen>
<dimen name="module_main_id_warning_view_marginLeft">1530px</dimen>
</resources>

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];

View File

@@ -1,185 +0,0 @@
{
"sceneId": "200008",
"alarmContent": "拥堵路线推荐",
"expireTime": 20000,
"sceneCategory": 0,
"sceneDescription": "拥堵路线推荐",
"sceneName": "拥堵路线推荐",
"sceneLevel": 0,
"videoUrl": "",
"videoChannel": "",
"videoSn": "",
"tts": "发现前方拥堵最优路线快6分钟",
"zoom": false,
"zoomScale": 15,
"userHead": "",
"msgImgUrl": "",
"lat":39.969088,
"lon":116.41808,
"recommendPolyline": [
[
116.731239,
40.196264
],
[
116.731082,
40.19622
],
[
116.730919,
40.196173
],
[
116.730762,
40.196125
],
[
116.730596,
40.196069
],
[
116.730437,
40.196013
],
[
116.730296,
40.195959
],
[
116.730122,
40.19589
],
[
116.729956,
40.195823
],
[
116.729841,
40.195777
],
[
116.729797,
40.195759
],
[
116.729696,
40.195721
],
[
116.729624,
40.195695
],
[
116.729498,
40.195649
],
[
116.729464,
40.195637
],
[
116.729366,
40.195604
],
[
116.729294,
40.195583
],
[
116.729122,
40.195533
],
[
116.728954,
40.195489
],
[
116.728781,
40.195448
],
[
116.728616,
40.195412
],
[
116.728442,
40.195376
],
[
116.728269,
40.195341
],
[
116.728087,
40.195311
],
[
116.727909,
40.195283
],
[
116.727746,
40.195263
],
[
116.727561,
40.195242
],
[
116.727386,
40.195226
],
[
116.727213,
40.195217
],
[
116.727036,
40.19521
],
[
116.726865,
40.195206
],
[
116.72669,
40.195206
],
[
116.726512,
40.195207
],
[
116.726333,
40.195209
],
[
116.726144,
40.195211
],
[
116.725959,
40.195214
],
[
116.725771,
40.195217
],
[
116.725588,
40.195221
],
[
116.725411,
40.195225
],
[
116.725201,
40.195228
],
[
116.72509,
40.195228
]
]
}

View File

@@ -1,45 +0,0 @@
{
"sceneId": "200008",
"alarmContent": "拥堵路线推荐",
"expireTime": 10000,
"sceneCategory": 0,
"sceneDescription": "拥堵路线推荐",
"sceneName": "拥堵路线推荐",
"sceneLevel": 0,
"videoUrl": "",
"videoChannel": "",
"videoSn": "",
"tts": "发现前方拥堵最优路线快6分钟",
"zoom": false,
"zoomScale": 15,
"userHead": "",
"msgImgUrl": "",
"lat":39.969088,
"lon":116.41808,
"recommendPolyline": [
[
116.417437,39.983323
],
[
116.41924,39.983364
],
[
116.421396,39.983397
],
[
116.422984,39.983421
],
[
116.423016,39.983405
],
[
116.424272,39.983397
],
[
116.425948,39.983465
],
[
116.42628,39.983399
]
]
}

View File

@@ -1,40 +0,0 @@
{
"locus_list": [
{
"lon": 116.417388,
"lat": 39.983351
},
{
"lon": 116.417388,
"lat": 39.983351
},
{
"lon": 116.417351,
"lat": 39.9841
},
{
"lon": 116.417286,
"lat": 39.985423
},
{
"lon": 116.417233,
"lat": 39.98673
},
{
"lon": 116.417179,
"lat": 39.988156
},
{
"lon": 116.417158,
"lat": 39.988493
},
{
"lon": 116.417142,
"lat": 39.989245
},
{
"lon": 116.417174,
"lat": 39.990199
}
]
}

View File

@@ -1,10 +1,10 @@
{
"type": 1,
"lat": 26.8825429,
"lon": 112.5634378,
"lat": 26.879024,
"lon": 112.568783,
"distance": 2,
"collisionLat": 26.88271105,
"collisionLon": 112.5636347,
"collisionLat": 26.8791769,
"collisionLon": 112.56896496,
"stopLines": [
{
"lat": 26.88008312,

View File

@@ -1,19 +1,19 @@
{
"type": 0,
"lat": 26.8826624,
"lon": 112.5635601,
"lat": 26.87912015,
"lon": 112.56885373,
"distance": 2,
"collisionLat": 26.8826262,
"collisionLon": 112.5635926,
"collisionLat": 26.8791769,
"collisionLon": 112.56896496,
"stopLines": [
{
"lat": 26.8826624,
"lon": 112.5635601
"lat": 26.8791769,
"lon": 112.56896496
},
{
"lat": 26.8826262,
"lon": 112.5635926
"lat": 26.879153,
"lon": 112.568997
}
],
"from": 1,

View File

@@ -1,10 +1,10 @@
{
"type": 2,
"lat": 26.8825826,
"lon": 112.5633788,
"lat": 26.879339,
"lon": 112.568933,
"distance": 2,
"collisionLat": 26.8826135,
"collisionLon": 112.5635520,
"collisionLat": 26.8791769,
"collisionLon": 112.56896496,
"stopLines": [
{
"lat": 26.88241239,

View File

@@ -0,0 +1,44 @@
{
"current_lane_id": "1903",
"current_lane_num": -2,
"most_lane_num": -3,
"most_speed": 8.0,
"road_id": "400139",
"sn": "F803EB2046PZD00149",
"locus_list": [
{
"lat": 39.974323417486,
"lon": 116.411520335961
},
{
"lat": 39.974407914698,
"lon": 116.411515520661
},
{
"lat": 39.974658553869,
"lon": 116.411505432781
},
{
"lat": 39.974881303401,
"lon": 116.411499467848
}
],
"gd_locus_list": [
{
"lat": 39.975728,
"lon": 116.41777
},
{
"lat": 39.975813,
"lon": 116.417765
},
{
"lat": 39.976064,
"lon": 116.417755
},
{
"lat": 39.976286,
"lon": 116.417749
}
]
}