修复了当前车辆位置没有拿到的时候距离计算的问题
This commit is contained in:
@@ -16,6 +16,7 @@ public class MarkerCardResult extends BaseData {
|
||||
|
||||
private List<MarkerOnlineCar> onlineCar;
|
||||
private List<MarkerExploreWay> exploreWay;
|
||||
private long messageTime;
|
||||
|
||||
public List<MarkerCarChat> getCarChat() {
|
||||
return carChat;
|
||||
@@ -65,15 +66,11 @@ public class MarkerCardResult extends BaseData {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MarkerCardResult{" +
|
||||
"dataType=" + dataType +
|
||||
", carChat=" + carChat +
|
||||
", exploreWay=" + exploreWay +
|
||||
", onlineCar=" + onlineCar +
|
||||
", shareMusic=" + shareMusic +
|
||||
", noveltyInfo=" + noveltyInfo +
|
||||
'}';
|
||||
public long getMessageTime() {
|
||||
return messageTime;
|
||||
}
|
||||
|
||||
public void setMessageTime(long messageTime) {
|
||||
this.messageTime = messageTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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