修复了当前车辆位置没有拿到的时候距离计算的问题
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user