onlinecar smooth fix bug

This commit is contained in:
ihoudf
2020-04-22 20:26:28 +08:00
parent 5d4fff0e14
commit 978fbf55cb
2 changed files with 73 additions and 70 deletions

View File

@@ -17,6 +17,22 @@ public class MarkerOnlineCar implements Serializable {
private List<MarkerActivitiesScope> activitiesScope;//活动范围数据集合
private int compatibility;//匹配度
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MarkerLocation getLocation() {
return location;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public Boolean getFocus() {
return isFocus;
}
@@ -25,20 +41,12 @@ public class MarkerOnlineCar implements Serializable {
isFocus = focus;
}
public List<MarkerCarPois> getPois() {
return pois;
public MarkerUserInfo getUserInfo() {
return userInfo;
}
public void setPois(List<MarkerCarPois> pois) {
this.pois = pois;
}
public List<MarkerActivitiesScope> getActivitiesScope() {
return activitiesScope;
}
public void setActivitiesScope(List<MarkerActivitiesScope> activitiesScope) {
this.activitiesScope = activitiesScope;
public void setUserInfo(MarkerUserInfo userInfo) {
this.userInfo = userInfo;
}
public MarkerCarInfo getCarInfo() {
@@ -49,12 +57,12 @@ public class MarkerOnlineCar implements Serializable {
this.carInfo = carInfo;
}
public int getCompatibility() {
return compatibility;
public List<MarkerCarPois> getPois() {
return pois;
}
public void setCompatibility(int compatibility) {
this.compatibility = compatibility;
public void setPois(List<MarkerCarPois> pois) {
this.pois = pois;
}
public MarkerDynamicData getDynamicData() {
@@ -73,36 +81,20 @@ public class MarkerOnlineCar implements Serializable {
this.hobbyData = hobbyData;
}
public boolean getIsFocus() {
return isFocus;
public List<MarkerActivitiesScope> getActivitiesScope() {
return activitiesScope;
}
public void setIsFocus(boolean isFocus) {
this.isFocus = isFocus;
public void setActivitiesScope(List<MarkerActivitiesScope> activitiesScope) {
this.activitiesScope = activitiesScope;
}
public MarkerLocation getLocation() {
return location;
public int getCompatibility() {
return compatibility;
}
public void setLocation(MarkerLocation location) {
this.location = location;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public MarkerUserInfo getUserInfo() {
return userInfo;
}
public void setUserInfo(MarkerUserInfo userInfo) {
this.userInfo = userInfo;
public void setCompatibility(int compatibility) {
this.compatibility = compatibility;
}
@Override

View File

@@ -702,11 +702,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if (mLastDataResult == null) {
return;
}
List<MarkerOnlineCar> onlineCarList = mLastDataResult.getOnlineCar();
// List<MarkerOnlineCar> onlineCarList = mLastDataResult.getOnlineCar();
List<MarkerExploreWay> exploreWayList = mLastDataResult.getExploreWay();
List<MarkerNoveltyInfo> noveltyInfoList = mLastDataResult.getNoveltyInfo();
dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ?
new ArrayList<>() : onlineCarList);
// dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ?
// new ArrayList<>() : onlineCarList);
dispatchDataToBis(ServiceConst.CARD_TYPE_ROAD_CONDITION, exploreWayList == null ?
new ArrayList<>() : exploreWayList);
dispatchDataToBis(ServiceConst.CARD_TYPE_NOVELTY, noveltyInfoList == null ?
@@ -824,31 +824,38 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
};
private void getOnlineCarList() {
mRefreshModel.queryOnLineCarWithRoute(mCarLatLng, false, false, new RefreshCallback() {
@Override
public void onSuccess(Object o) {
if (mCurrentModuleName.equals(ServiceConst.CARD_TYPE_BUSINESS_OPERATION )
|| mCurrentModuleName.equals(ServiceConst.CARD_TYPE_USER_DATA) ) {
MarkerResponse data = (MarkerResponse) o;
MarkerCardResult result = data.getResult();
if (result == null) {
return;
mRefreshModel.queryOnLineCarWithRoute(mCarLatLng, false, false, new RefreshCallback() {
@Override
public void onSuccess(Object o) {
MarkerResponse data = (MarkerResponse) o;
MarkerCardResult result = data.getResult();
if (result == null) {
return;
}
for (int i = 0; i < carMarkers.size(); i++) {
IMogoMarker marker = carMarkers.get(i);
marker.destroy();
}
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList);
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
}
for (int i = 0; i < carMarkers.size(); i++) {
IMogoMarker marker = carMarkers.get(i);
marker.destroy();
@Override
public void onFail() {
}
List<MarkerOnlineCar> onlineCarList = result.getOnlineCar();
// Logger.d(TAG, "在线数量" + onlineCarList.size());
dispatchDataToBis(ServiceConst.CARD_TYPE_USER_DATA, onlineCarList == null ? new ArrayList<>() : onlineCarList);
drawOnlineCarMarkers(onlineCarList, ServiceConst.MAX_AMOUNT_SINGLE_CARD);
});
}else {
for (int i = 0; i < carMarkers.size(); i++) {
IMogoMarker marker = carMarkers.get(i);
marker.destroy();
}
@Override
public void onFail() {
}
});
}
}
// 平滑移动
@@ -857,19 +864,23 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
carMarkers.add(iMogoMarker);
List<MarkerCarPois> poisList = markerOnlineCar.getPois();
// Logger.d(TAG, "在线车辆路线坐标" + poisList.toString());
if (poisList.size() > 0) {
if (poisList != null && poisList.size() > 0) {
// Logger.d(TAG, "在线" + poisList.toString());
List<MogoLatLng> points = new ArrayList<>();
for (int j = 0; j < poisList.size(); j++) {
MarkerCarPois pois = poisList.get(j);
double lat = new Double(pois.getCoordinates().get(1).toString());
double lng = new Double(pois.getCoordinates().get(0).toString());
points.add(new MogoLatLng(lat, lng));
if (pois != null && pois.getCoordinates() != null && pois.getCoordinates().size() >= 2) {
double lat = Double.valueOf(pois.getCoordinates().get(1) + "");
double lng = Double.valueOf(pois.getCoordinates().get(0) + "");
points.add(new MogoLatLng(lat, lng));
}
}
if (points.size() >= 1){
points.add(new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()));
iMogoMarker.startSmooth(points, mCarSmoothDuration);
}
points.add(new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()));
iMogoMarker.startSmooth(points, mCarSmoothDuration);
}
}