修复了当前车辆位置没有拿到的时候距离计算的问题

This commit is contained in:
董宏宇
2020-08-06 17:21:49 +08:00
parent e50a3cc973
commit f66deef594
2 changed files with 10 additions and 14 deletions

View File

@@ -53,15 +53,14 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener<MarkerC
// 当前车辆数据
MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation();
float calculateDistance;
if (currentLocation.getLatitude() == 0 || currentLocation.getLongitude() == 0) {
if (currentLocation.getLatitude() != 0 && currentLocation.getLongitude() != 0) {
calculateDistance = Utils.calculateLineDistance(
new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()),
new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
);
} else {
calculateDistance = markerExploreWay.getDirection();
markerExploreWay.setDistance(calculateDistance);
}
v2XRoadEventEntity.setDistance(calculateDistance);
v2XRoadEventEntity.setDistance(markerExploreWay.getDirection());
v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
v2XRoadEventEntity.setExpireTime(20000);