[2.13.2]优化道路事件的语音提示逻辑

This commit is contained in:
renwj
2023-01-14 16:53:26 +08:00
parent 1cb3711386
commit e43f6c404e

View File

@@ -27,6 +27,7 @@ import com.mogo.eagle.core.function.v2x.events.scenario.view.IV2XMarker;
import com.mogo.eagle.core.network.utils.GsonUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
@@ -72,16 +73,23 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
try {
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
//只展示不播报 不广播
boolean onlyShow = getV2XMessageEntity().isOnlyShow();
V2XMessageEntity<V2XRoadEventEntity> entity = getV2XMessageEntity();
boolean onlyShow = entity.isOnlyShow();
if (!onlyShow) {
// 设置TTS
getV2XMessageEntity().getContent().getTts(false);
V2XRoadEventEntity content = entity.getContent();
if (content != null && !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGONG.getPoiType())
&& !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_JINGZHI.getPoiType())
&& !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_SHIGU.getPoiType())
&& !Objects.equals(content.getPoiType(), EventTypeEnumNew.TYPE_SOCKET_ROAD_CONGESTION.getPoiType())) {
content.getTts(false);
}
}
showWindow();
String poiType = getV2XMessageEntity().getContent().getPoiType();
String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat());
String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon());
String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId();
String poiType = entity.getContent().getPoiType();
String lat = String.valueOf(entity.getContent().getLocation().getLat());
String lon = String.valueOf(entity.getContent().getLocation().getLon());
String infoId = entity.getContent().getNoveltyInfo().getInfoId();
String style = "1";
Map<String, Object> properties = new HashMap<>();
properties.put("dbid", infoId);
@@ -117,7 +125,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
if (carLocation != null && noveltyInfo != null) {
MarkerLocation eventLocation = noveltyInfo.getLocation();
if (eventLocation != null) {
double distance = CoordinateUtils.calculateLineDistance(carLocation.getLongitude(), carLocation.getLatitude(), eventLocation.getLon(), eventLocation.getLat());
double distance = content.getDistance();
alarmText = String.format(alarmText, Math.round(distance) + "");
ttsText = String.format(ttsText, Math.round(distance) + "");
}